Changeset 728a981 for root_commands.c


Ignore:
Timestamp:
2006-03-24T15:16:38Z (18 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
f32d557
Parents:
96ace1b (diff), 9b8a38b (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

    r96ace1b r728a981  
    484484        account_t *a;
    485485       
    486         if( !cmd[2] )
     486        if( !cmd[2] && ( a = account_get( irc, cmd[1] ) ) && a->gc )
     487        {
     488                char *format;
     489                GSList *l;
     490               
     491                if( strchr( irc->umode, 'b' ) != NULL )
     492                        format = "%s\t%s";
     493                else
     494                        format = "%-32.32  %-16.16s";
     495               
     496                irc_usermsg( irc, format, "Handle", "Nickname" );
     497                for( l = a->gc->deny; l; l = l->next )
     498                {
     499                        user_t *u = user_findhandle( a->gc, l->data );
     500                        irc_usermsg( irc, format, l->data, u ? u->nick : "(none)" );
     501                }
     502                irc_usermsg( irc, "End of list." );
     503               
     504                return;
     505        }
     506        else if( !cmd[2] )
    487507        {
    488508                user_t *u = user_find( irc, cmd[1] );
     
    523543        account_t *a;
    524544       
    525         if( !cmd[2] )
     545        if( !cmd[2] && ( a = account_get( irc, cmd[1] ) ) && a->gc )
     546        {
     547                char *format;
     548                GSList *l;
     549               
     550                if( strchr( irc->umode, 'b' ) != NULL )
     551                        format = "%s\t%s";
     552                else
     553                        format = "%-32.32  %-16.16s";
     554               
     555                irc_usermsg( irc, format, "Handle", "Nickname" );
     556                for( l = a->gc->deny; l; l = l->next )
     557                {
     558                        user_t *u = user_findhandle( a->gc, l->data );
     559                        irc_usermsg( irc, format, l->data, u ? u->nick : "(none)" );
     560                }
     561                irc_usermsg( irc, "End of list." );
     562               
     563                return;
     564        }
     565        else if( !cmd[2] )
    526566        {
    527567                user_t *u = user_find( irc, cmd[1] );
     
    635675        int online = 0, away = 0, offline = 0;
    636676        user_t *u;
    637         char s[64];
     677        char s[256];
     678        char *format;
    638679        int n_online = 0, n_away = 0, n_offline = 0;
    639680       
     
    649690                online =  away = 1;
    650691       
    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" );
     692        if( strchr( irc->umode, 'b' ) != NULL )
     693                format = "%s\t%s\t%s";
     694        else
     695                format = "%-16.16s  %-40.40s  %s";
     696       
     697        irc_usermsg( irc, format, "Nick", "User/Host/Network", "Status" );
     698       
     699        for( u = irc->users; u; u = u->next ) if( u->gc && u->online && !u->away )
     700        {
     701                if( online == 1 )
     702                {
     703                        g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
     704                        irc_usermsg( irc, format, u->nick, s, "Online" );
     705                }
     706               
    657707                n_online ++;
    658708        }
    659709
    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 );
     710        for( u = irc->users; u; u = u->next ) if( u->gc && u->online && u->away )
     711        {
     712                if( away == 1 )
     713                {
     714                        g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
     715                        irc_usermsg( irc, format, u->nick, s, u->away );
     716                }
    664717                n_away ++;
    665718        }
    666719       
    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" );
     720        for( u = irc->users; u; u = u->next ) if( u->gc && !u->online )
     721        {
     722                if( offline == 1 )
     723                {
     724                        g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
     725                        irc_usermsg( irc, format, u->nick, s, "Offline" );
     726                }
    671727                n_offline ++;
    672728        }
Note: See TracChangeset for help on using the changeset viewer.