Changeset 601e813 for root_commands.c


Ignore:
Timestamp:
2006-05-24T23:04:18Z (18 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
80c1e4d
Parents:
46ad029 (diff), fc630f9 (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:

[merge] Wilmer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • root_commands.c

    r46ad029 r601e813  
    5757                                s --;
    5858                        }
     59                        else
     60                        {
     61                                break;
     62                        }
     63                }
     64                else if( *s == '\\' && ( ( !q && s[1] ) || ( q && q == s[1] ) ) )
     65                {
     66                        char *cpy;
     67                       
     68                        for( cpy = s; *cpy; cpy ++ )
     69                                cpy[0] = cpy[1];
    5970                }
    6071                else if( *s == q )
     
    245256                int i = 0;
    246257               
     258                if( strchr( irc->umode, 'b' ) )
     259                        irc_usermsg( irc, "Account list:" );
     260               
    247261                for( a = irc->accounts; a; a = a->next )
    248262                {
     
    347361{
    348362        account_t *a;
     363        int add_for_real = 1;
     364       
     365        if( g_strcasecmp( cmd[1], "-tmp" ) == 0 )
     366        {
     367                add_for_real = 0;
     368                cmd ++;         /* So evil... :-D */
     369        }
    349370       
    350371        if( !( a = account_get( irc, cmd[1] ) ) )
     
    376397                }
    377398        }
    378         a->gc->prpl->add_buddy( a->gc, cmd[2] );
     399       
     400        /* By making this optional, you can talk to people without having to
     401           add them to your *real* (server-side) contact list. */
     402        if( add_for_real )
     403                a->gc->prpl->add_buddy( a->gc, cmd[2] );
     404               
    379405        add_buddy( a->gc, NULL, cmd[2], cmd[2] );
    380406       
     
    484510        account_t *a;
    485511       
    486         if( !cmd[2] )
     512        if( !cmd[2] && ( a = account_get( irc, cmd[1] ) ) && a->gc )
     513        {
     514                char *format;
     515                GSList *l;
     516               
     517                if( strchr( irc->umode, 'b' ) != NULL )
     518                        format = "%s\t%s";
     519                else
     520                        format = "%-32.32s  %-16.16s";
     521               
     522                irc_usermsg( irc, format, "Handle", "Nickname" );
     523                for( l = a->gc->deny; l; l = l->next )
     524                {
     525                        user_t *u = user_findhandle( a->gc, l->data );
     526                        irc_usermsg( irc, format, l->data, u ? u->nick : "(none)" );
     527                }
     528                irc_usermsg( irc, "End of list." );
     529               
     530                return;
     531        }
     532        else if( !cmd[2] )
    487533        {
    488534                user_t *u = user_find( irc, cmd[1] );
     
    512558        else
    513559        {
    514                 gc->prpl->rem_permit( gc, cmd[2] );
    515                 gc->prpl->add_deny( gc, cmd[2] );
    516                 irc_usermsg( irc, "Buddy `%s' moved from your permit- to your deny-list", cmd[2] );
     560                bim_rem_allow( gc, cmd[2] );
     561                bim_add_block( gc, cmd[2] );
     562                irc_usermsg( irc, "Buddy `%s' moved from your allow- to your block-list", cmd[2] );
    517563        }
    518564}
     
    523569        account_t *a;
    524570       
    525         if( !cmd[2] )
     571        if( !cmd[2] && ( a = account_get( irc, cmd[1] ) ) && a->gc )
     572        {
     573                char *format;
     574                GSList *l;
     575               
     576                if( strchr( irc->umode, 'b' ) != NULL )
     577                        format = "%s\t%s";
     578                else
     579                        format = "%-32.32s  %-16.16s";
     580               
     581                irc_usermsg( irc, format, "Handle", "Nickname" );
     582                for( l = a->gc->deny; l; l = l->next )
     583                {
     584                        user_t *u = user_findhandle( a->gc, l->data );
     585                        irc_usermsg( irc, format, l->data, u ? u->nick : "(none)" );
     586                }
     587                irc_usermsg( irc, "End of list." );
     588               
     589                return;
     590        }
     591        else if( !cmd[2] )
    526592        {
    527593                user_t *u = user_find( irc, cmd[1] );
     
    551617        else
    552618        {
    553                 gc->prpl->rem_deny( gc, cmd[2] );
    554                 gc->prpl->add_permit( gc, cmd[2] );
    555                
    556                 irc_usermsg( irc, "Buddy `%s' moved from your deny- to your permit-list", cmd[2] );
     619                bim_rem_block( gc, cmd[2] );
     620                bim_add_allow( gc, cmd[2] );
     621               
     622                irc_usermsg( irc, "Buddy `%s' moved from your block- to your allow-list", cmd[2] );
    557623        }
    558624}
     
    635701        int online = 0, away = 0, offline = 0;
    636702        user_t *u;
    637         char s[64];
     703        char s[256];
     704        char *format;
    638705        int n_online = 0, n_away = 0, n_offline = 0;
    639706       
     
    649716                online =  away = 1;
    650717       
    651         irc_usermsg( irc, "%-16.16s  %-40.40s  %s", "Nick", "User/Host/Network", "Status" );
    652        
    653         if( online == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && u->online && !u->away )
    654         {
    655                 g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
    656                 irc_usermsg( irc, "%-16.16s  %-40.40s  %s", u->nick, s, "Online" );
     718        if( strchr( irc->umode, 'b' ) != NULL )
     719                format = "%s\t%s\t%s";
     720        else
     721                format = "%-16.16s  %-40.40s  %s";
     722       
     723        irc_usermsg( irc, format, "Nick", "User/Host/Network", "Status" );
     724       
     725        for( u = irc->users; u; u = u->next ) if( u->gc && u->online && !u->away )
     726        {
     727                if( online == 1 )
     728                {
     729                        g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
     730                        irc_usermsg( irc, format, u->nick, s, "Online" );
     731                }
     732               
    657733                n_online ++;
    658734        }
    659735
    660         if( away == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && u->online && u->away )
    661         {
    662                 g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
    663                 irc_usermsg( irc, "%-16.16s  %-40.40s  %s", u->nick, s, u->away );
     736        for( u = irc->users; u; u = u->next ) if( u->gc && u->online && u->away )
     737        {
     738                if( away == 1 )
     739                {
     740                        g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
     741                        irc_usermsg( irc, format, u->nick, s, u->away );
     742                }
    664743                n_away ++;
    665744        }
    666745       
    667         if( offline == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && !u->online )
    668         {
    669                 g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
    670                 irc_usermsg( irc, "%-16.16s  %-40.40s  %s", u->nick, s, "Offline" );
     746        for( u = irc->users; u; u = u->next ) if( u->gc && !u->online )
     747        {
     748                if( offline == 1 )
     749                {
     750                        g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
     751                        irc_usermsg( irc, format, u->nick, s, "Offline" );
     752                }
    671753                n_offline ++;
    672754        }
     
    697779        else
    698780        {
    699                 char utf8[1024];
    700                
    701781                irc_usermsg( irc, "Setting your name to `%s'", cmd[2] );
    702782               
    703                 if( g_strncasecmp( set_getstr( irc, "charset" ), "none", 4 ) != 0 &&
    704                     do_iconv( set_getstr( irc, "charset" ), "UTF-8", cmd[2], utf8, 0, 1024 ) != -1 )
    705                         a->gc->prpl->set_info( a->gc, utf8 );
    706                 else
    707                         a->gc->prpl->set_info( a->gc, cmd[2] );
     783                a->gc->prpl->set_info( a->gc, cmd[2] );
    708784        }
    709785}
Note: See TracChangeset for help on using the changeset viewer.