+2003-04-09 Clinton Ebadi <clinton@unknownlamer.org>
+
+ * 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 <clinton@unknownlamer.org>
+
+ * configure.ac: Merged all AC_OUTPUTs at the end
+
2003-04-02 Clinton Ebadi <clinton@unknownlamer.org>
* scripts/bobot-utils.scm: Make exported symbols from
====== The News =====================================================
=====================================================================
+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)
+
Version 2.1.2: Llama
- match-to-me and match-not-channel are now bot:match-to-me and
-This is bobot++.info, produced by makeinfo version 4.1 from
+This is bobot++.info, produced by makeinfo version 4.3 from
bobot++.texinfo.
This file documents Bobot++ by Clinton Ebadi and Etienne Bernard
Configuration File Syntax
=========================
- Not here yet.
+* Menu:
+
+* bot.conf::
+
+\1f
+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
+<default-value>: description"
+
+ * NICKNAME <Bobot>: The nickname of the bot (NICK is an alias for
+ NICKNAME)
+
+ * USERNAME <bobot>: The IRC username of the bot
+
+ * CMDCHAR <!>: The character that prefixes commands given to the bot
+ (COMMAND is an alias for CMDCHAR)
+
+ * IRCNAME <I'm a bobot++!>: The IRC name (or 'real name') of the bot
+ (REALNAME is an alias for IRCNAME)
+
+ * USERLIST <bot.users>: Name of the file where the userlist is stored
+
+ * SHITLIST <bot.shit>: Name of the file where the shitlist is stored
+
+ * LOGFILE <$LOGDIR/bot.log>:
+
\1f
File: bobot++.info, Node: Configure File Placement, Prev: Configuration File Syntax, Up: Configuration
Node: Introduction\7f1246
Node: Configuration\7f1437
Node: Configuration File Syntax\7f1823
-Node: Configure File Placement\7f2025
-Node: Using the Bot\7f2499
-Node: User Levels\7f2673
-Node: Scripting\7f3677
-Node: Adding New Commands\7f4585
-Node: Hooks\7f5852
-Node: Creating a Hook\7f6826
-Node: Hook Types\7f7965
-Node: Scheme User Levels\7f11439
-Node: Sending Messages\7f12568
-Node: High Level Message Functions\7f13179
-Node: Low Level Message Functions\7f13393
-Node: Misc Scripting Stuff\7f14146
-Node: Concept Index\7f14565
-Node: Function Index\7f14747
-Node: Variable Index\7f15008
+Node: bot.conf\7f2030
+Node: Configure File Placement\7f2865
+Node: Using the Bot\7f3339
+Node: User Levels\7f3513
+Node: Scripting\7f4517
+Node: Adding New Commands\7f5425
+Node: Hooks\7f6692
+Node: Creating a Hook\7f7666
+Node: Hook Types\7f8805
+Node: Scheme User Levels\7f12279
+Node: Sending Messages\7f13408
+Node: High Level Message Functions\7f14019
+Node: Low Level Message Functions\7f14233
+Node: Misc Scripting Stuff\7f14986
+Node: Concept Index\7f15405
+Node: Function Index\7f15587
+Node: Variable Index\7f15848
\1f
End Tag Table
@node Configuration File Syntax, Configure File Placement, Configuration, Configuration
@section Configuration File Syntax
-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}
+<default-value>: description''
+
+@itemize @bullet
+
+@item @var{nickname} <Bobot>: The nickname of the bot (@var{nick} is an
+alias for @var{nickname})
+@item @var{username} <bobot>: 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} <I'm a bobot++!>: The IRC name (or 'real name') of
+the bot (@var{realname} is an alias for @var{ircname})
+@item @var{userlist} <bot.users>: Name of the file where the userlist is
+stored
+@item @var{shitlist} <bot.shit>: Name of the file where the shitlist is
+stored
+@item @var{logfile} <$LOGDIR/bot.log>:
+
+@end itemize
@node Configure File Placement, , Configuration File Syntax, Configuration
@section Configuration File Placement
dnl Process this file with autoconf to produce a configure script.
AC_PRERQ(2.50)
dnl AC_INIT(source/Makefile.in)
-AC_INIT([Bobot++], [2.1.2CVS], [clinton@unknownlamer.org], [bobotpp])
+AC_INIT([Bobot++], [2.1.3CVS], [clinton@unknownlamer.org], [bobotpp])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
fi
dnl Generates the makefiles
-AC_OUTPUT(source/Makefile)
-AC_OUTPUT(scripts/Makefile)
-AC_OUTPUT(Makefile)
+AC_OUTPUT(source/Makefile scripts/Makefile Makefile)
#include "UserCommands.H"
#include "DCCManager.H"
+
+unsigned int Bot::MAX_MESSAGES = 2;
+
#define DEFAULT_NICKNAME "Bobot"
#define DEFAULT_USERNAME "bobot"
#define DEFAULT_IRCNAME "I'm a bobot++!"
}
#ifdef USESCRIPTS
botInterp->RunTimers(currentTime);
-#endif
-#ifdef USESCRIPTS
tm *thisTime = localtime(¤tTime);
- 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));
+ }
#endif
}
userFunctions["SERVER"] = uf (UserCommands::Server, User::FRIEND, false);
userFunctions["SERVERLIST"] =
uf (UserCommands::ServerList, User::FRIEND, false);
+ userFunctions["SETFLOODRATE"] =
+ uf (UserCommands::SetFloodRate, User::MASTER, false);
userFunctions["SETVERSION"] =
uf (UserCommands::SetVersion, User::MASTER, false);
userFunctions["SHITLIST"] =
unsigned long sentUserhostID;
unsigned long receivedUserhostID;
- static const unsigned int MAX_MESSAGES = 2;
+ static unsigned int MAX_MESSAGES;
static const std::time_t NICK_CHANGE = 60;
static const std::time_t CHANNEL_JOIN = 60;
static const std::time_t IGNORE_DELAY = 180;
return Ok;
}
+Message
+Commands::SetFloodRate(Bot *bot, unsigned int num_messages)
+{
+ if (num_messages > 0)
+ {
+ bot->MAX_MESSAGES = num_messages;
+ return Ok;
+ }
+ return InvalidParameters;
+}
+
Message
Commands::SetVersion(Bot *bot, String str)
{
static Message Say(Bot *, String, String);
static Message Server(Bot *, int);
static Message SetVersion(Bot *, String);
+ static Message SetFloodRate(Bot*, unsigned int);
static Message TBan(Bot *, String, String, int);
static Message TKBan(Bot *, String, String, int, String);
static Message Topic(Bot *, String, String);
0, 0, 0);
bot_new_procedure ("bot:say", (SCMFunc)ScriptCommands::Say, 2, 0, 0);
bot_new_procedure ("bot:server", (SCMFunc)ScriptCommands::Server, 1, 0, 0);
+ scm_c_define_gsubr ("bot:setfloodrate", 1, 0, 0,
+ (SCMFunc)ScriptCommands::SetFloodRate);
bot_new_procedure ("bot:setversion", (SCMFunc)ScriptCommands::SetVersion,
1, 0, 0);
bot_new_procedure ("bot:tban", (SCMFunc)ScriptCommands::TBan, 3, 0, 0);
return scm_long2num(m.getCode());
}
+SCM
+ScriptCommands::SetFloodRate(SCM rate)
+{
+ VERIFY_NUMBER(rate);
+ Message m = Commands::SetFloodRate(Interp::bot, scm_num2uint
+ (rate, 0, "SetFloodRate"));
+ return scm_long2num(m.getCode());
+}
+
SCM
ScriptCommands::SetVersion(SCM version)
{
static SCM Reconnect(void);
static SCM Say(SCM, SCM);
static SCM Server(SCM); // ACK NAMING CLASH
+ static SCM SetFloodRate(SCM);
static SCM SetVersion(SCM);
static SCM TBan(SCM, SCM, SCM);
static SCM TKBan(SCM, SCM, SCM, SCM);
#include <arpa/inet.h>
#include <netdb.h>
#include <ctype.h>
+#include <cstdlib>
#ifndef _X_OPEN_SOURCE
#define _X_OPEN_SOURCE
#endif
from->sendNotice("\002End of server list.\002");
}
+
+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)));
+}
+
void
UserCommands::SetVersion(ServerConnection *cnx, Person *from,
String channel, String rest)
static void Say(ServerConnection *, Person *, String, String);
static void Server(ServerConnection *, Person *, String, String);
static void ServerList(ServerConnection *, Person *, String, String);
+ static void SetFloodRate(ServerConnection *, Person *, String, String);
static void SetVersion(ServerConnection *, Person *, String, String);
static void ShitList(ServerConnection *, Person *, String, String);
static void SpyList(ServerConnection *, Person *, String, String);