Current Maintainer (1.98 and above):
Clinton Ebadi <clinton@unknownlamer.org>
unknown_lamer on OpenProjects and OFTC
+
+Patches by:
+Jos Hulzink
+Dale Smith
\ No newline at end of file
+2005-06-27 Clinton Ebadi <clinton@unknownlamer.org>
+
+ * 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
+
2005-06-25 Clinton Ebadi <clinton@unknownlamer.org>
* source/Main.C (real_main): Enable Guile debugging mode when
* The debugging evaluator is now enabled when --debug is passed to the bot
- Documentation
+ Merged documentation patch from Dale Smith (thanks)
+- 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)
Version 2.1.7:
* Compile without warnings
* bot:protection/[none|no-ban|no-kick|no-deop] constants
* bot:aop/[no|yes] constants
+* Utils::valid_nickname_p should have a configurable max nick length
2.2:
* Finish Texinfo manual
* Add util functions for doing stuff like quoting CTCP messages
* Finish adding hooks/send hooks
* Add DCC_CHAT_END hook for Scheme
+* Commands::sendCTCP, Commands::sendCTCPReply
2.4:
* Use configuration database class
# username = <string>
username = lamerbot
+# Maximum nick length of the bot (default to 9)
+# maxnicklength = <positive integer>
+maxnicklength = 9
+
# IRCname of the bot (shown with /whois)
# ircname = <string>
ircname = Scheme Me!
unsigned int Bot::MAX_MESSAGES = 2;
+unsigned int Bot::MAX_NICKLENGTH = 9;
#define DEFAULT_NICKNAME "Bobot"
#define DEFAULT_USERNAME "bobot"
initFileName = parameters;
else if (command == "LOCALIP")
localIP = parameters;
+ else if (command == "MAXNICKLENGTH")
+ MAX_NICKLENGTH = std::atoi (parameters);
else if (command == "SERVER") {
if (parameters.indexOf(' ') == -1)
serverList->addServer(new Server(parameters));
unsigned long receivedUserhostID;
static unsigned int MAX_MESSAGES;
+ static unsigned int MAX_NICKLENGTH;
static const std::time_t NICK_CHANGE = 60;
static const std::time_t CHANNEL_JOIN = 60;
static const std::time_t IGNORE_DELAY = 180;
#include "Message.H"
#include "Commands.H"
#include "Utils.H"
+#include "StringTokenizer.H"
#define CHECK_CONNECTION if (!bot->serverConnection) return NotConnected
return EmptyMessage;
}
- 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'));
+ }
return Ok;
}
{
CHECK_CONNECTION;
- if (nick == "" || !Utils::valid_nickname_p(nick))
+ if (nick == "" || !Utils::valid_nickname_p(bot, nick))
return InvalidNick(nick);
bot->wantedNickName = nick;
if (message == "")
return EmptyMessage;
- 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'));
+ }
return Ok;
}
if (command == "PING")
cnx->queue->sendCTCPReply (nick, "PING", rest);
else if (command == "VERSION")
- cnx->queue->sendCTCPReply (nick, "VERSION", cnx->bot->versionString);
+ {
+ cnx->queue->sendCTCPReply (nick, "VERSION", cnx->bot->versionString);
+ }
else if (command == "CLOCK")
{
time_t diff = time (NULL) - cnx->bot->startTime;
VERIFY_STRING(message);
IQUEUE->sendCTCP (Utils::scm2str (to), Utils::scm2str (command),
- Utils::scm2str (message));
+ Utils::scm2str (message));
+
return SCM_UNSPECIFIED;
}
return;
}
- if (!Utils::valid_nickname_p(nick)) {
+ if (!Utils::valid_nickname_p (cnx->bot, nick)) {
from->sendNotice(String("\002") + nick +
" is not a valid nickname\002");
return;
String channel, String rest)
{
Message m = Commands::SetVersion(cnx->bot, rest);
+
if (m.getCode() < 0)
- from->sendNotice(m.getMessage());
+ {
+ Commands::Notice (cnx->bot, from->getNick (), m.getMessage());
+ }
}
void
#define isvalid(c) (((c) >= 'A' && (c) <= '~') || std::isdigit(c) || (c) == '-')
bool
-Utils::valid_nickname_p (std::string n)
+Utils::valid_nickname_p (const Bot *b, std::string n)
{
// FIXME: make max nick length configurable
- if (n[0] == '-' || std::isdigit(n[0]) || n.length() > 9)
+ if (n[0] == '-' || std::isdigit(n[0]) || n.length() > b->MAX_NICKLENGTH)
return false;
for (std::string::size_type i = 0; i < n.length(); i++)
bool channel_p (std::string);
bool wildcard_p (std::string);
bool valid_channel_name_p (std::string);
- bool valid_nickname_p (std::string);
+ bool valid_nickname_p (const Bot *, std::string);
bool IP_p (std::string);
std::string level2str (int);