Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    r576d6d7 r7b23afd  
    5252        { "import_buddies", 1, cmd_import_buddies },
    5353        { "qlist",          0, cmd_qlist },
     54        { "dump",           0, cmd_dump },
    5455        { NULL }
    5556};
     
    184185        if( g_strcasecmp( cmd[1], "add" ) == 0 )
    185186        {
    186                 int prot;
     187                struct prpl *prpl;
    187188               
    188189                if( cmd[2] == NULL || cmd[3] == NULL || cmd[4] == NULL )
     
    192193                }
    193194               
    194                 for( prot = 0; prot < PROTO_MAX; prot ++ )
    195                         if( proto_name[prot] && *proto_name[prot] && g_strcasecmp( proto_name[prot], cmd[2] ) == 0 )
    196                                 break;
    197                
    198                 if( ( prot == PROTO_MAX ) || ( proto_prpl[prot] == NULL ) )
     195                prpl = find_protocol(cmd[2]);
     196               
     197                if( prpl == NULL )
    199198                {
    200199                        irc_usermsg( irc, "Unknown protocol" );
     
    202201                }
    203202
    204                 if( prot == PROTO_OSCAR && cmd[5] == NULL )
    205                 {
    206                         irc_usermsg( irc, "Not enough parameters" );
    207                         return( 0 );
    208                 }
    209                
    210                 a = account_add( irc, prot, cmd[3], cmd[4] );
     203                a = account_add( irc, prpl, cmd[3], cmd[4] );
    211204               
    212205                if( cmd[5] )
     
    252245                                con = "";
    253246                       
    254                         if( a->protocol == PROTO_OSCAR || a->protocol == PROTO_ICQ || a->protocol == PROTO_TOC )
    255                                 irc_usermsg( irc, "%2d. OSCAR, %s on %s%s", i, a->user, a->server, con );
    256                         else
    257                                 irc_usermsg( irc, "%2d. %s, %s%s", i, proto_name[a->protocol], a->user, con );
     247                        irc_usermsg( irc, "%2d. %s, %s%s", i, a->prpl->name, a->user, con );
    258248                       
    259249                        i ++;
     
    372362                else
    373363                {
    374                         nick_set( irc, cmd[2], a->gc->protocol, cmd[3] );
     364                        nick_set( irc, cmd[2], a->gc->prpl, cmd[3] );
    375365                }
    376366        }
     
    453443        else if( u->send_handler == buddy_send_handler )
    454444        {
    455                 nick_set( irc, u->handle, u->gc->protocol, cmd[2] );
     445                nick_set( irc, u->handle, u->gc->prpl, cmd[2] );
    456446        }
    457447       
     
    664654        if( online == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && u->online && !u->away )
    665655        {
    666                 g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, proto_name[u->gc->user->protocol] );
     656                g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
    667657                irc_usermsg( irc, "%-16.16s  %-40.40s  %s", u->nick, s, "Online" );
    668658                n_online ++;
     
    671661        if( away == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && u->online && u->away )
    672662        {
    673                 g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, proto_name[u->gc->user->protocol] );
     663                g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
    674664                irc_usermsg( irc, "%-16.16s  %-40.40s  %s", u->nick, s, u->away );
    675665                n_away ++;
     
    678668        if( offline == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && !u->online )
    679669        {
    680                 g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, proto_name[u->gc->user->protocol] );
     670                g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
    681671                irc_usermsg( irc, "%-16.16s  %-40.40s  %s", u->nick, s, "Offline" );
    682672                n_offline ++;
     
    784774        for( n = gc->irc->nicks; n; n = n->next )
    785775        {
    786                 if( n->proto == gc->protocol && !user_findhandle( gc, n->handle ) )
     776                if( n->proto == gc->prpl && !user_findhandle( gc, n->handle ) )
    787777                {
    788778                        gc->prpl->add_buddy( gc, n->handle );
     
    795785        return( 0 );
    796786}
     787
     788int cmd_dump( irc_t *irc, char **cmd ) {
     789        write_io_activity();
     790        irc_usermsg(irc, "Wrote GIO activity log to disk.");   
     791       
     792        return( 0 );
     793}
Note: See TracChangeset for help on using the changeset viewer.