[[project @ 2005-06-28 03:16:45 by unknown_lamer] unknown_lamer**20050628031645 + NOTICEs and PRIVMSGs are now sent correctly if they contain an embedded newline + Max nick length is now configurable via 'maxnicklength' option in bot.conf (defaults to 9) + A few internal cleanups ] { hunk ./AUTHORS 10 +Patches by: +Jos Hulzink +Dale Smith hunk ./ChangeLog 1 +2005-06-27 Clinton Ebadi + + * examples/bot.conf (maxnicklength): Update example config + + * source/Utils.C (valid_nickname_p): Use b->MAX_NICKLENGTH + + * source/Bot.C (readConfig): Look for MAXNICKLENGTH parameter + + * source/Bot.H: Added MAX_NICKLENGTH member + + * source/Utils.H (valid_nickname_p): Now takes Bot* as first argument + + * source/Commands.C (Msg): Send multiple PRIVMSGs when a message + is multiple lines + + * source/UserCommands.C (SetVersion): Convert to use Commands::Notice + + * source/Commands.C (Notice): Send multiple NOTICEs when a message + is multiple lines + hunk ./NEWS 34 +- Misc + + NOTICEs and PRIVMSGs are now sent correctly if they contain an + embedded newline + + Max nick length is now configurable via 'maxnicklength' option in + bot.conf (defaults to 9) hunk ./TODO 9 +* Utils::valid_nickname_p should have a configurable max nick length hunk ./TODO 24 +* Commands::sendCTCP, Commands::sendCTCPReply hunk ./examples/bot.conf 12 + +# Maximum nick length of the bot (default to 9) +# maxnicklength = +maxnicklength = 9 hunk ./source/Bot.C 40 +unsigned int Bot::MAX_NICKLENGTH = 9; hunk ./source/Bot.C 292 + else if (command == "MAXNICKLENGTH") + MAX_NICKLENGTH = std::atoi (parameters); hunk ./source/Bot.H 109 + static unsigned int MAX_NICKLENGTH; hunk ./source/Commands.C 23 +#include "StringTokenizer.H" hunk ./source/Commands.C 492 - QUEUE->sendPrivmsg(who, message); + // Send multi-line messages as seperate privmsgs + StringTokenizer st_message (message); + + while (st_message.more_tokens_p ('\n')) + { + QUEUE->sendPrivmsg(who, st_message.next_token ('\n')); + } hunk ./source/Commands.C 525 - if (nick == "" || !Utils::valid_nickname_p(nick)) + if (nick == "" || !Utils::valid_nickname_p(bot, nick)) hunk ./source/Commands.C 548 - QUEUE->sendNotice(who, message); + // Send multiple lines as multiple notices + StringTokenizer st_message (message); + + while (st_message.more_tokens_p ('\n')) + { + QUEUE->sendNotice(who, st_message.next_token ('\n')); + } hunk ./source/Parser.C 835 - cnx->queue->sendCTCPReply (nick, "VERSION", cnx->bot->versionString); + { + cnx->queue->sendCTCPReply (nick, "VERSION", cnx->bot->versionString); + } hunk ./source/ScriptCommands.C 651 - Utils::scm2str (message)); + Utils::scm2str (message)); + hunk ./source/UserCommands.C 938 - if (!Utils::valid_nickname_p(nick)) { + if (!Utils::valid_nickname_p (cnx->bot, nick)) { hunk ./source/UserCommands.C 1190 + hunk ./source/UserCommands.C 1192 - from->sendNotice(m.getMessage()); + { + Commands::Notice (cnx->bot, from->getNick (), m.getMessage()); + } hunk ./source/Utils.C 126 -Utils::valid_nickname_p (std::string n) +Utils::valid_nickname_p (const Bot *b, std::string n) hunk ./source/Utils.C 129 - if (n[0] == '-' || std::isdigit(n[0]) || n.length() > 9) + if (n[0] == '-' || std::isdigit(n[0]) || n.length() > b->MAX_NICKLENGTH) hunk ./source/Utils.H 49 - bool valid_nickname_p (std::string); + bool valid_nickname_p (const Bot *, std::string); }