Changeset 16b5f86


Ignore:
Timestamp:
2006-11-13T10:38:23Z (17 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
9bcbe48
Parents:
0d3f30f
Message:

Added handling of GET_BUDDY_* flags.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber_util.c

    r0d3f30f r16b5f86  
    359359                        if( bud->resource == NULL )
    360360                        {
    361                                 bud = NULL;
     361                                g_free( jid );
     362                                return NULL;
    362363                        }
    363364                        else
     
    370371                }
    371372               
    372                 *s = '/';
    373                 if( bud == NULL && ( flags & GET_BUDDY_CREAT ) )
     373                if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && find_buddy( gc, jid ) )
     374                {
     375                        *s = '/';
    374376                        bud = jabber_buddy_add( gc, jid );
     377                }
    375378               
    376379                g_free( jid );
     
    386389                g_free( jid );
    387390               
    388                 /* An exact match, or only one option. */
    389391                if( bud == NULL )
    390                         return ( flags & GET_BUDDY_CREAT ) ? jabber_buddy_add( gc, jid ) : NULL;
     392                        /* No match. Create it now? */
     393                        return ( ( flags & GET_BUDDY_CREAT ) && find_buddy( gc, jid ) ) ?
     394                                   jabber_buddy_add( gc, jid ) : NULL;
     395                else if( bud->resource && ( flags & GET_BUDDY_EXACT ) )
     396                        /* We want an exact match, so in thise case there shouldn't be a /resource. */
     397                        return NULL;
    391398                else if( ( bud->resource == NULL || bud->next == NULL ) )
     399                        /* No need for selection if there's only one option. */
    392400                        return bud;
    393401               
Note: See TracChangeset for help on using the changeset viewer.