Changeset aefa533e


Ignore:
Timestamp:
2006-03-21T08:12:22Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
19a6c75
Parents:
1ad104a
Message:

Added a special +b usermode for easier parseability of some things.
(For now blist and qlist, but more should come)

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • irc.h

    r1ad104a raefa533e  
    3333#define IRC_PING_STRING "PinglBee"
    3434
    35 #define UMODES "iasw"
     35#define UMODES "abisw"
    3636#define UMODES_PRIV "Ro"
    3737#define CMODES "nt"
  • protocols/oscar/oscar.c

    r1ad104a raefa533e  
    11501150                reason = msg + 6;
    11511151       
    1152         dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason:\n\n%s", uin, reason ? reason : "No reason given.");
     1152        dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason: %s", uin, reason ? reason : "No reason given.");
    11531153        data->gc = gc;
    11541154        data->uin = uin;
  • query.c

    r1ad104a raefa533e  
    3939        q->no = no;
    4040        q->data = data;
     41       
     42        if( strchr( irc->umode, 'b' ) != NULL )
     43        {
     44                char *s;
     45               
     46                /* At least for the machine-parseable version, get rid of
     47                   newlines to make "parsing" easier. */
     48                for( s = q->question; *s; s ++ )
     49                        if( *s == '\r' || *s == '\n' )
     50                                *s = ' ';
     51        }
    4152       
    4253        if( irc->queries )
     
    127138                disp = 1;
    128139        }
    129         //Using irc_usermsg instead of serv_got_crap because \x02A is a char too, so a SPACE is needed.
    130140        if( ans )
    131141        {
  • root_commands.c

    r1ad104a raefa533e  
    635635        int online = 0, away = 0, offline = 0;
    636636        user_t *u;
    637         char s[64];
     637        char s[256];
     638        char *format;
    638639        int n_online = 0, n_away = 0, n_offline = 0;
    639640       
     
    649650                online =  away = 1;
    650651       
    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" );
     652        if( strchr( irc->umode, 'b' ) != NULL )
     653                format = "%s\t%s\t%s";
     654        else
     655                format = "%-16.16s  %-40.40s  %s";
     656       
     657        irc_usermsg( irc, format, "Nick", "User/Host/Network", "Status" );
     658       
     659        for( u = irc->users; u; u = u->next ) if( u->gc && u->online && !u->away )
     660        {
     661                if( online == 1 )
     662                {
     663                        g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
     664                        irc_usermsg( irc, format, u->nick, s, "Online" );
     665                }
     666               
    657667                n_online ++;
    658668        }
    659669
    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 );
     670        for( u = irc->users; u; u = u->next ) if( u->gc && u->online && u->away )
     671        {
     672                if( away == 1 )
     673                {
     674                        g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
     675                        irc_usermsg( irc, format, u->nick, s, u->away );
     676                }
    664677                n_away ++;
    665678        }
    666679       
    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" );
     680        for( u = irc->users; u; u = u->next ) if( u->gc && !u->online )
     681        {
     682                if( offline == 1 )
     683                {
     684                        g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
     685                        irc_usermsg( irc, format, u->nick, s, "Offline" );
     686                }
    671687                n_offline ++;
    672688        }
    673689       
    674         irc_usermsg( irc, "%d buddies (%d available, %d away, %d offline)", n_online + n_away + n_offline, n_online, n_away, n_offline );
     690        if( strchr( irc->umode, 'b' ) == NULL )
     691                irc_usermsg( irc, "%d buddies (%d available, %d away, %d offline)", n_online + n_away + n_offline, n_online, n_away, n_offline );
    675692}
    676693
Note: See TracChangeset for help on using the changeset viewer.