Mercurial > hg
diff mcabber/src/roster.c @ 848:a9161d2dc414
Introduce special buffer stuff
Update roster and commands: add support for a new "special" kind of buffer.
A special buffer "[status]" is automatically created at startup.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Mon, 08 May 2006 23:45:58 +0200 |
parents | 915a7f17474a |
children | a8fadbd97858 |
line wrap: on
line diff
--- a/mcabber/src/roster.c Mon May 08 22:38:30 2006 +0200 +++ b/mcabber/src/roster.c Mon May 08 23:45:58 2006 +0200 @@ -89,10 +89,20 @@ GList *current_buddy; GList *alternate_buddy; +static roster roster_special; + void unread_jid_add(const char *jid); int unread_jid_del(const char *jid); +/* ### Initialization ### */ + +void roster_init(void) +{ + roster_special.name = "[status]"; + roster_special.type = ROSTER_TYPE_SPECIAL; +} + /* ### Resources functions ### */ static void free_all_resources(GSList **reslist) @@ -715,6 +725,8 @@ buddylist = NULL; } + buddylist = g_list_append(buddylist, &roster_special); + // Create the new list while (sl_roster_elt) { GSList *sl_roster_usrelt; @@ -936,6 +948,9 @@ if (roster_usr->type & ROSTER_TYPE_GROUP) return roster_usr->name; + if (roster_usr->type & ROSTER_TYPE_SPECIAL) + return NULL; + // This is a user return ((roster*)((GSList*)roster_usr->list)->data)->name; } @@ -949,6 +964,9 @@ if (roster_usr->type & ROSTER_TYPE_GROUP) return rosterdata; + if (roster_usr->type & ROSTER_TYPE_SPECIAL) + return NULL; + // This is a user return (gpointer)((GSList*)roster_usr->list)->data; } @@ -1206,6 +1224,8 @@ while (sl_roster_elt) { // group list loop roster_elt = (roster*) sl_roster_elt->data; + if (roster_elt->type & ROSTER_TYPE_SPECIAL) + continue; // Skip special items sl_roster_usrelt = roster_elt->list; while (sl_roster_usrelt) { // user list loop roster_usrelt = (roster*) sl_roster_usrelt->data;