Use urgent flag
authorMikael Berthe <mikael@lilotux.net>
Sun, 21 Mar 2010 15:18:40 +0100
changeset 1805 48e47198a9db
parent 1804 35a1250c111a
child 1806 9daf6b3f30d6
Use urgent flag The urgent sign is set (in MUC rooms only so far)
mcabber/mcabber/hooks.c
--- a/mcabber/mcabber/hooks.c	Sun Mar 21 15:14:24 2010 +0100
+++ b/mcabber/mcabber/hooks.c	Sun Mar 21 15:18:40 2010 +0100
@@ -196,7 +196,7 @@
   GSList *roster_usr;
   unsigned mucnicklen = 0;
   const char *ename = NULL;
-  gboolean attention = FALSE;
+  gboolean attention = FALSE, mucprivmsg = FALSE;
 
   if (encrypted == ENCRYPTED_PGP)
     message_flags |= HBB_PREFIX_PGPCRYPT;
@@ -283,6 +283,7 @@
           g_free(mmsg);
           wmsg = mmsg = g_strdup_printf("PRIV#*%s %s", resname, msg+4);
         }
+        mucprivmsg = TRUE;
       }
       message_flags |= HBB_PREFIX_HLIGHT;
     } else {
@@ -332,6 +333,20 @@
   // have the message twice...
   scr_write_incoming_message(bjid, wmsg, timestamp, message_flags, mucnicklen);
 
+  // Set urgent (a.k.a. "attention") flag
+  {
+    guint uip;
+    if (is_groupchat) {
+      if (mucprivmsg)     uip = ROSTER_UI_PRIO_MUC_PRIV_MESSAGE;
+      else if (attention) uip = ROSTER_UI_PRIO_MUC_HL_MESSAGE;
+      else                uip = ROSTER_UI_PRIO_MUC_MESSAGE;
+    } else {
+      if (attention) uip = ROSTER_UI_PRIO_ATTENTION_MESSAGE;
+      else           uip = ROSTER_UI_PRIO_PRIVATE_MESSAGE;
+    }
+    scr_setattentionflag_if_needed(bjid, FALSE, uip, prio_max);
+  }
+
   // We don't log the modified message, but the original one
   if (wmsg == mmsg)
     wmsg = bmsg;