diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2006-10-15 22:24:01 +0200 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2006-10-15 22:24:01 +0200 |
commit | 788a1afa9628aeaf9d69fc53f49131a4330253cf (patch) | |
tree | caecf2ba1287434d3d94be165c12fb24a56a404a /protocols/jabber/jabber.c | |
parent | e617b35a6771362164aff194cb6e0b757552c0bd (diff) |
Proper cleanup of jabber buddy structures when removing a buddy from the
list, proper checking (and handling) of events related to buddies that
aren't "hashed" yet, limit checks on priorityto setting, renamed JEP85
to XEP85, support for more XEP85 states.
Diffstat (limited to 'protocols/jabber/jabber.c')
-rw-r--r-- | protocols/jabber/jabber.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 26d7bbab..abc3837b 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -146,23 +146,23 @@ static int jabber_send_im( struct gaim_connection *gc, char *who, char *message, bud = jabber_buddy_by_jid( gc, who ); node = xt_new_node( "body", message, NULL ); - node = jabber_make_packet( "message", "chat", bud->full_jid, node ); + node = jabber_make_packet( "message", "chat", bud ? bud->full_jid : who, node ); - if( ( jd->flags & JFLAG_WANT_TYPING ) && - ( ( bud->flags & JBFLAG_DOES_JEP85 ) || - !( bud->flags & JBFLAG_PROBED_JEP85 ) ) ) + if( ( jd->flags & JFLAG_WANT_TYPING ) && bud && + ( ( bud->flags & JBFLAG_DOES_XEP85 ) || + !( bud->flags & JBFLAG_PROBED_XEP85 ) ) ) { struct xt_node *act; /* If the user likes typing notification and if we don't know - (and didn't probe before) if this resource supports JEP85, + (and didn't probe before) if this resource supports XEP85, include a probe in this packet now. */ act = xt_new_node( "active", NULL, NULL ); xt_add_attr( act, "xmlns", "http://jabber.org/protocol/chatstates" ); xt_add_child( node, act ); /* Just make sure we do this only once. */ - bud->flags |= JBFLAG_PROBED_JEP85; + bud->flags |= JBFLAG_PROBED_XEP85; } st = jabber_write_packet( gc, node ); @@ -225,6 +225,9 @@ static void jabber_add_buddy( struct gaim_connection *gc, char *who ) static void jabber_remove_buddy( struct gaim_connection *gc, char *who, char *group ) { + /* We should always do this part. Clean up our administration a little bit. */ + jabber_buddy_remove_bare( gc, who ); + if( jabber_remove_from_roster( gc, who ) ) presence_send_request( gc, who, "unsubscribe" ); } @@ -247,8 +250,14 @@ static int jabber_send_typing( struct gaim_connection *gc, char *who, int typing /* Enable typing notification related code from now. */ jd->flags |= JFLAG_WANT_TYPING; - bud = jabber_buddy_by_jid( gc, who ); - if( bud->flags & JBFLAG_DOES_JEP85 ) + if( ( bud = jabber_buddy_by_jid( gc, who ) ) == NULL ) + { + /* Sending typing notifications to unknown buddies is + unsupported for now. Shouldn't be a problem, I think. */ + return 0; + } + + if( bud->flags & JBFLAG_DOES_XEP85 ) { /* We're only allowed to send this stuff if we know the other side supports it. */ |