From 6bbb939e953bbe1ca9ed3101a1569abe4521f543 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 15 Apr 2007 21:01:13 -0700 Subject: Split serv_got_update() into imcb_buddy_(status|times). (Well, the second one isn't implemented yet, but I'll do that later.) At last I got rid of the hack called get_status_string(). And now Yahoo seems to mess up away messages... --- protocols/jabber/iq.c | 2 +- protocols/jabber/presence.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'protocols/jabber') diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c index 53be819e..46ae9a64 100644 --- a/protocols/jabber/iq.c +++ b/protocols/jabber/iq.c @@ -387,7 +387,7 @@ static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node * /* Don't have any API call for this yet! So let's just try to handle this as well as we can. */ jabber_buddy_remove_bare( ic, jid ); - serv_got_update( ic, jid, 0, 0, 0, 0, 0, 0 ); + imcb_buddy_status( ic, jid, 0, NULL, NULL ); /* FIXME! */ } } diff --git a/protocols/jabber/presence.c b/protocols/jabber/presence.c index 4007c84e..6bc8117f 100644 --- a/protocols/jabber/presence.c +++ b/protocols/jabber/presence.c @@ -37,6 +37,8 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data ) if( type == NULL ) { + int is_away = 0; + if( !( bud = jabber_buddy_by_jid( ic, from, GET_BUDDY_EXACT | GET_BUDDY_CREAT ) ) ) { if( set_getbool( &ic->irc->set, "debug" ) ) @@ -51,7 +53,11 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data ) bud->away_message = NULL; if( ( c = xt_find_node( node->children, "show" ) ) && c->text_len > 0 ) + { bud->away_state = (void*) jabber_away_state_by_code( c->text ); + if( strcmp( c->text, "chat" ) != 0 ) + is_away = OPT_AWAY; + } else { bud->away_state = NULL; @@ -65,8 +71,9 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data ) else bud->priority = 0; - serv_got_update( ic, bud->bare_jid, 1, 0, 0, 0, - bud->away_state ? UC_UNAVAILABLE : 0, 0 ); + /* FIXME: What to send if there are other resources??? */ + imcb_buddy_status( ic, bud->bare_jid, OPT_LOGGED_IN | is_away, + bud->away_state->full_name, bud->away_message ); } else if( strcmp( type, "unavailable" ) == 0 ) { @@ -86,13 +93,13 @@ xt_status jabber_pkt_presence( struct xt_node *node, gpointer data ) /* Only count this as offline if there's no other resource available anymore. */ if( jabber_buddy_by_jid( ic, from, 0 ) == NULL ) - serv_got_update( ic, from, 0, 0, 0, 0, 0, 0 ); + imcb_buddy_status( ic, from, 0, NULL, NULL ); *s = '/'; } else { - serv_got_update( ic, from, 0, 0, 0, 0, 0, 0 ); + imcb_buddy_status( ic, from, 0, NULL, NULL ); } } else if( strcmp( type, "subscribe" ) == 0 ) -- cgit v1.2.3