Use the status string of the most likely resource in the chat status bar
authorMikael Berthe <mikael@lilotux.net>
Wed, 01 Oct 2008 19:09:59 +0200
changeset 1522 5ef122b2bb75
parent 1521 33f8f795abd2
child 1523 da91b601bc77
Use the status string of the most likely resource in the chat status bar T. Glaser reported that mcabber can display the status string of a resource with a low priority in the chat status bar. A string which doesn't match the displayed status itself...
mcabber/src/screen.c
--- a/mcabber/src/screen.c	Tue Sep 30 19:50:46 2008 +0200
+++ b/mcabber/src/screen.c	Wed Oct 01 19:09:59 2008 +0200
@@ -1722,13 +1722,16 @@
 
   // No status message for MUC rooms
   if (!ismuc) {
-    GSList *resources, *p_res;
+    GSList *resources, *p_res, *p_next_res;
     resources = buddy_getresources(BUDDATA(current_buddy));
-    msg = buddy_getstatusmsg(BUDDATA(current_buddy),
-                             resources ? resources->data : "");
-    // Free the resources list data
-    for (p_res = resources ; p_res ; p_res = g_slist_next(p_res))
+
+    for (p_res = resources ; p_res ; p_res = p_next_res) {
+      p_next_res = g_slist_next(p_res);
+      // Store the status message of the latest resource (highest priority)
+      if (!p_next_res)
+        msg = buddy_getstatusmsg(BUDDATA(current_buddy), p_res->data);
       g_free(p_res->data);
+    }
     g_slist_free(resources);
   } else {
     msg = buddy_gettopic(BUDDATA(current_buddy));