Ignore:
Timestamp:
2007-04-19T06:03:43Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
d323394c
Parents:
33dc261
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/iq.c

    r33dc261 rf0cb961  
    360360        while( ( c = xt_find_node( c, "item" ) ) )
    361361        {
     362                struct xt_node *group = xt_find_node( node->children, "group" );
    362363                char *jid = xt_find_attr( c, "jid" );
    363364                char *name = xt_find_attr( c, "name" );
    364365                char *sub = xt_find_attr( c, "subscription" );
    365366               
    366                 if( !jid || !sub )
    367                 {
    368                         /* Maybe warn. But how likely is this to happen in the first place? */
    369                 }
    370                 else if( initial )
    371                 {
    372                         if( ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) )
    373                                 add_buddy( ic, NULL, jid, name );
    374                 }
    375                 else
    376                 {
    377                         /* This is a roster push item. Find out what changed exactly. */
     367                if( jid && sub )
     368                {
    378369                        if( ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) )
    379370                        {
    380                                 if( find_buddy( ic, jid ) == NULL )
    381                                         add_buddy( ic, NULL, jid, name );
    382                                 else if( name )
    383                                         serv_buddy_rename( ic, jid, name );
     371                                if( initial || imcb_find_buddy( ic, jid ) == NULL )
     372                                        imcb_add_buddy( ic, jid, ( group && group->text_len ) ?
     373                                                                   group->text : NULL );
     374                               
     375                                imcb_rename_buddy( ic, jid, name );
    384376                        }
    385377                        else if( strcmp( sub, "remove" ) == 0 )
Note: See TracChangeset for help on using the changeset viewer.