Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
884:9e6d9f0cf9eb | 885:afdd81c2c44d |
---|---|
257 comp = (GCompareFunc)&roster_compare_jid_type; | 257 comp = (GCompareFunc)&roster_compare_jid_type; |
258 } else if (type == namesearch) { | 258 } else if (type == namesearch) { |
259 sample.name = (gchar*)jidname; | 259 sample.name = (gchar*)jidname; |
260 comp = (GCompareFunc)&roster_compare_name_type; | 260 comp = (GCompareFunc)&roster_compare_name_type; |
261 } else | 261 } else |
262 return NULL; // should not happen | 262 return NULL; // Should not happen... |
263 | 263 |
264 while (sl_roster_elt) { | 264 while (sl_roster_elt) { |
265 roster *roster_elt = (roster*)sl_roster_elt->data; | 265 roster *roster_elt = (roster*)sl_roster_elt->data; |
266 if (roster_type & ROSTER_TYPE_GROUP) { | 266 if (roster_type & ROSTER_TYPE_GROUP) { |
267 if ((type == namesearch) && !strcmp(jidname, roster_elt->name)) | 267 if ((type == namesearch) && !strcmp(jidname, roster_elt->name)) |
291 groups = g_slist_insert_sorted(groups, roster_grp, | 291 groups = g_slist_insert_sorted(groups, roster_grp, |
292 (GCompareFunc)&roster_compare_name); | 292 (GCompareFunc)&roster_compare_name); |
293 p_group = roster_find(name, namesearch, ROSTER_TYPE_GROUP); | 293 p_group = roster_find(name, namesearch, ROSTER_TYPE_GROUP); |
294 } | 294 } |
295 return p_group; | 295 return p_group; |
296 | |
297 } | 296 } |
298 | 297 |
299 // Returns a pointer to the new user, or existing user with that name | 298 // Returns a pointer to the new user, or existing user with that name |
300 GSList *roster_add_user(const char *jid, const char *name, const char *group, | 299 GSList *roster_add_user(const char *jid, const char *name, const char *group, |
301 guint type, enum subscr esub) | 300 guint type, enum subscr esub) |
1256 } | 1255 } |
1257 sl_roster_elt = g_slist_next(sl_roster_elt); | 1256 sl_roster_elt = g_slist_next(sl_roster_elt); |
1258 } | 1257 } |
1259 } | 1258 } |
1260 | 1259 |
1260 // foreach_group_member(group, pfunction, param) | |
1261 // Call pfunction(buddy, param) for each buddy in the specified group. | |
1262 void foreach_group_member(gpointer groupdata, | |
1263 void (*pfunc)(gpointer rosterdata, void *param), | |
1264 void *param) | |
1265 { | |
1266 roster *roster_elt; | |
1267 GSList *sl_roster_usrelt; | |
1268 roster *roster_usrelt; | |
1269 | |
1270 roster_elt = groupdata; | |
1271 | |
1272 if (!(roster_elt->type & ROSTER_TYPE_GROUP)) | |
1273 return; | |
1274 | |
1275 sl_roster_usrelt = roster_elt->list; | |
1276 while (sl_roster_usrelt) { // user list loop | |
1277 roster_usrelt = (roster*) sl_roster_usrelt->data; | |
1278 | |
1279 pfunc(roster_usrelt, param); | |
1280 sl_roster_usrelt = g_slist_next(sl_roster_usrelt); | |
1281 } | |
1282 } | |
1283 | |
1261 // compl_list(type) | 1284 // compl_list(type) |
1262 // Returns a list of jid's or groups. (For commands completion) | 1285 // Returns a list of jid's or groups. (For commands completion) |
1263 // type: ROSTER_TYPE_USER (jid's) or ROSTER_TYPE_GROUP (group names) | 1286 // type: ROSTER_TYPE_USER (jid's) or ROSTER_TYPE_GROUP (group names) |
1264 // The list should be freed by the caller after use. | 1287 // The list should be freed by the caller after use. |
1265 GSList *compl_list(guint type) | 1288 GSList *compl_list(guint type) |