# HG changeset patch # User Mikael Berthe # Date 1141637124 -3600 # Node ID 421b337dc6d297a42d5c215938ef3d6df6bf8e36 # Parent 1c3620668857e9b724d69d0e2dd877836c4b726b Chat window: Highlight the flag in our messages diff -r 1c3620668857 -r 421b337dc6d2 mcabber/src/hbuf.h --- a/mcabber/src/hbuf.h Sun Mar 05 22:29:14 2006 +0100 +++ b/mcabber/src/hbuf.h Mon Mar 06 10:25:24 2006 +0100 @@ -21,6 +21,7 @@ #define HBB_PREFIX_INFO 16 #define HBB_PREFIX_ERR 32 #define HBB_PREFIX_NOFLAG 64 +#define HBB_PREFIX_HLIGHT 128 typedef struct { time_t timestamp; diff -r 1c3620668857 -r 421b337dc6d2 mcabber/src/hooks.c --- a/mcabber/src/hooks.c Sun Mar 05 22:29:14 2006 +0100 +++ b/mcabber/src/hooks.c Mon Mar 06 10:25:24 2006 +0100 @@ -84,13 +84,23 @@ is_room = !!(buddy_gettype(roster_usr->data) & ROSTER_TYPE_ROOM); - if (!is_groupchat && is_room) { - // This is a private message from a room participant - if (!resname) - resname = ""; - wmsg = bmsg = g_strdup_printf("PRIV#<%s> %s", resname, msg); - if (!strncmp(msg, "/me ", 4)) - wmsg = mmsg = g_strdup_printf("PRIV#*%s %s", resname, msg+4); + if (is_room) { + if (!is_groupchat) { + // This is a private message from a room participant + if (!resname) + resname = ""; + wmsg = bmsg = g_strdup_printf("PRIV#<%s> %s", resname, msg); + if (!strncmp(msg, "/me ", 4)) + wmsg = mmsg = g_strdup_printf("PRIV#*%s %s", resname, msg+4); + message_flags |= HBB_PREFIX_HLIGHT; + } else { + // This is a regular chatroom message. + // Let's see if we are the message sender, in which case we'll + // highlight it. + const char *nick = buddy_getnickname(roster_usr->data); + if (resname && nick && !strcmp(resname, nick)) + message_flags |= HBB_PREFIX_HLIGHT; + } } if (type && !strcmp(type, "error")) { diff -r 1c3620668857 -r 421b337dc6d2 mcabber/src/screen.c --- a/mcabber/src/screen.c Sun Mar 05 22:29:14 2006 +0100 +++ b/mcabber/src/screen.c Mon Mar 06 10:25:24 2006 +0100 @@ -406,11 +406,17 @@ else if (line->flags & HBB_PREFIX_OUT) dir = '>'; wprintw(win_entry->win, "%.11s #%c# ", date, dir); - } else if (line->flags & HBB_PREFIX_IN) - wprintw(win_entry->win, "%.11s <== ", date); - else if (line->flags & HBB_PREFIX_OUT) - wprintw(win_entry->win, "%.11s --> ", date); - else { + } else if (line->flags & HBB_PREFIX_IN) { + wprintw(win_entry->win, "%.11s", date); + if (line->flags & HBB_PREFIX_HLIGHT) wattron(win_entry->win, A_BOLD); + wprintw(win_entry->win, " <== ", date); + if (line->flags & HBB_PREFIX_HLIGHT) wattroff(win_entry->win, A_BOLD); + } else if (line->flags & HBB_PREFIX_OUT) { + wprintw(win_entry->win, "%.11s", date); + wattron(win_entry->win, A_BOLD); + wprintw(win_entry->win, " --> ", date); + wattroff(win_entry->win, A_BOLD); + } else { wprintw(win_entry->win, "%.11s ", date); } wprintw(win_entry->win, "%s", line->text); // line @@ -996,7 +1002,7 @@ void scr_WriteIncomingMessage(const char *jidfrom, const char *text, time_t timestamp, guint prefix) { - if (!(prefix & ~HBB_PREFIX_NOFLAG)) + if (!(prefix & ~HBB_PREFIX_NOFLAG & ~HBB_PREFIX_HLIGHT)) prefix |= HBB_PREFIX_IN; scr_WriteMessage(jidfrom, text, timestamp, prefix);