# HG changeset patch # User Mikael Berthe # Date 1130363213 -7200 # Node ID 7c1ca00070e8f9118674ee5c3a5bd1bdd3ec0765 # Parent 357086193b023ebeafadf94a6798c89a7243a87c Add COMPL_RESOURCE (resource completion category) diff -r 357086193b02 -r 7c1ca00070e8 mcabber/src/compl.c --- a/mcabber/src/compl.c Fri Oct 21 23:13:54 2005 +0200 +++ b/mcabber/src/compl.c Wed Oct 26 23:46:53 2005 +0200 @@ -217,6 +217,9 @@ if (cat_flags == COMPL_JID) { return compl_list(ROSTER_TYPE_USER); } + if (cat_flags == COMPL_RESOURCE) { + return buddy_getresources(NULL); + } return NULL; } diff -r 357086193b02 -r 7c1ca00070e8 mcabber/src/compl.h --- a/mcabber/src/compl.h Fri Oct 21 23:13:54 2005 +0200 +++ b/mcabber/src/compl.h Wed Oct 26 23:46:53 2005 +0200 @@ -15,6 +15,7 @@ #define COMPL_GROUPNAME (1<<10) #define COMPL_MULTILINE (1<<11) #define COMPL_ROOM (1<<12) +#define COMPL_RESOURCE (1<<13) void compl_add_category_word(guint, const char *command); void compl_del_category_word(guint categ, const char *word); diff -r 357086193b02 -r 7c1ca00070e8 mcabber/src/roster.c --- a/mcabber/src/roster.c Fri Oct 21 23:13:54 2005 +0200 +++ b/mcabber/src/roster.c Wed Oct 26 23:46:53 2005 +0200 @@ -841,11 +841,16 @@ // buddy_getresources(roster_data) // Return a singly-linked-list of resource names // Note: the caller should free the list (and data) after use +// If roster_data is null, the current buddy is selected GSList *buddy_getresources(gpointer rosterdata) { roster *roster_usr = rosterdata; GSList *reslist = NULL, *lp; + if (!roster_usr) { + if (!current_buddy) return NULL; + roster_usr = BUDDATA(current_buddy); + } for (lp = roster_usr->resource; lp; lp = g_slist_next(lp)) reslist = g_slist_append(reslist, g_strdup(((res*)lp->data)->name));