Changeset 836 for branches/ithildin-1.1


Ignore:
Timestamp:
05/11/09 01:51:43 (3 years ago)
Author:
wd
Message:

Add normal send check to NPC command (duhhh)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ithildin-1.1/modules/ircd/commands/npc.c

    r835 r836  
    4848 */ 
    4949CLIENT_COMMAND(npc, 3, 3, COMMAND_FL_REGISTERED) { 
     50    static client_t fake_client; 
     51 
    5052    bool action = !strcasecmp(argv[0], NPC_ACTION_COMMAND); 
    5153    channel_t *chan = find_channel(argv[1]); 
    52     static client_t fake_client; 
     54    int sendok = CLIENT_CHECK_OK; 
    5355    size_t message_space = 512; 
    5456    size_t message_length = 0; 
     
    7678        sendto_one(cli, "NOTICE", ":NPC nickname %s is too long (maximum is %d letters)", 
    7779                   argv[2], NICKLEN - 2); 
    78         return COMMAND_WEIGHT_NONE; 
     80        return COMMAND_WEIGHT_LOW; 
    7981    } 
    8082    snprintf(fake_client.nick, NICKLEN, "%s", argv[2]); 
    8183 
    8284    if (MYCLIENT(cli)) { 
     85        if (!CLIENT_MASTER(cli)) { 
     86            sendok = can_can_send_channel(cli, chan, argv[3]); 
     87            if (sendok > 0) { 
     88                sendto_one(cli, RPL_FMT(cli, sendok), chan->name); 
     89                return COMMAND_WEIGHT_MEDIUM; 
     90            } 
     91        } 
     92 
    8393        /* calculate against: ":nick!user@host PRIVMSG #channel :blah (Sender)\r\n" 
    8494         * which is the most antiquated way of passing messages. */ 
     
    96106                       "was too long.  Please remove %u characters to send it.", 
    97107                       argv[3], message_length - message_space); 
    98             return COMMAND_WEIGHT_LOW; 
     108            return COMMAND_WEIGHT_MEDIUM; 
    99109        } 
    100110    } 
Note: See TracChangeset for help on using the changeset viewer.