diff mcabber/src/roster.c @ 885:afdd81c2c44d

Allow /rename for groups
author Mikael Berthe <mikael@lilotux.net>
date Sun, 28 May 2006 10:42:22 +0200
parents 4f1a93faffea
children ae93e69aaaaf
line wrap: on
line diff
--- a/mcabber/src/roster.c	Sat May 27 19:46:20 2006 +0200
+++ b/mcabber/src/roster.c	Sun May 28 10:42:22 2006 +0200
@@ -259,7 +259,7 @@
     sample.name = (gchar*)jidname;
     comp = (GCompareFunc)&roster_compare_name_type;
   } else
-    return NULL;    // should not happen
+    return NULL;    // Should not happen...
 
   while (sl_roster_elt) {
     roster *roster_elt = (roster*)sl_roster_elt->data;
@@ -293,7 +293,6 @@
     p_group = roster_find(name, namesearch, ROSTER_TYPE_GROUP);
   }
   return p_group;
-
 }
 
 // Returns a pointer to the new user, or existing user with that name
@@ -1258,6 +1257,30 @@
   }
 }
 
+//  foreach_group_member(group, pfunction, param)
+// Call pfunction(buddy, param) for each buddy in the specified group.
+void foreach_group_member(gpointer groupdata,
+                   void (*pfunc)(gpointer rosterdata, void *param),
+                   void *param)
+{
+  roster *roster_elt;
+  GSList *sl_roster_usrelt;
+  roster *roster_usrelt;
+
+  roster_elt = groupdata;
+
+  if (!(roster_elt->type & ROSTER_TYPE_GROUP))
+    return;
+
+  sl_roster_usrelt = roster_elt->list;
+  while (sl_roster_usrelt) {  // user list loop
+    roster_usrelt = (roster*) sl_roster_usrelt->data;
+
+    pfunc(roster_usrelt, param);
+    sl_roster_usrelt = g_slist_next(sl_roster_usrelt);
+  }
+}
+
 //  compl_list(type)
 // Returns a list of jid's or groups.  (For commands completion)
 // type: ROSTER_TYPE_USER (jid's) or ROSTER_TYPE_GROUP (group names)