diff options
Diffstat (limited to 'protocols/jabber')
-rw-r--r-- | protocols/jabber/iq.c | 22 | ||||
-rw-r--r-- | protocols/jabber/jabber_util.c | 6 |
2 files changed, 10 insertions, 18 deletions
diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c index 46ae9a64..2aa9d432 100644 --- a/protocols/jabber/iq.c +++ b/protocols/jabber/iq.c @@ -359,28 +359,20 @@ static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node * c = query->children; while( ( c = xt_find_node( c, "item" ) ) ) { + struct xt_node *group = xt_find_node( node->children, "group" ); char *jid = xt_find_attr( c, "jid" ); char *name = xt_find_attr( c, "name" ); char *sub = xt_find_attr( c, "subscription" ); - if( !jid || !sub ) - { - /* Maybe warn. But how likely is this to happen in the first place? */ - } - else if( initial ) + if( jid && sub ) { if( ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) ) - add_buddy( ic, NULL, jid, name ); - } - else - { - /* This is a roster push item. Find out what changed exactly. */ - if( ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) ) { - if( find_buddy( ic, jid ) == NULL ) - add_buddy( ic, NULL, jid, name ); - else if( name ) - serv_buddy_rename( ic, jid, name ); + if( initial || imcb_find_buddy( ic, jid ) == NULL ) + imcb_add_buddy( ic, jid, ( group && group->text_len ) ? + group->text : NULL ); + + imcb_rename_buddy( ic, jid, name ); } else if( strcmp( sub, "remove" ) == 0 ) { diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index 949a7a4b..3c0e71f4 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -222,7 +222,7 @@ static void jabber_buddy_ask_yes( gpointer w, struct jabber_buddy_ask_data *bla { presence_send_request( bla->ic, bla->handle, "subscribed" ); - if( find_buddy( bla->ic, bla->handle ) == NULL ) + if( imcb_find_buddy( bla->ic, bla->handle ) == NULL ) imcb_ask_add( bla->ic, bla->handle, NULL ); g_free( bla->handle ); @@ -370,7 +370,7 @@ struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid_, } } - if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && find_buddy( ic, jid ) ) + if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && imcb_find_buddy( ic, jid ) ) { *s = '/'; bud = jabber_buddy_add( ic, jid ); @@ -390,7 +390,7 @@ struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid_, if( bud == NULL ) /* No match. Create it now? */ - return ( ( flags & GET_BUDDY_CREAT ) && find_buddy( ic, jid_ ) ) ? + return ( ( flags & GET_BUDDY_CREAT ) && imcb_find_buddy( ic, jid_ ) ) ? jabber_buddy_add( ic, jid_ ) : NULL; else if( bud->resource && ( flags & GET_BUDDY_EXACT ) ) /* We want an exact match, so in thise case there shouldn't be a /resource. */ |