Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • user.c

    r38cc9d4 r5b52a48  
    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_getint( &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.