Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/hooks.c @ 1290:e42f48103609
Drawing the MUC nicks by a different color
(color is hardcoded to red, needs to be changed to something useable)
author | Michal 'vorner' Vaner <vorner@ucw.cz> |
---|---|
date | Sun, 26 Aug 2007 18:24:14 +0200 |
parents | 7c8672bbede5 |
children | 0dda8238af21 |
comparison
equal
deleted
inserted
replaced
1289:57fe57474122 | 1290:e42f48103609 |
---|---|
47 int active_window = FALSE; | 47 int active_window = FALSE; |
48 int message_flags = 0; | 48 int message_flags = 0; |
49 guint rtype = ROSTER_TYPE_USER; | 49 guint rtype = ROSTER_TYPE_USER; |
50 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL; | 50 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL; |
51 GSList *roster_usr; | 51 GSList *roster_usr; |
52 unsigned mucnicklen = 0; | |
52 | 53 |
53 if (encrypted) | 54 if (encrypted) |
54 message_flags |= HBB_PREFIX_PGPCRYPT; | 55 message_flags |= HBB_PREFIX_PGPCRYPT; |
55 | 56 |
56 if (type && !strcmp(type, "groupchat")) { | 57 if (type && !strcmp(type, "groupchat")) { |
61 message_flags = HBB_PREFIX_INFO | HBB_PREFIX_NOFLAG; | 62 message_flags = HBB_PREFIX_INFO | HBB_PREFIX_NOFLAG; |
62 resname = ""; | 63 resname = ""; |
63 wmsg = bmsg = g_strdup_printf("~ %s", msg); | 64 wmsg = bmsg = g_strdup_printf("~ %s", msg); |
64 } else { | 65 } else { |
65 wmsg = bmsg = g_strdup_printf("<%s> %s", resname, msg); | 66 wmsg = bmsg = g_strdup_printf("<%s> %s", resname, msg); |
67 mucnicklen = strlen(resname) + 2; | |
66 if (!strncmp(msg, COMMAND_ME, strlen(COMMAND_ME))) | 68 if (!strncmp(msg, COMMAND_ME, strlen(COMMAND_ME))) |
67 wmsg = mmsg = g_strdup_printf("*%s %s", resname, msg+4); | 69 wmsg = mmsg = g_strdup_printf("*%s %s", resname, msg+4); |
68 } | 70 } |
69 } else { | 71 } else { |
70 bmsg = g_strdup(msg); | 72 bmsg = g_strdup(msg); |
155 } | 157 } |
156 | 158 |
157 // Note: the hlog_write should not be called first, because in some | 159 // Note: the hlog_write should not be called first, because in some |
158 // cases scr_WriteIncomingMessage() will load the history and we'd | 160 // cases scr_WriteIncomingMessage() will load the history and we'd |
159 // have the message twice... | 161 // have the message twice... |
160 scr_WriteIncomingMessage(bjid, wmsg, timestamp, message_flags); | 162 scr_WriteIncomingMessage(bjid, wmsg, timestamp, message_flags, mucnicklen); |
161 | 163 |
162 // We don't log the modified message, but the original one | 164 // We don't log the modified message, but the original one |
163 if (wmsg == mmsg) | 165 if (wmsg == mmsg) |
164 wmsg = bmsg; | 166 wmsg = bmsg; |
165 | 167 |
304 if (scr_BuddyBufferExists(bjid)) { | 306 if (scr_BuddyBufferExists(bjid)) { |
305 bn = g_strdup_printf("Buddy status has changed: [%c>%c] %s", | 307 bn = g_strdup_printf("Buddy status has changed: [%c>%c] %s", |
306 imstatus2char[oldstat], imstatus2char[status], | 308 imstatus2char[oldstat], imstatus2char[status], |
307 ((status_msg) ? status_msg : "")); | 309 ((status_msg) ? status_msg : "")); |
308 scr_WriteIncomingMessage(bjid, bn, timestamp, | 310 scr_WriteIncomingMessage(bjid, bn, timestamp, |
309 HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG); | 311 HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG, 0); |
310 g_free(bn); | 312 g_free(bn); |
311 } | 313 } |
312 } | 314 } |
313 | 315 |
314 roster_setstatus(bjid, rn, prio, status, status_msg, timestamp, | 316 roster_setstatus(bjid, rn, prio, status, status_msg, timestamp, |