diff mcabber/mcabber/screen.c @ 2280:f1eebfdd6db7

Improve efficiency with high number of MUC resources
author Mikael Berthe <mikael@lilotux.net>
date Sat, 24 Sep 2016 12:31:13 +0200
parents f5402d705f67
children 1bb9002801e5
line wrap: on
line diff
--- a/mcabber/mcabber/screen.c	Sat Sep 24 12:30:01 2016 +0200
+++ b/mcabber/mcabber/screen.c	Sat Sep 24 12:31:13 2016 +0200
@@ -2158,7 +2158,6 @@
     unsigned short ismsg, isgrp, ismuc, ishid, isspe;
     guint isurg;
     gchar *rline_locale;
-    GSList *resources, *p_res;
 
     bflags = buddy_getflags(BUDDATA(buddy));
     btype = buddy_gettype(BUDDATA(buddy));
@@ -2178,17 +2177,22 @@
     status = '?';
     pending = ' ';
 
-    resources = buddy_getresources(BUDDATA(buddy));
-    for (p_res = resources ; p_res ; p_res = g_slist_next(p_res)) {
-      guint events = buddy_resource_getevents(BUDDATA(buddy),
-                                              p_res ? p_res->data : "");
-      if ((events & ROSTER_EVENT_PAUSED) && pending != '+')
-        pending = '.';
-      if (events & ROSTER_EVENT_COMPOSING)
-        pending = '+';
-      g_free(p_res->data);
+    if (!ismuc) {
+      // There is currently no chat state support for MUC
+      GSList *resources = buddy_getresources(BUDDATA(buddy));
+      GSList *p_res;
+
+      for (p_res = resources ; p_res ; p_res = g_slist_next(p_res)) {
+        guint events = buddy_resource_getevents(BUDDATA(buddy),
+                                                p_res ? p_res->data : "");
+        if ((events & ROSTER_EVENT_PAUSED) && pending != '+')
+          pending = '.';
+        if (events & ROSTER_EVENT_COMPOSING)
+          pending = '+';
+        g_free(p_res->data);
+      }
+      g_slist_free(resources);
     }
-    g_slist_free(resources);
 
     // Display message notice if there is a message flag, but not
     // for unfolded groups.