diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2007-04-15 21:01:13 -0700 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2007-04-15 21:01:13 -0700 |
commit | 6bbb939e953bbe1ca9ed3101a1569abe4521f543 (patch) | |
tree | 66ad8cc5189d69c57733a12c6d64c50a86a7ff1d /protocols/jabber/presence.c | |
parent | 84b045d409f1e8da6d8bf379c6fef7236dcd9bcd (diff) |
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...
Diffstat (limited to 'protocols/jabber/presence.c')
-rw-r--r-- | protocols/jabber/presence.c | 15 |
1 files changed, 11 insertions, 4 deletions
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 ) |