Mercurial > hg
diff mcabber/src/roster.c @ 439:63562fd409a1
/info can show multiple resources
Add buddy_getresources() and teach /info about multiple resources.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Tue, 20 Sep 2005 21:27:21 +0200 |
parents | b44be19d6229 |
children | 03bb57383cea |
line wrap: on
line diff
--- a/mcabber/src/roster.c Mon Sep 19 23:32:42 2005 +0200 +++ b/mcabber/src/roster.c Tue Sep 20 21:27:21 2005 +0200 @@ -790,6 +790,29 @@ return NULL; } +gchar buddy_getresourceprio(gpointer rosterdata, const char *resname) +{ + roster *roster_usr = rosterdata; + res *p_res = get_resource(roster_usr, resname); + if (p_res) + return p_res->prio; + return 0; +} + +// buddy_getresources(roster_data) +// Return a singly-linked-list of resource names +// Note: the caller should free the list (and data) after use +GSList *buddy_getresources(gpointer rosterdata) +{ + roster *roster_usr = rosterdata; + GSList *reslist = NULL, *lp; + + for (lp = roster_usr->resource; lp; lp = g_slist_next(lp)) + reslist = g_slist_append(reslist, g_strdup(((res*)lp->data)->name)); + + return reslist; +} + // buddy_setflags() // Set one or several flags to value (TRUE/FALSE) void buddy_setflags(gpointer rosterdata, guint flags, guint value)