Mercurial > pidgin.yaz
changeset 12683:41cf9be29754
[gaim-migrate @ 15026]
fix xa and chatty states for jabber
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sun, 01 Jan 2006 16:25:17 +0000 |
parents | d495909dcdc9 |
children | 2e4e02b72e43 |
files | src/protocols/jabber/buddy.c src/protocols/jabber/buddy.h src/protocols/jabber/presence.c |
diffstat | 3 files changed, 47 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/jabber/buddy.c Fri Dec 30 19:33:48 2005 +0000 +++ b/src/protocols/jabber/buddy.c Sun Jan 01 16:25:17 2006 +0000 @@ -1102,6 +1102,27 @@ return JABBER_BUDDY_STATE_UNKNOWN; if(!strcmp(id, "available")) return JABBER_BUDDY_STATE_ONLINE; + if(!strcmp(id, "freeforchat")) + return JABBER_BUDDY_STATE_CHAT; + if(!strcmp(id, "away")) + return JABBER_BUDDY_STATE_AWAY; + if(!strcmp(id, "extended_away")) + return JABBER_BUDDY_STATE_XA; + if(!strcmp(id, "dnd")) + return JABBER_BUDDY_STATE_DND; + if(!strcmp(id, "offline")) + return JABBER_BUDDY_STATE_UNAVAILABLE; + if(!strcmp(id, "error")) + return JABBER_BUDDY_STATE_ERROR; + + return JABBER_BUDDY_STATE_UNKNOWN; +} + +JabberBuddyState jabber_buddy_show_get_state(const char *id) { + if(!id) + return JABBER_BUDDY_STATE_UNKNOWN; + if(!strcmp(id, "available")) + return JABBER_BUDDY_STATE_ONLINE; if(!strcmp(id, "chat")) return JABBER_BUDDY_STATE_CHAT; if(!strcmp(id, "away")) @@ -1118,7 +1139,7 @@ return JABBER_BUDDY_STATE_UNKNOWN; } -const char *jabber_buddy_state_get_status_id(JabberBuddyState state) { +const char *jabber_buddy_state_get_show(JabberBuddyState state) { switch(state) { case JABBER_BUDDY_STATE_CHAT: return "chat"; @@ -1139,6 +1160,27 @@ return NULL; } +const char *jabber_buddy_state_get_status_id(JabberBuddyState state) { + switch(state) { + case JABBER_BUDDY_STATE_CHAT: + return "freeforchat"; + case JABBER_BUDDY_STATE_AWAY: + return "away"; + case JABBER_BUDDY_STATE_XA: + return "extended_away"; + case JABBER_BUDDY_STATE_DND: + return "dnd"; + case JABBER_BUDDY_STATE_ONLINE: + return "available"; + case JABBER_BUDDY_STATE_UNKNOWN: + case JABBER_BUDDY_STATE_ERROR: + return NULL; + case JABBER_BUDDY_STATE_UNAVAILABLE: + return "offline"; + } + return NULL; +} + static void user_search_result_add_buddy_cb(GaimConnection *gc, GList *row) { /* XXX find out the jid */
--- a/src/protocols/jabber/buddy.h Fri Dec 30 19:33:48 2005 +0000 +++ b/src/protocols/jabber/buddy.h Sun Jan 01 16:25:17 2006 +0000 @@ -85,7 +85,9 @@ const char *jabber_buddy_state_get_name(JabberBuddyState state); const char *jabber_buddy_state_get_status_id(JabberBuddyState state); +const char *jabber_buddy_state_get_show(JabberBuddyState state); JabberBuddyState jabber_buddy_status_id_get_state(const char *id); +JabberBuddyState jabber_buddy_show_get_state(const char *id); void jabber_user_search_begin(GaimPluginAction *);
--- a/src/protocols/jabber/presence.c Fri Dec 30 19:33:48 2005 +0000 +++ b/src/protocols/jabber/presence.c Sun Jan 01 16:25:17 2006 +0000 @@ -148,7 +148,7 @@ else if(state != JABBER_BUDDY_STATE_ONLINE && state != JABBER_BUDDY_STATE_UNKNOWN && state != JABBER_BUDDY_STATE_ERROR) - show_string = jabber_buddy_state_get_status_id(state); + show_string = jabber_buddy_state_get_show(state); if(show_string) { show = xmlnode_new_child(presence, "show"); @@ -337,7 +337,7 @@ } else { if((y = xmlnode_get_child(packet, "show"))) { char *show = xmlnode_get_data(y); - state = jabber_buddy_status_id_get_state(show); + state = jabber_buddy_show_get_state(show); g_free(show); } else { state = JABBER_BUDDY_STATE_ONLINE;