diff mcabber/src/roster.c @ 889:ae93e69aaaaf

Fix up pending message flag for the status special buffer It's still disabled (because it isn't useful as is).
author Mikael Berthe <mikael@lilotux.net>
date Tue, 30 May 2006 23:22:37 +0200
parents afdd81c2c44d
children a07bd351008b
line wrap: on
line diff
--- a/mcabber/src/roster.c	Tue May 30 20:36:44 2006 +0200
+++ b/mcabber/src/roster.c	Tue May 30 23:22:37 2006 +0200
@@ -99,7 +99,7 @@
 
 void roster_init(void)
 {
-  roster_special.name = "[status]";
+  roster_special.name = SPECIAL_BUFFER_STATUS_ID;
   roster_special.type = ROSTER_TYPE_SPECIAL;
 }
 
@@ -528,12 +528,32 @@
 // Set the ROSTER_FLAG_MSG to the given value for the given jid.
 // It will update the buddy's group message flag.
 // Update the unread messages list too.
-void roster_msg_setflag(const char *jid, guint value)
+void roster_msg_setflag(const char *jid, guint special, guint value)
 {
   GSList *sl_user;
   roster *roster_usr, *roster_grp;
   int new_roster_item = FALSE;
 
+  if (special) {
+    //sl_user = roster_find(jid, namesearch, ROSTER_TYPE_SPECIAL);
+    //if (!sl_user) return;
+    //roster_usr = (roster*)sl_user->data;
+    roster_usr = &roster_special;
+    if (value) {
+      roster_usr->flags |= ROSTER_FLAG_MSG;
+      // Append the roster_usr to unread_list, but avoid duplicates
+      if (!g_slist_find(unread_list, roster_usr))
+        unread_list = g_slist_append(unread_list, roster_usr);
+    } else {
+      roster_usr->flags &= ~ROSTER_FLAG_MSG;
+      if (unread_list) {
+        GSList *node = g_slist_find(unread_list, roster_usr);
+        if (node) unread_list = g_slist_delete_link(unread_list, node);
+      }
+    }
+    return;
+  }
+
   sl_user = roster_find(jid, jidsearch,
                         ROSTER_TYPE_USER|ROSTER_TYPE_ROOM|ROSTER_TYPE_AGENT);
   // If we can't find it, we add it