Changeset e67e513 for root_commands.c


Ignore:
Timestamp:
2011-10-03T14:56:58Z (13 years ago)
Author:
unknown <pesco@…>
Branches:
master
Children:
409c2de
Parents:
3231485
Message:

rename irc_usermsg to irc_rootmsg.
add new irc_usermsg, irc_usernotice.
deliver user-specific messages from libotr as notices to that user.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • root_commands.c

    r3231485 re67e513  
    4242                        if( cmd[blaat] == NULL )                               \
    4343                        {                                                      \
    44                                 irc_usermsg( irc, "Not enough parameters given (need %d).", x ); \
     44                                irc_rootmsg( irc, "Not enough parameters given (need %d).", x ); \
    4545                                return y;                                      \
    4646                        }                                                      \
     
    6969                }
    7070       
    71         irc_usermsg( irc, "Unknown command: %s. Please use \x02help commands\x02 to get a list of available commands.", cmd[0] );
     71        irc_rootmsg( irc, "Unknown command: %s. Please use \x02help commands\x02 to get a list of available commands.", cmd[0] );
    7272}
    7373
     
    9090        if( s )
    9191        {
    92                 irc_usermsg( irc, "%s", s );
     92                irc_rootmsg( irc, "%s", s );
    9393                g_free( s );
    9494        }
    9595        else
    9696        {
    97                 irc_usermsg( irc, "Error opening helpfile." );
     97                irc_rootmsg( irc, "Error opening helpfile." );
    9898        }
    9999}
     
    110110        if( irc->status & USTATUS_IDENTIFIED )
    111111        {
    112                 irc_usermsg( irc, "You're already logged in." );
     112                irc_rootmsg( irc, "You're already logged in." );
    113113                return;
    114114        }
     
    128128        else if( irc->b->accounts != NULL )
    129129        {
    130                 irc_usermsg( irc,
     130                irc_rootmsg( irc,
    131131                             "You're trying to identify yourself, but already have "
    132132                             "at least one IM account set up. "
     
    138138        if( password == NULL )
    139139        {
    140                 irc_usermsg( irc, "About to identify, use /OPER to enter the password" );
     140                irc_rootmsg( irc, "About to identify, use /OPER to enter the password" );
    141141                irc->status |= OPER_HACK_IDENTIFY;
    142142                return;
     
    150150        switch (status) {
    151151        case STORAGE_INVALID_PASSWORD:
    152                 irc_usermsg( irc, "Incorrect password" );
     152                irc_rootmsg( irc, "Incorrect password" );
    153153                break;
    154154        case STORAGE_NO_SUCH_USER:
    155                 irc_usermsg( irc, "The nick is (probably) not registered" );
     155                irc_rootmsg( irc, "The nick is (probably) not registered" );
    156156                break;
    157157        case STORAGE_OK:
    158                 irc_usermsg( irc, "Password accepted%s",
     158                irc_rootmsg( irc, "Password accepted%s",
    159159                             load ? ", settings and accounts loaded" : "" );
    160160                irc_setpass( irc, password );
     
    192192        case STORAGE_OTHER_ERROR:
    193193        default:
    194                 irc_usermsg( irc, "Unknown error while loading configuration" );
     194                irc_rootmsg( irc, "Unknown error while loading configuration" );
    195195                break;
    196196        }
     
    215215        if( global.conf->authmode == AUTHMODE_REGISTERED )
    216216        {
    217                 irc_usermsg( irc, "This server does not allow registering new accounts" );
     217                irc_rootmsg( irc, "This server does not allow registering new accounts" );
    218218                return;
    219219        }
     
    221221        if( cmd[1] == NULL )
    222222        {
    223                 irc_usermsg( irc, "About to register, use /OPER to enter the password" );
     223                irc_rootmsg( irc, "About to register, use /OPER to enter the password" );
    224224                irc->status |= OPER_HACK_REGISTER;
    225225                return;
     
    228228        switch( storage_save( irc, cmd[1], FALSE ) ) {
    229229                case STORAGE_ALREADY_EXISTS:
    230                         irc_usermsg( irc, "Nick is already registered" );
     230                        irc_rootmsg( irc, "Nick is already registered" );
    231231                        break;
    232232                       
    233233                case STORAGE_OK:
    234                         irc_usermsg( irc, "Account successfully created" );
     234                        irc_rootmsg( irc, "Account successfully created" );
    235235                        irc_setpass( irc, cmd[1] );
    236236                        irc->status |= USTATUS_IDENTIFIED;
     
    245245
    246246                default:
    247                         irc_usermsg( irc, "Error registering" );
     247                        irc_rootmsg( irc, "Error registering" );
    248248                        break;
    249249        }
     
    257257        switch (status) {
    258258        case STORAGE_NO_SUCH_USER:
    259                 irc_usermsg( irc, "That account does not exist" );
     259                irc_rootmsg( irc, "That account does not exist" );
    260260                break;
    261261        case STORAGE_INVALID_PASSWORD:
    262                 irc_usermsg( irc, "Password invalid" );
     262                irc_rootmsg( irc, "Password invalid" );
    263263                break;
    264264        case STORAGE_OK:
     
    266266                irc->status &= ~USTATUS_IDENTIFIED;
    267267                irc_umode_set( irc, "-R", 1 );
    268                 irc_usermsg( irc, "Account `%s' removed", irc->user->nick );
     268                irc_rootmsg( irc, "Account `%s' removed", irc->user->nick );
    269269                break;
    270270        default:
    271                 irc_usermsg( irc, "Error: `%d'", status );
     271                irc_rootmsg( irc, "Error: `%d'", status );
    272272                break;
    273273        }
     
    277277{
    278278        if( ( irc->status & USTATUS_IDENTIFIED ) == 0 )
    279                 irc_usermsg( irc, "Please create an account first" );
     279                irc_rootmsg( irc, "Please create an account first" );
    280280        else if( storage_save( irc, NULL, TRUE ) == STORAGE_OK )
    281                 irc_usermsg( irc, "Configuration saved" );
    282         else
    283                 irc_usermsg( irc, "Configuration could not be saved!" );
     281                irc_rootmsg( irc, "Configuration saved" );
     282        else
     283                irc_rootmsg( irc, "Configuration could not be saved!" );
    284284}
    285285
     
    290290       
    291291        if( ( val = set_getstr( head, key ) ) )
    292                 irc_usermsg( irc, "%s = `%s'", key, val );
     292                irc_rootmsg( irc, "%s = `%s'", key, val );
    293293        else if( !( set = set_find( head, key ) ) )
    294294        {
    295                 irc_usermsg( irc, "Setting `%s' does not exist.", key );
     295                irc_rootmsg( irc, "Setting `%s' does not exist.", key );
    296296                if( *head == irc->b->set )
    297                         irc_usermsg( irc, "It might be an account or channel setting. "
     297                        irc_rootmsg( irc, "It might be an account or channel setting. "
    298298                                     "See \x02help account set\x02 and \x02help channel set\x02." );
    299299        }
    300300        else if( set->flags & SET_PASSWORD )
    301                 irc_usermsg( irc, "%s = `********' (hidden)", key );
    302         else
    303                 irc_usermsg( irc, "%s is empty", key );
     301                irc_rootmsg( irc, "%s = `********' (hidden)", key );
     302        else
     303                irc_rootmsg( irc, "%s is empty", key );
    304304}
    305305
     
    344344                           feedback. */
    345345                        if( st )
    346                                 irc_usermsg( irc, "Setting changed successfully" );
     346                                irc_rootmsg( irc, "Setting changed successfully" );
    347347                        else
    348                                 irc_usermsg( irc, "Failed to change setting" );
     348                                irc_rootmsg( irc, "Failed to change setting" );
    349349                }
    350350                else
     
    377377        if( a->ic && s && s->flags & ACC_SET_OFFLINE_ONLY )
    378378        {
    379                 irc_usermsg( irc, "This setting can only be changed when the account is %s-line", "off" );
     379                irc_rootmsg( irc, "This setting can only be changed when the account is %s-line", "off" );
    380380                return 0;
    381381        }
    382382        else if( !a->ic && s && s->flags & ACC_SET_ONLINE_ONLY )
    383383        {
    384                 irc_usermsg( irc, "This setting can only be changed when the account is %s-line", "on" );
     384                irc_rootmsg( irc, "This setting can only be changed when the account is %s-line", "on" );
    385385                return 0;
    386386        }
     
    396396        if( global.conf->authmode == AUTHMODE_REGISTERED && !( irc->status & USTATUS_IDENTIFIED ) )
    397397        {
    398                 irc_usermsg( irc, "This server only accepts registered users" );
     398                irc_rootmsg( irc, "This server only accepts registered users" );
    399399                return;
    400400        }
     
    413413                                if( strcmp( a->pass, PASSWORD_PENDING ) == 0 )
    414414                                {
    415                                         irc_usermsg( irc, "Enter password for account %s(%s) "
     415                                        irc_rootmsg( irc, "Enter password for account %s(%s) "
    416416                                                     "first (use /OPER)", a->prpl->name, a->user );
    417417                                        return;
     
    425425                if( prpl == NULL )
    426426                {
    427                         irc_usermsg( irc, "Unknown protocol" );
     427                        irc_rootmsg( irc, "Unknown protocol" );
    428428                        return;
    429429                }
     
    431431                for( a = irc->b->accounts; a; a = a->next )
    432432                        if( a->prpl == prpl && prpl->handle_cmp( a->user, cmd[3] ) == 0 )
    433                                 irc_usermsg( irc, "Warning: You already have an account with "
     433                                irc_rootmsg( irc, "Warning: You already have an account with "
    434434                                             "protocol `%s' and username `%s'. Are you accidentally "
    435435                                             "trying to add it twice?", prpl->name, cmd[3] );
     
    438438                if( cmd[5] )
    439439                {
    440                         irc_usermsg( irc, "Warning: Passing a servername/other flags to `account add' "
     440                        irc_rootmsg( irc, "Warning: Passing a servername/other flags to `account add' "
    441441                                          "is now deprecated. Use `account set' instead." );
    442442                        set_setstr( &a->set, "server", cmd[5] );
    443443                }
    444444               
    445                 irc_usermsg( irc, "Account successfully added%s", cmd[4] ? "" :
     445                irc_rootmsg( irc, "Account successfully added%s", cmd[4] ? "" :
    446446                             ", now use /OPER to enter the password" );
    447447               
     
    453453               
    454454                if( strchr( irc->umode, 'b' ) )
    455                         irc_usermsg( irc, "Account list:" );
     455                        irc_rootmsg( irc, "Account list:" );
    456456               
    457457                for( a = irc->b->accounts; a; a = a->next )
     
    468468                                con = "";
    469469                       
    470                         irc_usermsg( irc, "%2d (%s): %s, %s%s", i, a->tag, a->prpl->name, a->user, con );
     470                        irc_rootmsg( irc, "%2d (%s): %s, %s%s", i, a->tag, a->prpl->name, a->user, con );
    471471                       
    472472                        i ++;
    473473                }
    474                 irc_usermsg( irc, "End of account list" );
     474                irc_rootmsg( irc, "End of account list" );
    475475               
    476476                return;
     
    484484                if ( irc->b->accounts )
    485485                {
    486                         irc_usermsg( irc, "Trying to get all accounts connected..." );
     486                        irc_rootmsg( irc, "Trying to get all accounts connected..." );
    487487               
    488488                        for( a = irc->b->accounts; a; a = a->next )
     
    490490                                {
    491491                                        if( strcmp( a->pass, PASSWORD_PENDING ) == 0 )
    492                                                 irc_usermsg( irc, "Enter password for account %s(%s) "
     492                                                irc_rootmsg( irc, "Enter password for account %s(%s) "
    493493                                                             "first (use /OPER)", a->prpl->name, a->user );
    494494                                        else
     
    498498                else
    499499                {
    500                         irc_usermsg( irc, "No accounts known. Use `account add' to add one." );
     500                        irc_rootmsg( irc, "No accounts known. Use `account add' to add one." );
    501501                }
    502502               
     
    505505        else if( len >= 2 && g_strncasecmp( cmd[1], "off", len ) == 0 )
    506506        {
    507                 irc_usermsg( irc, "Deactivating all active (re)connections..." );
     507                irc_rootmsg( irc, "Deactivating all active (re)connections..." );
    508508               
    509509                for( a = irc->b->accounts; a; a = a->next )
     
    530530            ( a = account_get( irc->b, cmd[1] ) ) == NULL )
    531531        {
    532                 irc_usermsg( irc, "Could not find account `%s'. Note that the syntax "
     532                irc_rootmsg( irc, "Could not find account `%s'. Note that the syntax "
    533533                             "of the account command changed, see \x02help account\x02.", cmd[1] );
    534534               
     
    540540                if( a->ic )
    541541                {
    542                         irc_usermsg( irc, "Account is still logged in, can't delete" );
     542                        irc_rootmsg( irc, "Account is still logged in, can't delete" );
    543543                }
    544544                else
    545545                {
    546546                        account_del( irc->b, a );
    547                         irc_usermsg( irc, "Account deleted" );
     547                        irc_rootmsg( irc, "Account deleted" );
    548548                }
    549549        }
     
    551551        {
    552552                if( a->ic )
    553                         irc_usermsg( irc, "Account already online" );
     553                        irc_rootmsg( irc, "Account already online" );
    554554                else if( strcmp( a->pass, PASSWORD_PENDING ) == 0 )
    555                         irc_usermsg( irc, "Enter password for account %s(%s) "
     555                        irc_rootmsg( irc, "Enter password for account %s(%s) "
    556556                                     "first (use /OPER)", a->prpl->name, a->user );
    557557                else
     
    567567                {
    568568                        cancel_auto_reconnect( a );
    569                         irc_usermsg( irc, "Reconnect cancelled" );
    570                 }
    571                 else
    572                 {
    573                         irc_usermsg( irc, "Account already offline" );
     569                        irc_rootmsg( irc, "Reconnect cancelled" );
     570                }
     571                else
     572                {
     573                        irc_rootmsg( irc, "Account already offline" );
    574574                }
    575575        }
     
    580580        else
    581581        {
    582                 irc_usermsg( irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "account", cmd[2] );
     582                irc_rootmsg( irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "account", cmd[2] );
    583583        }
    584584}
     
    597597               
    598598                if( strchr( irc->umode, 'b' ) )
    599                         irc_usermsg( irc, "Channel list:" );
     599                        irc_rootmsg( irc, "Channel list:" );
    600600               
    601601                for( l = irc->channels; l; l = l->next )
     
    603603                        irc_channel_t *ic = l->data;
    604604                       
    605                         irc_usermsg( irc, "%2d. %s, %s channel%s", i, ic->name,
     605                        irc_rootmsg( irc, "%2d. %s, %s channel%s", i, ic->name,
    606606                                     set_getstr( &ic->set, "type" ),
    607607                                     ic->flags & IRC_CHANNEL_JOINED ? " (joined)" : "" );
     
    609609                        i ++;
    610610                }
    611                 irc_usermsg( irc, "End of channel list" );
     611                irc_rootmsg( irc, "End of channel list" );
    612612               
    613613                return;
     
    623623                        cmd_set_real( irc, cmd + 1, &ic->set, NULL );
    624624                else
    625                         irc_usermsg( irc, "Could not find channel `%s'", cmd[1] );
     625                        irc_rootmsg( irc, "Could not find channel `%s'", cmd[1] );
    626626               
    627627                return;
     
    640640                    ic != ic->irc->default_channel )
    641641                {
    642                         irc_usermsg( irc, "Channel %s deleted.", ic->name );
     642                        irc_rootmsg( irc, "Channel %s deleted.", ic->name );
    643643                        irc_channel_free( ic );
    644644                }
    645645                else
    646                         irc_usermsg( irc, "Couldn't remove channel (main channel %s or "
     646                        irc_rootmsg( irc, "Couldn't remove channel (main channel %s or "
    647647                                          "channels you're still in cannot be deleted).",
    648648                                          irc->default_channel->name );
     
    650650        else
    651651        {
    652                 irc_usermsg( irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "channel", cmd[1] );
     652                irc_rootmsg( irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "channel", cmd[1] );
    653653        }
    654654}
     
    668668        if( !( a = account_get( irc->b, cmd[1] ) ) )
    669669        {
    670                 irc_usermsg( irc, "Invalid account" );
     670                irc_rootmsg( irc, "Invalid account" );
    671671                return;
    672672        }
    673673        else if( !( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) ) )
    674674        {
    675                 irc_usermsg( irc, "That account is not on-line" );
     675                irc_rootmsg( irc, "That account is not on-line" );
    676676                return;
    677677        }
     
    681681                if( !nick_ok( cmd[3] ) )
    682682                {
    683                         irc_usermsg( irc, "The requested nick `%s' is invalid", cmd[3] );
     683                        irc_rootmsg( irc, "The requested nick `%s' is invalid", cmd[3] );
    684684                        return;
    685685                }
    686686                else if( irc_user_by_name( irc, cmd[3] ) )
    687687                {
    688                         irc_usermsg( irc, "The requested nick `%s' already exists", cmd[3] );
     688                        irc_rootmsg( irc, "The requested nick `%s' already exists", cmd[3] );
    689689                        return;
    690690                }
     
    704704                    strcmp( s, "group" ) == 0 &&
    705705                    ( group = set_getstr( &ic->set, "group" ) ) )
    706                         irc_usermsg( irc, "Adding `%s' to contact list (group %s)",
     706                        irc_rootmsg( irc, "Adding `%s' to contact list (group %s)",
    707707                                     cmd[2], group );
    708708                else
    709                         irc_usermsg( irc, "Adding `%s' to contact list", cmd[2] );
     709                        irc_rootmsg( irc, "Adding `%s' to contact list", cmd[2] );
    710710               
    711711                a->prpl->add_buddy( a->ic, cmd[2], group );
     
    720720                if( ( bu = bee_user_new( irc->b, a->ic, cmd[2], BEE_USER_LOCAL ) ) &&
    721721                    ( iu = bu->ui_data ) )
    722                         irc_usermsg( irc, "Temporarily assigned nickname `%s' "
     722                        irc_rootmsg( irc, "Temporarily assigned nickname `%s' "
    723723                                     "to contact `%s'", iu->nick, cmd[2] );
    724724        }
     
    734734        if( !( iu = irc_user_by_name( irc, cmd[1] ) ) || !( bu = iu->bu ) )
    735735        {
    736                 irc_usermsg( irc, "Buddy `%s' not found", cmd[1] );
     736                irc_rootmsg( irc, "Buddy `%s' not found", cmd[1] );
    737737                return;
    738738        }
     
    744744                bee_user_free( irc->b, bu );
    745745       
    746         irc_usermsg( irc, "Buddy `%s' (nick %s) removed from contact list", s, cmd[1] );
     746        irc_rootmsg( irc, "Buddy `%s' (nick %s) removed from contact list", s, cmd[1] );
    747747        g_free( s );
    748748       
     
    760760                if( !iu || !iu->bu )
    761761                {
    762                         irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] );
     762                        irc_rootmsg( irc, "Nick `%s' does not exist", cmd[1] );
    763763                        return;
    764764                }
     
    768768        else if( !( a = account_get( irc->b, cmd[1] ) ) )
    769769        {
    770                 irc_usermsg( irc, "Invalid account" );
     770                irc_rootmsg( irc, "Invalid account" );
    771771                return;
    772772        }
    773773        else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) )
    774774        {
    775                 irc_usermsg( irc, "That account is not on-line" );
     775                irc_rootmsg( irc, "That account is not on-line" );
    776776                return;
    777777        }
     
    779779        if( !ic->acc->prpl->get_info )
    780780        {
    781                 irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
     781                irc_rootmsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
    782782        }
    783783        else
     
    796796        if( iu == NULL )
    797797        {
    798                 irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] );
     798                irc_rootmsg( irc, "Nick `%s' does not exist", cmd[1] );
    799799        }
    800800        else if( del )
     
    802802                if( iu->bu )
    803803                        bee_irc_user_nick_reset( iu );
    804                 irc_usermsg( irc, "Nickname reset to `%s'", iu->nick );
     804                irc_rootmsg( irc, "Nickname reset to `%s'", iu->nick );
    805805        }
    806806        else if( iu == irc->user )
    807807        {
    808                 irc_usermsg( irc, "Use /nick to change your own nickname" );
     808                irc_rootmsg( irc, "Use /nick to change your own nickname" );
    809809        }
    810810        else if( !nick_ok( cmd[2] ) )
    811811        {
    812                 irc_usermsg( irc, "Nick `%s' is invalid", cmd[2] );
     812                irc_rootmsg( irc, "Nick `%s' is invalid", cmd[2] );
    813813        }
    814814        else if( ( old = irc_user_by_name( irc, cmd[2] ) ) && old != iu )
    815815        {
    816                 irc_usermsg( irc, "Nick `%s' already exists", cmd[2] );
     816                irc_rootmsg( irc, "Nick `%s' already exists", cmd[2] );
    817817        }
    818818        else
     
    820820                if( !irc_user_set_nick( iu, cmd[2] ) )
    821821                {
    822                         irc_usermsg( irc, "Error while changing nick" );
     822                        irc_rootmsg( irc, "Error while changing nick" );
    823823                        return;
    824824                }
     
    836836                }
    837837               
    838                 irc_usermsg( irc, "Nick successfully changed" );
     838                irc_rootmsg( irc, "Nick successfully changed" );
    839839        }
    840840}
     
    869869                        format = "%-32.32s  %-16.16s";
    870870               
    871                 irc_usermsg( irc, format, "Handle", "Nickname" );
     871                irc_rootmsg( irc, format, "Handle", "Nickname" );
    872872                for( l = a->ic->deny; l; l = l->next )
    873873                {
    874874                        bee_user_t *bu = bee_user_by_handle( irc->b, a->ic, l->data );
    875875                        irc_user_t *iu = bu ? bu->ui_data : NULL;
    876                         irc_usermsg( irc, format, l->data, iu ? iu->nick : "(none)" );
    877                 }
    878                 irc_usermsg( irc, "End of list." );
     876                        irc_rootmsg( irc, format, l->data, iu ? iu->nick : "(none)" );
     877                }
     878                irc_rootmsg( irc, "End of list." );
    879879               
    880880                return;
     
    885885                if( !iu || !iu->bu )
    886886                {
    887                         irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] );
     887                        irc_rootmsg( irc, "Nick `%s' does not exist", cmd[1] );
    888888                        return;
    889889                }
     
    893893        else if( !( a = account_get( irc->b, cmd[1] ) ) )
    894894        {
    895                 irc_usermsg( irc, "Invalid account" );
     895                irc_rootmsg( irc, "Invalid account" );
    896896                return;
    897897        }
    898898        else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) )
    899899        {
    900                 irc_usermsg( irc, "That account is not on-line" );
     900                irc_rootmsg( irc, "That account is not on-line" );
    901901                return;
    902902        }
     
    904904        if( !ic->acc->prpl->add_deny || !ic->acc->prpl->rem_permit )
    905905        {
    906                 irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
     906                irc_rootmsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
    907907        }
    908908        else
     
    910910                imc_rem_allow( ic, cmd[2] );
    911911                imc_add_block( ic, cmd[2] );
    912                 irc_usermsg( irc, "Buddy `%s' moved from allow- to block-list", cmd[2] );
     912                irc_rootmsg( irc, "Buddy `%s' moved from allow- to block-list", cmd[2] );
    913913        }
    914914}
     
    929929                        format = "%-32.32s  %-16.16s";
    930930               
    931                 irc_usermsg( irc, format, "Handle", "Nickname" );
     931                irc_rootmsg( irc, format, "Handle", "Nickname" );
    932932                for( l = a->ic->permit; l; l = l->next )
    933933                {
    934934                        bee_user_t *bu = bee_user_by_handle( irc->b, a->ic, l->data );
    935935                        irc_user_t *iu = bu ? bu->ui_data : NULL;
    936                         irc_usermsg( irc, format, l->data, iu ? iu->nick : "(none)" );
    937                 }
    938                 irc_usermsg( irc, "End of list." );
     936                        irc_rootmsg( irc, format, l->data, iu ? iu->nick : "(none)" );
     937                }
     938                irc_rootmsg( irc, "End of list." );
    939939               
    940940                return;
     
    945945                if( !iu || !iu->bu )
    946946                {
    947                         irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] );
     947                        irc_rootmsg( irc, "Nick `%s' does not exist", cmd[1] );
    948948                        return;
    949949                }
     
    953953        else if( !( a = account_get( irc->b, cmd[1] ) ) )
    954954        {
    955                 irc_usermsg( irc, "Invalid account" );
     955                irc_rootmsg( irc, "Invalid account" );
    956956                return;
    957957        }
    958958        else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) )
    959959        {
    960                 irc_usermsg( irc, "That account is not on-line" );
     960                irc_rootmsg( irc, "That account is not on-line" );
    961961                return;
    962962        }
     
    964964        if( !ic->acc->prpl->rem_deny || !ic->acc->prpl->add_permit )
    965965        {
    966                 irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
     966                irc_rootmsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
    967967        }
    968968        else
     
    971971                imc_add_allow( ic, cmd[2] );
    972972               
    973                 irc_usermsg( irc, "Buddy `%s' moved from block- to allow-list", cmd[2] );
     973                irc_rootmsg( irc, "Buddy `%s' moved from block- to allow-list", cmd[2] );
    974974        }
    975975}
     
    998998                        if( ( ++times >= 3 ) )
    999999                        {
    1000                                 irc_usermsg( irc, "%s", msg[rand()%(sizeof(msg)/sizeof(char*))] );
     1000                                irc_rootmsg( irc, "%s", msg[rand()%(sizeof(msg)/sizeof(char*))] );
    10011001                                last_irc = NULL;
    10021002                                times = 0;
     
    10111011                }
    10121012               
    1013                 irc_usermsg( irc, "Did I ask you something?" );
     1013                irc_rootmsg( irc, "Did I ask you something?" );
    10141014                return;
    10151015        }
     
    10211021                if( sscanf( cmd[1], "%d", &numq ) != 1 )
    10221022                {
    1023                         irc_usermsg( irc, "Invalid query number" );
     1023                        irc_rootmsg( irc, "Invalid query number" );
    10241024                        return;
    10251025                }
     
    10311031                if( !q )
    10321032                {
    1033                         irc_usermsg( irc, "Uhm, I never asked you something like that..." );
     1033                        irc_rootmsg( irc, "Uhm, I never asked you something like that..." );
    10341034                        return;
    10351035                }
     
    10711071                format = "%-16.16s  %-40.40s  %s";
    10721072       
    1073         irc_usermsg( irc, format, "Nick", "Handle/Account", "Status" );
     1073        irc_rootmsg( irc, format, "Nick", "Handle/Account", "Status" );
    10741074       
    10751075        if( irc->root->last_channel &&
     
    10941094                       
    10951095                        g_snprintf( s, sizeof( s ) - 1, "%s %s(%s)", bu->handle, bu->ic->acc->prpl->name, bu->ic->acc->user );
    1096                         irc_usermsg( irc, format, iu->nick, s, st );
     1096                        irc_rootmsg( irc, format, iu->nick, s, st );
    10971097                }
    10981098               
     
    11121112                {
    11131113                        g_snprintf( s, sizeof( s ) - 1, "%s %s(%s)", bu->handle, bu->ic->acc->prpl->name, bu->ic->acc->user );
    1114                         irc_usermsg( irc, format, iu->nick, s, irc_user_get_away( iu ) );
     1114                        irc_rootmsg( irc, format, iu->nick, s, irc_user_get_away( iu ) );
    11151115                }
    11161116                n_away ++;
     
    11291129                {
    11301130                        g_snprintf( s, sizeof( s ) - 1, "%s %s(%s)", bu->handle, bu->ic->acc->prpl->name, bu->ic->acc->user );
    1131                         irc_usermsg( irc, format, iu->nick, s, "Offline" );
     1131                        irc_rootmsg( irc, format, iu->nick, s, "Offline" );
    11321132                }
    11331133                n_offline ++;
    11341134        }
    11351135       
    1136         irc_usermsg( irc, "%d buddies (%d available, %d away, %d offline)", n_online + n_away + n_offline, n_online, n_away, n_offline );
     1136        irc_rootmsg( irc, "%d buddies (%d available, %d away, %d offline)", n_online + n_away + n_offline, n_online, n_away, n_offline );
    11371137}
    11381138
     
    11441144        if( !q )
    11451145        {
    1146                 irc_usermsg( irc, "There are no pending questions." );
    1147                 return;
    1148         }
    1149        
    1150         irc_usermsg( irc, "Pending queries:" );
     1146                irc_rootmsg( irc, "There are no pending questions." );
     1147                return;
     1148        }
     1149       
     1150        irc_rootmsg( irc, "Pending queries:" );
    11511151       
    11521152        for( num = 0; q; q = q->next, num ++ )
    11531153                if( q->ic ) /* Not necessary yet, but it might come later */
    1154                         irc_usermsg( irc, "%d, %s(%s): %s", num, q->ic->acc->prpl->name, q->ic->acc->user, q->question );
    1155                 else
    1156                         irc_usermsg( irc, "%d, BitlBee: %s", num, q->question );
     1154                        irc_rootmsg( irc, "%d, %s(%s): %s", num, q->ic->acc->prpl->name, q->ic->acc->user, q->question );
     1155                else
     1156                        irc_rootmsg( irc, "%d, BitlBee: %s", num, q->question );
    11571157}
    11581158
     
    11701170                if( !( acc = account_get( irc->b, cmd[2] ) ) )
    11711171                {
    1172                         irc_usermsg( irc, "Invalid account" );
     1172                        irc_rootmsg( irc, "Invalid account" );
    11731173                        return;
    11741174                }
    11751175                else if( !acc->prpl->chat_join )
    11761176                {
    1177                         irc_usermsg( irc, "Named chatrooms not supported on that account." );
     1177                        irc_rootmsg( irc, "Named chatrooms not supported on that account." );
    11781178                        return;
    11791179                }
     
    12051205                    set_setstr( &ic->set, "room", cmd[3] ) )
    12061206                {
    1207                         irc_usermsg( irc, "Chatroom successfully added." );
     1207                        irc_rootmsg( irc, "Chatroom successfully added." );
    12081208                }
    12091209                else
     
    12121212                                irc_channel_free( ic );
    12131213                       
    1214                         irc_usermsg( irc, "Could not add chatroom." );
     1214                        irc_rootmsg( irc, "Could not add chatroom." );
    12151215                }
    12161216                g_free( channel );
     
    12271227                        if( !iu->bu->ic->acc->prpl->chat_with( iu->bu->ic, iu->bu->handle ) )
    12281228                        {
    1229                                 irc_usermsg( irc, "(Possible) failure while trying to open "
     1229                                irc_rootmsg( irc, "(Possible) failure while trying to open "
    12301230                                                  "a groupchat with %s.", iu->nick );
    12311231                        }
     
    12331233                else
    12341234                {
    1235                         irc_usermsg( irc, "Can't open a groupchat with %s.", cmd[2] );
     1235                        irc_rootmsg( irc, "Can't open a groupchat with %s.", cmd[2] );
    12361236                }
    12371237        }
     
    12401240                 g_strcasecmp( cmd[1], "del" ) == 0 )
    12411241        {
    1242                 irc_usermsg( irc, "Warning: The \002chat\002 command was mostly replaced with the \002channel\002 command." );
     1242                irc_rootmsg( irc, "Warning: The \002chat\002 command was mostly replaced with the \002channel\002 command." );
    12431243                cmd_channel( irc, cmd );
    12441244        }
    12451245        else
    12461246        {
    1247                 irc_usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "chat", cmd[1] );
     1247                irc_rootmsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "chat", cmd[1] );
    12481248        }
    12491249}
     
    12601260               
    12611261                if( strchr( irc->umode, 'b' ) )
    1262                         irc_usermsg( irc, "Group list:" );
     1262                        irc_rootmsg( irc, "Group list:" );
    12631263               
    12641264                for( l = irc->b->groups; l; l = l->next )
    12651265                {
    12661266                        bee_group_t *bg = l->data;
    1267                         irc_usermsg( irc, "%d. %s", n ++, bg->name );
    1268                 }
    1269                 irc_usermsg( irc, "End of group list" );
    1270         }
    1271         else
    1272         {
    1273                 irc_usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "group", cmd[1] );
     1267                        irc_rootmsg( irc, "%d. %s", n ++, bg->name );
     1268                }
     1269                irc_rootmsg( irc, "End of group list" );
     1270        }
     1271        else
     1272        {
     1273                irc_rootmsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "group", cmd[1] );
    12741274        }
    12751275}
     
    12841284        if( !files )
    12851285        {
    1286                 irc_usermsg( irc, "No pending transfers" );
     1286                irc_rootmsg( irc, "No pending transfers" );
    12871287                return;
    12881288        }
     
    13051305                case LIST:
    13061306                        if ( file->status == FT_STATUS_LISTENING )
    1307                                 irc_usermsg( irc,
     1307                                irc_rootmsg( irc,
    13081308                                        "Pending file(id %d): %s (Listening...)", file->local_id, file->file_name);
    13091309                        else
     
    13141314                                        kb_per_s = file->bytes_transferred / 1024 / diff;
    13151315                                       
    1316                                 irc_usermsg( irc,
     1316                                irc_rootmsg( irc,
    13171317                                        "Pending file(id %d): %s (%10zd/%zd kb, %d kb/s)", file->local_id, file->file_name,
    13181318                                        file->bytes_transferred/1024, file->file_size/1024, kb_per_s);
     
    13221322                        if( file->status == FT_STATUS_LISTENING )
    13231323                        {
    1324                                 irc_usermsg( irc, "Rejecting file transfer for %s", file->file_name );
     1324                                irc_rootmsg( irc, "Rejecting file transfer for %s", file->file_name );
    13251325                                imcb_file_canceled( file->ic, file, "Denied by user" );
    13261326                        }
     
    13291329                        if( file->local_id == fid )
    13301330                        {
    1331                                 irc_usermsg( irc, "Canceling file transfer for %s", file->file_name );
     1331                                irc_rootmsg( irc, "Canceling file transfer for %s", file->file_name );
    13321332                                imcb_file_canceled( file->ic, file, "Canceled by user" );
    13331333                        }
     
    13391339static void cmd_nick( irc_t *irc, char **cmd )
    13401340{
    1341         irc_usermsg( irc, "This command is deprecated. Try: account %s set display_name", cmd[1] );
     1341        irc_rootmsg( irc, "This command is deprecated. Try: account %s set display_name", cmd[1] );
    13421342}
    13431343
     
    13541354       
    13551355        if( msg )
    1356                 irc_usermsg( irc, "%s: This seems to be your first time using this "
     1356                irc_rootmsg( irc, "%s: This seems to be your first time using this "
    13571357                                  "this version of BitlBee. Here's a list of new "
    13581358                                  "features you may like to know about:\n\n%s\n",
Note: See TracChangeset for help on using the changeset viewer.