Changeset f0cb961 for protocols/jabber


Ignore:
Timestamp:
2007-04-19T06:03:43Z (17 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.

Location:
protocols/jabber
Files:
2 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 )
  • protocols/jabber/jabber_util.c

    r33dc261 rf0cb961  
    223223        presence_send_request( bla->ic, bla->handle, "subscribed" );
    224224       
    225         if( find_buddy( bla->ic, bla->handle ) == NULL )
     225        if( imcb_find_buddy( bla->ic, bla->handle ) == NULL )
    226226                imcb_ask_add( bla->ic, bla->handle, NULL );
    227227       
     
    371371                }
    372372               
    373                 if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && find_buddy( ic, jid ) )
     373                if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && imcb_find_buddy( ic, jid ) )
    374374                {
    375375                        *s = '/';
     
    391391                if( bud == NULL )
    392392                        /* No match. Create it now? */
    393                         return ( ( flags & GET_BUDDY_CREAT ) && find_buddy( ic, jid_ ) ) ?
     393                        return ( ( flags & GET_BUDDY_CREAT ) && imcb_find_buddy( ic, jid_ ) ) ?
    394394                                   jabber_buddy_add( ic, jid_ ) : NULL;
    395395                else if( bud->resource && ( flags & GET_BUDDY_EXACT ) )
Note: See TracChangeset for help on using the changeset viewer.