Changeset 69cb623 for user.c


Ignore:
Timestamp:
2006-10-15T09:41:12Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
2529faf
Parents:
695e392 (diff), e97827b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merging with storage-xml. It seems to be working pretty well, so maybe
this way more people will test it. :-)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • user.c

    r695e392 r69cb623  
    6767       
    6868        u->user = u->realname = u->host = u->nick = g_strdup( nick );
    69         u->is_private = set_getint( irc, "private" );
     69        u->is_private = set_getbool( &irc->set, "private" );
    7070       
    7171        key = g_strdup( nick );
     
    143143user_t *user_findhandle( struct gaim_connection *gc, char *handle )
    144144{
    145         user_t *u = gc->irc->users;
    146        
    147         while( u )
    148         {
    149                 if( u->gc == gc && u->handle && gc->prpl->cmp_buddynames ( u->handle, handle ) == 0 )
    150                         break;
    151                 u = u->next;
    152         }
    153        
    154         return( u );
     145        user_t *u;
     146        char *nick;
     147       
     148        /* First, let's try a hash lookup. If it works, it's probably faster. */
     149        if( ( nick = g_hash_table_lookup( gc->acc->nicks, handle ) ) &&
     150            ( u = user_find( gc->irc, nick ) ) &&
     151            ( gc->acc->prpl->handle_cmp( handle, u->handle ) == 0 ) )
     152                return u;
     153       
     154        /* However, it doesn't always work, so in that case we'll have to dig
     155           through the whole userlist. :-( */
     156        for( u = gc->irc->users; u; u = u->next )
     157                if( u->gc == gc && u->handle && gc->acc->prpl->handle_cmp( u->handle, handle ) == 0 )
     158                        return u;
     159       
     160        return NULL;
    155161}
    156162
Note: See TracChangeset for help on using the changeset viewer.