[[project @ 2003-04-10 01:53:57 by unknown_lamer] unknown_lamer**20030410015357 Added support for overriding the flood rate ] { hunk ./ChangeLog 1 +2003-04-09 Clinton Ebadi + + * source/Interp.C (interp_init_helper): Bind bot:setfloodrate to + ScriptCmmands::SetFloodRate + + * source/ScriptCommands.C (SetFloodRate): New Method: SetFloodRate + + * source/Bot.C (init_user_functions): Make SETFLOODRATE available + to bot master + + * source/Bot.H: Made MAX_MESSAGES writeable + + * source/UserCommands.H: New method: SetFloodRate + + * source/Commands.H: New method: SetFloodRate + +2003-04-03 Clinton Ebadi + + * configure.ac: Merged all AC_OUTPUTs at the end + hunk ./NEWS 12 + +Version 2.1.3: Something +- The flood rate can now be set using !setfloodrate INTEGER. The +default is two messages per second before the bot will ignore +you. (thanks to Björn Gustavsson for requesting this) +- The flood rate may also be set from Scheme using (bot:setfloodrate integer) hunk ./bobot++.info 1 -This is bobot++.info, produced by makeinfo version 4.1 from +This is bobot++.info, produced by makeinfo version 4.3 from hunk ./bobot++.info 71 - Not here yet. +* Menu: + +* bot.conf:: + + +File: bobot++.info, Node: bot.conf, Prev: Configuration File Syntax, Up: Configuration File Syntax + +bot.conf +-------- + + bot.conf is the main configuration file for a Bobot++. The available +configuration variables are listed below in the format "VARIABLE +: description" + + * NICKNAME : The nickname of the bot (NICK is an alias for + NICKNAME) + + * USERNAME : The IRC username of the bot + + * CMDCHAR : The character that prefixes commands given to the bot + (COMMAND is an alias for CMDCHAR) + + * IRCNAME : The IRC name (or 'real name') of the bot + (REALNAME is an alias for IRCNAME) + + * USERLIST : Name of the file where the userlist is stored + + * SHITLIST : Name of the file where the shitlist is stored + + * LOGFILE <$LOGDIR/bot.log>: + hunk ./bobot++.info 557 -Node: Configure File Placement2025 -Node: Using the Bot2499 -Node: User Levels2673 -Node: Scripting3677 -Node: Adding New Commands4585 -Node: Hooks5852 -Node: Creating a Hook6826 -Node: Hook Types7965 -Node: Scheme User Levels11439 -Node: Sending Messages12568 -Node: High Level Message Functions13179 -Node: Low Level Message Functions13393 -Node: Misc Scripting Stuff14146 -Node: Concept Index14565 -Node: Function Index14747 -Node: Variable Index15008 +Node: bot.conf2030 +Node: Configure File Placement2865 +Node: Using the Bot3339 +Node: User Levels3513 +Node: Scripting4517 +Node: Adding New Commands5425 +Node: Hooks6692 +Node: Creating a Hook7666 +Node: Hook Types8805 +Node: Scheme User Levels12279 +Node: Sending Messages13408 +Node: High Level Message Functions14019 +Node: Low Level Message Functions14233 +Node: Misc Scripting Stuff14986 +Node: Concept Index15405 +Node: Function Index15587 +Node: Variable Index15848 hunk ./bobot++.texinfo 88 -Not here yet. +@menu +* bot.conf:: +@end menu + +@node bot.conf, , Configuration File Syntax, Configuration File Syntax +@subsection bot.conf + +bot.conf is the main configuration file for a Bobot++. The available +configuration variables are listed below in the format ``@var{variable} +: description'' + +@itemize @bullet + +@item @var{nickname} : The nickname of the bot (@var{nick} is an +alias for @var{nickname}) +@item @var{username} : The IRC username of the bot +@item @var{cmdchar} : The character that prefixes commands given to +the bot (@var{command} is an alias for @var{cmdchar}) +@item @var{ircname} : The IRC name (or 'real name') of +the bot (@var{realname} is an alias for @var{ircname}) +@item @var{userlist} : Name of the file where the userlist is +stored +@item @var{shitlist} : Name of the file where the shitlist is +stored +@item @var{logfile} <$LOGDIR/bot.log>: + +@end itemize hunk ./configure.ac 4 -AC_INIT([Bobot++], [2.1.2CVS], [clinton@unknownlamer.org], [bobotpp]) +AC_INIT([Bobot++], [2.1.3CVS], [clinton@unknownlamer.org], [bobotpp]) hunk ./configure.ac 86 -AC_OUTPUT(source/Makefile) -AC_OUTPUT(scripts/Makefile) -AC_OUTPUT(Makefile) +AC_OUTPUT(source/Makefile scripts/Makefile Makefile) hunk ./source/Bot.C 37 + +unsigned int Bot::MAX_MESSAGES = 2; + hunk ./source/Bot.C 391 -#endif hunk ./source/Bot.C 392 -#ifdef USESCRIPTS hunk ./source/Bot.C 393 - if (thisTime->tm_sec == 0) { - char s[6]; - std::sprintf(s, "%2d:%2d", thisTime->tm_hour, thisTime->tm_min); - botInterp->RunHooks(Hook::TIMER, String(s), - gh_list(Utils::string2SCM(String(s)), - SCM_UNDEFINED)); - } + if (thisTime->tm_sec == 0) + { + char s[6]; + std::sprintf(s, "%2d:%2d", thisTime->tm_hour, thisTime->tm_min); + botInterp->RunHooks(Hook::TIMER, String(s), + gh_list(Utils::string2SCM(String(s)), + SCM_UNDEFINED)); + } hunk ./source/Bot.C 649 + userFunctions["SETFLOODRATE"] = + uf (UserCommands::SetFloodRate, User::MASTER, false); hunk ./source/Bot.H 109 - static const unsigned int MAX_MESSAGES = 2; + static unsigned int MAX_MESSAGES; hunk ./source/Commands.C 652 +Message +Commands::SetFloodRate(Bot *bot, unsigned int num_messages) +{ + if (num_messages > 0) + { + bot->MAX_MESSAGES = num_messages; + return Ok; + } + return InvalidParameters; +} + hunk ./source/Commands.H 64 + static Message SetFloodRate(Bot*, unsigned int); hunk ./source/Interp.C 148 + scm_c_define_gsubr ("bot:setfloodrate", 1, 0, 0, + (SCMFunc)ScriptCommands::SetFloodRate); hunk ./source/ScriptCommands.C 378 +SCM +ScriptCommands::SetFloodRate(SCM rate) +{ + VERIFY_NUMBER(rate); + Message m = Commands::SetFloodRate(Interp::bot, scm_num2uint + (rate, 0, "SetFloodRate")); + return scm_long2num(m.getCode()); +} + hunk ./source/ScriptCommands.H 63 + static SCM SetFloodRate(SCM); hunk ./source/UserCommands.C 31 +#include hunk ./source/UserCommands.C 1170 + + +void +UserCommands::SetFloodRate(ServerConnection *cnx, Person *from, + String channel, String rest) +{ + Message m = Commands::SetFloodRate (cnx->bot, std::atoi (rest)); + if (m.getCode ()) + from->sendNotice (m.getMessage ()); + else + from->sendNotice ("Flood Rate set to:" + String(std::atol(rest))); +} hunk ./source/UserCommands.H 79 + static void SetFloodRate(ServerConnection *, Person *, String, String); }