Mercurial > pidgin.yaz
diff plugins/jabber/jabber.c @ 1354:6b0a7cea1dd1
[gaim-migrate @ 1364]
yay. state.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 22 Dec 2000 03:14:27 +0000 |
parents | f6a8bca11766 |
children | f0c2d6b88b14 |
line wrap: on
line diff
--- a/plugins/jabber/jabber.c Fri Dec 22 02:26:11 2000 +0000 +++ b/plugins/jabber/jabber.c Fri Dec 22 03:14:27 2000 +0000 @@ -50,6 +50,10 @@ #include "jabber.h" #include "pixmaps/available.xpm" +#include "pixmaps/available-away.xpm" +#include "pixmaps/available-chat.xpm" +#include "pixmaps/available-xa.xpm" +#include "pixmaps/available-dnd.xpm" /* The priv member of gjconn's is a gaim_connection for now. */ #define GJ_GC(x) ((struct gaim_connection *)(x)->priv) @@ -58,6 +62,11 @@ #define IQ_AUTH 0 #define IQ_ROSTER 1 +#define UC_AWAY 0x38 +#define UC_CHAT 0x48 +#define UC_XA 0x98 +#define UC_DND 0x118 + typedef struct gjconn_struct { /* Core structure */ pool p; /* Memory allocation pool */ @@ -440,11 +449,29 @@ struct buddy *b; jid who; char *buddy; + xmlnode y; + char *show; + int state; to = xmlnode_get_attrib(p->x, "to"); from = xmlnode_get_attrib(p->x, "from"); type = xmlnode_get_attrib(p->x, "type"); + if ((y = xmlnode_get_tag(p->x, "show"))) { + show = xmlnode_get_data(y); + if (!strcmp(show, "away")) { + state = UC_AWAY; + } else if (!strcmp(show, "chat")) { + state = UC_CHAT; + } else if (!strcmp(show, "xa")) { + state = UC_XA; + } else if (!strcmp(show, "dnd")) { + state = UC_DND; + } + } else { + state = UC_NORMAL; + } + who = jid_new(j->p, from); if (who->user == NULL) { /* FIXME: transport */ @@ -454,7 +481,7 @@ buddy = g_strdup_printf("%s@%s", who->user, who->server); if (!(b = find_buddy(GJ_GC(j), buddy))) { - add_buddy(GJ_GC(j), "Buddies", buddy, buddy); + b = add_buddy(GJ_GC(j), "Buddies", buddy, buddy); build_edit_tree(); do_export(NULL, NULL); } @@ -462,7 +489,7 @@ if (type && (strcasecmp(type, "unavailable") == 0)) serv_got_update(GJ_GC(j), buddy, 0, 0, 0, 0, 0, 0); else - serv_got_update(GJ_GC(j), buddy, 1, 0, 0, 0, 0, 0); + serv_got_update(GJ_GC(j), buddy, 1, 0, 0, 0, state, 0); g_free(buddy); @@ -774,7 +801,18 @@ static char **jabber_list_icon(int uc) { - return available_xpm; + switch (uc) { + case UC_AWAY: + return available_away_xpm; + case UC_CHAT: + return available_chat_xpm; + case UC_XA: + return available_xa_xpm; + case UC_DND: + return available_dnd_xpm; + default: + return available_xpm; + } } static struct prpl *my_protocol = NULL;