Changeset 5b52a48 for root_commands.c


Ignore:
Timestamp:
2006-07-03T21:22:45Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
7e3592e
Parents:
911f2eb
Message:

Implemented per-account nick lists instead of per-protocol nick lists.
nick_t is dead, instead nicks are just saves in a per-account_t GLib
hash table. While doing this, the import_buddies command finally died
and text_save() disappeared, because the old file format can't handle
most of the new features in this branch anyway.

Still have to implement support for the new nick lists in text_load()!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • root_commands.c

    r911f2eb r5b52a48  
    466466                else
    467467                {
    468                         nick_set( irc, cmd[2], a->gc->acc->prpl, cmd[3] );
     468                        nick_set( a, cmd[2], cmd[3] );
    469469                }
    470470        }
     
    548548                else if( u->send_handler == buddy_send_handler )
    549549                {
    550                         nick_set( irc, u->handle, u->gc->acc->prpl, cmd[2] );
     550                        nick_set( u->gc->acc, u->handle, cmd[2] );
    551551                }
    552552               
     
    569569        u->gc->acc->prpl->remove_buddy( u->gc, u->handle, NULL );
    570570        user_del( irc, cmd[1] );
    571         nick_del( irc, cmd[1] );
     571        nick_del( u->gc->acc, u->handle );
    572572       
    573573        irc_usermsg( irc, "Buddy `%s' (nick %s) removed from contact list", s, cmd[1] );
     
    879879                else
    880880                        irc_usermsg( irc, "%d, BitlBee: %s", num, q->question );
    881 }
    882 
    883 static void cmd_import_buddies( irc_t *irc, char **cmd )
    884 {
    885         struct gaim_connection *gc;
    886         account_t *a;
    887         nick_t *n;
    888        
    889         if( !( a = account_get( irc, cmd[1] ) ) )
    890         {
    891                 irc_usermsg( irc, "Invalid account" );
    892                 return;
    893         }
    894         else if( !( ( gc = a->gc ) && ( a->gc->flags & OPT_LOGGED_IN ) ) )
    895         {
    896                 irc_usermsg( irc, "That account is not on-line" );
    897                 return;
    898         }
    899        
    900         if( cmd[2] )
    901         {
    902                 if( g_strcasecmp( cmd[2], "clear" ) == 0 )
    903                 {
    904                         user_t *u;
    905                        
    906                         /* FIXME: Hmmm, this is actually pretty dangerous code... REMOVEME? :-) */
    907                         for( u = irc->users; u; u = u->next )
    908                                 if( u->gc == gc )
    909                                 {
    910                                         u->gc->acc->prpl->remove_buddy( u->gc, u->handle, NULL );
    911                                         user_del( irc, u->nick );
    912                                 }
    913                        
    914                         irc_usermsg( irc, "Old buddy list cleared." );
    915                 }
    916                 else
    917                 {
    918                         irc_usermsg( irc, "Invalid argument: %s", cmd[2] );
    919                         return;
    920                 }
    921         }
    922        
    923         for( n = gc->irc->nicks; n; n = n->next )
    924         {
    925                 if( n->proto == gc->acc->prpl && !user_findhandle( gc, n->handle ) )
    926                 {
    927                         gc->acc->prpl->add_buddy( gc, n->handle );
    928                         add_buddy( gc, NULL, n->handle, NULL );
    929                 }
    930         }
    931        
    932         irc_usermsg( irc, "Sent all add requests. Please wait for a while, the server needs some time to handle all the adds." );
    933881}
    934882
     
    951899        { "blist",          0, cmd_blist,          0 },
    952900        { "nick",           1, cmd_nick,           0 },
    953         { "import_buddies", 1, cmd_import_buddies, 0 },
    954901        { "qlist",          0, cmd_qlist,          0 },
    955902        { NULL }
Note: See TracChangeset for help on using the changeset viewer.