Current Maintainer (1.98 and above):
Clinton Ebadi <clinton@unknownlamer.org>
-unknown_lamer on OpenProjects
\ No newline at end of file
+unknown_lamer on OpenProjects and OFTC
+2002-07-23 Clinton Ebadi <clinton@unknownlamer.org>
+
+ * source/BotInterp.H (Hook<): Changed behavior of Hook's <. If a
+ hook is greater than or less than the other hook, only the
+ priority is considered. However, if both hooks have the same
+ priority, then the fallthru-ness is considered, with fallthru
+ hooks being greater than non-fallthru hooks.
+
+ * source/BotInterp.C (hptr_lt): Added this static function to be
+ used to sort the hooks list (now hooks should be sorted using
+ Hook's operator < instead of using pointer comparision, meaning
+ the new hook system will work correctly)
+
+ * scripts/bobot-utils.scm: Make bot:log use for-each instead of
+ map because we don't need the result of the displays (this would
+ just be a list of #<undefined> values and is a waste of memory).
+
2002-07-13 Clinton Ebadi <clinton@unknownlamer.org>
* source/Bot.C (Bot): userFunctions is now a map for efficiency
--*- text -*-
-As of version 1.98 unknown_lamer is the new maintainer.
-Also as of version 1.98, you must have Guile 1.5.6+ or 1.6.x in order
-to compile scripting support.
+======================================================================
+====== This is a -*- text -*- file and ===============================
+====== User Visible Changes In Bobot++ ===============================
+======================================================================
+
+IMPORTANT NOTE:
++====================================================================+
+| As of version 1.98 unknown_lamer is the new maintainer. |
+| Also as of version 1.98, you must have Guile 1.5.6+ or 1.6.x in |
+| order to compile scripting support. |
++====================================================================+
+
+=====================================================================
+====== The News =====================================================
+=====================================================================
Version 2.1.0: Zug Zug
- Hooks can now be fallthrough or non fallthrough. You can set a hooks
- Access to repl will require user to authenticate
- Allow server to be disabled at run because of security...
* Fix DCC support
-* Add Channel logging (log full text of channel if enabled)
- - maybe do this as a script (log.scm)
+ - Note that Socket will have a buffer overflow problem with DCC
+ because it uses a buffer of 512 characters, and a DCC line is not
+ limited to 512 chars like an IRC line is. The question is: should
+ I rewrite readLine to be more general (allocate buffer on the
+ fly) or rename readLine to ircReadLine and add a more general
+ readLine? I think I could use a static std::string and have it
+ grow as needed, with a default size of 512.
+* Add Channel logging (log full text of channel if enabled) script
* Make connecting to irc.oftc.net work...I wonder if their ircd is b0rked
-Config: (maybe)
-* Change bot.conf syntax (just load it with guile)
-(set-cmdchar #\!)
-(set-name "DumbBot")
-(set-userlist "bot.users")
-(set-shitlist "bot.shit")
-(set-logfile "bot.log")
-
-(add-server "irc.openprojects.net")
-(add-server "trollaxor.com")
-
-(add-channel "#bobot") ; all networks
-
-;;; note that (add-server) would be a macro that defines
-;;; a symbol for the network
-(server-add-channel irc.openprojects.net "#umbclinux:::")
-(server-add-channel irc.openprojects.net "#tpu:::")
-;;; add-channels just maps args to server-add-channel
-(server-add-channels trollaxor.com "#trolls:::" "#crapflooders:::")
-(server-set-name trollaxor.com "TrollBot")
-
- - Support per-server channels, logfiles, cmdchars, everything...
-
Documentation:
-- Work on Texinfo manual (including scripting section)
+* Work on Texinfo manual (especially scripting section)
Other (post 2.2 release):
* Remove gh_* when Guile 1.8 is released
\ No newline at end of file
that Bobot++ can recieve. A Hook also has several properties, including
its priority and whether or not it is a fallthrough hook. Higher
priority hooks are executed before lower priority hooks and fallthrough
-hooks are executed before non-fallthrough hooks. A fallthrough hook can
-match and processing of hooks will continue; as soon as the first
-non-fallthrough hooks matches processing of hooks stops.
+hooks are executed before non-fallthrough hooks of the same priority. A
+fallthrough hook can match and processing of hooks will continue; as
+soon as the first non-fallthrough hooks matches processing of hooks
+stops.
* Menu:
Node: Scripting\7f3677
Node: Adding New Commands\7f4560
Node: Hooks\7f5803
-Node: Creating a Hook\7f6720
-Node: Hook Types\7f7512
-Node: Scheme User Levels\7f9985
-Node: Sending Messages\7f11114
-Node: High Level Message Functions\7f11682
-Node: Low Level Message Functions\7f11900
-Node: Concept Index\7f12659
-Node: Function Index\7f12841
-Node: Variable Index\7f13102
+Node: Creating a Hook\7f6741
+Node: Hook Types\7f7533
+Node: Scheme User Levels\7f10006
+Node: Sending Messages\7f11135
+Node: High Level Message Functions\7f11703
+Node: Low Level Message Functions\7f11921
+Node: Concept Index\7f12680
+Node: Function Index\7f12862
+Node: Variable Index\7f13123
\1f
End Tag Table
that Bobot++ can recieve. A Hook also has several properties,
including its priority and whether or not it is a fallthrough
hook. Higher priority hooks are executed before lower priority hooks
-and fallthrough hooks are executed before non-fallthrough hooks. A
-fallthrough hook can match and processing of hooks will continue; as
-soon as the first non-fallthrough hooks matches processing of hooks
-stops.
+and fallthrough hooks are executed before non-fallthrough hooks of the
+same priority. A fallthrough hook can match and processing of hooks
+will continue; as soon as the first non-fallthrough hooks matches
+processing of hooks stops.
@menu
* Creating a Hook::
;;; Why the GPL? Technically anything that uses Bobot++'s functions
;;; must be GPLed, so all of your scripts have to be GPLed anyway
-;;; because you are really linking with Bobot++, a GPLed program!
+;;; because you are really linking with Bobot++, a GPLed program.
;;; Bot load (loads a file from %bot:loadpath)
;;; arg is a thunk it will be executed and it's output will be
;;; written to the log
(define (bot:log . messages)
- (map
+ (for-each
(lambda (x)
(if (thunk? x)
(display (x) (bot-logport))
init_user_functions ();
-#if HAVE_IOSBASE
- logFile.open(logs_dir + logFileName, std::ios_base::out |
- std::ios_base::ate | std::ios_base::app);
-#else
- logFile.open(logs_dir + logFileName, ios::out | ios::ate
- | ios::app);
-#endif
- logLine("Starting log.");
+ set_log_dir (logs_dir);
+ set_log_file (logFileName);
+
+
channelList = new ChannelList();
serverList = new ServerList();
readConfig();
}
}
else if (command == "LOGFILE")
- logFileName = parameters;
+ {
+ if (parameters[0] == '/')
+ {
+ set_log_dir ("/");
+ set_log_file (parameters.subString (1));
+ }
+ else
+ set_log_file (parameters);
+ }
#ifdef USESCRIPTS
else if (command == "SCRIPTLOGFILE")
scriptLogFileName = parameters;
userFunctions.erase (userFunctions.begin (),
userFunctions.end ());
}
+
+void
+Bot::set_log_file (String name)
+{
+ logFileName = name;
+#if HAVE_IOSBASE
+ logFile.open(logs_dir + logFileName, std::ios_base::out |
+ std::ios_base::ate | std::ios_base::app);
+#else
+ logFile.open(logs_dir + logFileName, ios::out | ios::ate
+ | ios::app);
+#endif
+
+ logLine("Starting log.");
+}
+
+void
+Bot::set_log_dir (String dir)
+{
+ logs_dir = dir;
+}
void reconnect();
+ // getters and setters
+ void set_log_dir (String);
+ void set_log_file (String);
friend class Parser;
friend class DCCParser;
scm_flush(logPort);
}
+namespace
+{
+ bool hptr_lt (const Hook* h, const Hook* h1)
+ // Hook Pointer less than
+ // Used to sort the Hooks list
+ { return *h < *h1; }
+}
+
bool
BotInterp::AddHook(int hooktype, SCM regex, SCM function, int pri, bool fall) {
if (scm_string_p(regex) == SCM_BOOL_F)
// First, we check if an hook doesn't exist yet
std::list<Hook *>::iterator it = hooksMap[hooktype].begin();
std::list<Hook *>::iterator it2 = hooksMap[hooktype].end();
+
for ( ; it != it2; ++it)
// It exists, we replace it.
if ((*it)->regex_str == rx) {
(*it)->function = function;
(*it)->priority = pri;
(*it)->fallthru = fall;
- hooksMap[hooktype].sort ();
+ hooksMap[hooktype].sort (hptr_lt);
return true;
}
// It does not exist, we create it
hooksMap[hooktype].push_back (new Hook(hooktype, rx, r,
function, pri, fall));
- hooksMap[hooktype].sort ();
+ hooksMap[hooktype].sort (hptr_lt);
return true;
}
bool operator< (const Hook &h) const
{
- if (fallthru && h.fallthru)
- return priority < h.priority;
- // fallthru-thru is > non-fallthru thru ALWAYS
+ if (priority < h.priority)
+ return true;
+ else if (priority > h.priority)
+ return false;
+ else if (fallthru && h.fallthru)
+ return false;
else if (fallthru && !h.fallthru)
return false;
else if (!fallthru && h.fallthru)
return true;
- else
- return priority < h.priority;
}
enum {