Mercurial > hg
changeset 728:421b337dc6d2
Chat window: Highlight the flag in our messages
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Mon, 06 Mar 2006 10:25:24 +0100 |
parents | 1c3620668857 |
children | 39f67cade02c |
files | mcabber/src/hbuf.h mcabber/src/hooks.c mcabber/src/screen.c |
diffstat | 3 files changed, 30 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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")) {
--- 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);