aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/iq.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2007-04-18 23:03:43 -0700
committerWilmer van der Gaast <wilmer@gaast.net>2007-04-18 23:03:43 -0700
commitf0cb961652cbd639e89dcd88a86f20a2414146c4 (patch)
tree7bddf3e5f8cd1402639b134773adcb4d04c375dc /protocols/jabber/iq.c
parent33dc2618520409c0d52efff335fe299c26f6dd42 (diff)
More API changes: buddy list management. imcb_add_buddy() is now a *real*
callback, it's only called from inside IM-modules. This makes sure a buddy only gets added to the BitlBee structures if the add was successful. This gets rid of the weirdness described in #55. Unfortunately for now this change breaks A) automatic renaming of ICQ contacts (if there are names stored in the contact list) B) add -tmp.
Diffstat (limited to 'protocols/jabber/iq.c')
-rw-r--r--protocols/jabber/iq.c22
1 files changed, 7 insertions, 15 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 )
{