close Warning: Failed to sync with repository "(default)": [Errno 12] Cannot allocate memory; repository information may be out of date. Look in the Trac log for more information including mitigation strategies.

Ticket #285: root_commands.c.diff

File root_commands.c.diff, 2.4 KB (added by toxik, at 2007-05-17T13:06:31Z)
  • root_commands.c

    === modified file 'root_commands.c'
     
    779779static void cmd_blist( irc_t *irc, char **cmd )
    780780{
    781781        int online = 0, away = 0, offline = 0;
     782        int bot = 0;
    782783        user_t *u;
    783784        char s[256];
    784785        char *format;
     
    795796        else
    796797                online =  away = 1;
    797798       
    798         if( strchr( irc->umode, 'b' ) != NULL )
     799        if( strchr( irc->umode, 'b' ) != NULL ) {
    799800                format = "%s\t%s\t%s";
    800         else
    801                 format = "%-16.16s  %-40.40s  %s";
     801                bot = 1;
     802                irc_usermsg( irc, format, "Nick", "User/Host/Network", "Status" );
     803        } else {
     804                format = "\003%c*\003 %-16.16s  %-40.40s %s";
     805                irc_usermsg( irc, format, 7, "Nickname", "User/Host/Network", "Extra" );
     806        }
    802807       
    803         irc_usermsg( irc, format, "Nick", "User/Host/Network", "Status" );
    804808       
    805809        for( u = irc->users; u; u = u->next ) if( u->ic && u->online && !u->away )
    806810        {
    807811                if( online == 1 )
    808812                {
    809813                        g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->ic->acc->prpl->name );
    810                         irc_usermsg( irc, format, u->nick, s, "Online" );
     814                        if (bot)
     815                                irc_usermsg( irc, format, u->nick, s, "Online" );
     816                        else
     817                                irc_usermsg( irc, format, '3', u->nick, s, "" );
    811818                }
    812819               
    813820                n_online ++;
     
    818825                if( away == 1 )
    819826                {
    820827                        g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->ic->acc->prpl->name );
    821                         irc_usermsg( irc, format, u->nick, s, u->away );
     828                        if (bot)
     829                                irc_usermsg( irc, format, u->nick, s, u->away );
     830                        else
     831                                irc_usermsg( irc, format, '2', u->nick, s, u->away );
    822832                }
    823833                n_away ++;
    824834        }
     
    828838                if( offline == 1 )
    829839                {
    830840                        g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->ic->acc->prpl->name );
    831                         irc_usermsg( irc, format, u->nick, s, "Offline" );
     841                        if (bot)
     842                                irc_usermsg( irc, format, u->nick, s, "Offline" );
     843                        else
     844                                irc_usermsg( irc, format, '4', u->nick, s, "Offline" );
    832845                }
    833846                n_offline ++;
    834847        }
     
    931944        g_free( channel );
    932945}
    933946
     947static void cmd_noop( irc_t *irc, char **cmd )
     948{
     949        /* This is just a function. Don't hurt it. */
     950}
     951
    934952const command_t commands[] = {
    935953        { "help",           0, cmd_help,           0 },
    936954        { "identify",       1, cmd_identify,       0 },
     
    951969        { "nick",           1, cmd_nick,           0 },
    952970        { "qlist",          0, cmd_qlist,          0 },
    953971        { "join_chat",      2, cmd_join_chat,      0 },
     972        { "noop",           0, cmd_noop,           0 },
    954973        { NULL }
    955974};