Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/hooks.c @ 1805:48e47198a9db
Use urgent flag
The urgent sign is set (in MUC rooms only so far)
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 21 Mar 2010 15:18:40 +0100 |
parents | 07e73049f7c5 |
children | 7a1c40549291 |
comparison
equal
deleted
inserted
replaced
1804:35a1250c111a | 1805:48e47198a9db |
---|---|
194 guint rtype = ROSTER_TYPE_USER; | 194 guint rtype = ROSTER_TYPE_USER; |
195 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL; | 195 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL; |
196 GSList *roster_usr; | 196 GSList *roster_usr; |
197 unsigned mucnicklen = 0; | 197 unsigned mucnicklen = 0; |
198 const char *ename = NULL; | 198 const char *ename = NULL; |
199 gboolean attention = FALSE; | 199 gboolean attention = FALSE, mucprivmsg = FALSE; |
200 | 200 |
201 if (encrypted == ENCRYPTED_PGP) | 201 if (encrypted == ENCRYPTED_PGP) |
202 message_flags |= HBB_PREFIX_PGPCRYPT; | 202 message_flags |= HBB_PREFIX_PGPCRYPT; |
203 else if (encrypted == ENCRYPTED_OTR) | 203 else if (encrypted == ENCRYPTED_OTR) |
204 message_flags |= HBB_PREFIX_OTRCRYPT; | 204 message_flags |= HBB_PREFIX_OTRCRYPT; |
281 wmsg = bmsg = g_strdup_printf("PRIV#<%s> %s", resname, msg); | 281 wmsg = bmsg = g_strdup_printf("PRIV#<%s> %s", resname, msg); |
282 if (!strncmp(msg, COMMAND_ME, strlen(COMMAND_ME))) { | 282 if (!strncmp(msg, COMMAND_ME, strlen(COMMAND_ME))) { |
283 g_free(mmsg); | 283 g_free(mmsg); |
284 wmsg = mmsg = g_strdup_printf("PRIV#*%s %s", resname, msg+4); | 284 wmsg = mmsg = g_strdup_printf("PRIV#*%s %s", resname, msg+4); |
285 } | 285 } |
286 mucprivmsg = TRUE; | |
286 } | 287 } |
287 message_flags |= HBB_PREFIX_HLIGHT; | 288 message_flags |= HBB_PREFIX_HLIGHT; |
288 } else { | 289 } else { |
289 // This is a regular chatroom message. | 290 // This is a regular chatroom message. |
290 const char *nick = buddy_getnickname(roster_usr->data); | 291 const char *nick = buddy_getnickname(roster_usr->data); |
330 // Note: the hlog_write should not be called first, because in some | 331 // Note: the hlog_write should not be called first, because in some |
331 // cases scr_write_incoming_message() will load the history and we'd | 332 // cases scr_write_incoming_message() will load the history and we'd |
332 // have the message twice... | 333 // have the message twice... |
333 scr_write_incoming_message(bjid, wmsg, timestamp, message_flags, mucnicklen); | 334 scr_write_incoming_message(bjid, wmsg, timestamp, message_flags, mucnicklen); |
334 | 335 |
336 // Set urgent (a.k.a. "attention") flag | |
337 { | |
338 guint uip; | |
339 if (is_groupchat) { | |
340 if (mucprivmsg) uip = ROSTER_UI_PRIO_MUC_PRIV_MESSAGE; | |
341 else if (attention) uip = ROSTER_UI_PRIO_MUC_HL_MESSAGE; | |
342 else uip = ROSTER_UI_PRIO_MUC_MESSAGE; | |
343 } else { | |
344 if (attention) uip = ROSTER_UI_PRIO_ATTENTION_MESSAGE; | |
345 else uip = ROSTER_UI_PRIO_PRIVATE_MESSAGE; | |
346 } | |
347 scr_setattentionflag_if_needed(bjid, FALSE, uip, prio_max); | |
348 } | |
349 | |
335 // We don't log the modified message, but the original one | 350 // We don't log the modified message, but the original one |
336 if (wmsg == mmsg) | 351 if (wmsg == mmsg) |
337 wmsg = bmsg; | 352 wmsg = bmsg; |
338 | 353 |
339 // - We don't log the message if it is an error message | 354 // - We don't log the message if it is an error message |