2006-06-28 Clinton Ebadi <clinton@unknownlamer.org>
+ * Release: 2.2.2
+
+ * scripts/bobot-utils.scm (bot:match-not-channel): Removed space
+ in regex so it works on freenode again
+
+ * scripts/bobot-utils.scm (bot:sent-to-me?): Rewritten to call
+ bot:match-to-me when called and not when defined
+
+ * source/Bot.C (Bot): Added argument to Interp::Startup2
+
+ * source/Interp.C (Startup2): Made to take a Bot as argument to avoid
+ a segfault
+
+ * source/Bot.C (Bot): Create BotInterp before running
+ Interp::Startup2 ()
+
+ * Release: 2.2.1
+
* source/Bot.C (set_log_dir): Create directory if it doesn't exist
- (readConfig): Catch case of a line consisting of spaces and don't
- print and error message
+ (readConfig): Catch case of a line consisting of whitespace and
+ don't print an error message
2006-02-03 Clinton Ebadi <clinton@unknownlamer.org>
====== The News =====================================================
=====================================================================
+Version 2.2.2 (2006-06-28):
+- No longer segfaults when loading bobot-utils.scm
+- bot:match-to-me produces a valid regexp again
+
Version 2.2.1 (2006-06-28):
- If the log directory does not exist the bot creates it
- If there are lines with only whitespace on them in the config file
dnl Process this file with autoconf to produce a configure script.
AC_PRERQ(2.50)
-AC_INIT([Bobot++], [2.2.1], [clinton@unknownlamer.org], [bobotpp])
+AC_INIT([Bobot++], [2.2.2], [clinton@unknownlamer.org], [bobotpp])
AC_LANG([C++])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
;;; match-not-channel adds a prefix regex to your regex so it doesn't
;;; match the sender or channel in a PUBLIC message
(define-public (bot:match-not-channel regex)
- (string-append "^[[:graph:]]* [&#+!][^ ,\a]+ [[:graph:][:space:]]*"
+ (string-append "^[[:graph:]]*[&#+!][^ ,\a]+ [[:graph:][:space:]]*"
regex))
;;; match-to-me matches text that was addressed to the bot with a
;;; ':',',', or nothing after the bot name
+
+;(define-public (bot:match-to-me r) r)
(define-public (bot:match-to-me regex)
(string-append (bot:match-not-channel (bot:getnickname))
"[[:space:][:graph:]]*" regex))
-(define-public bot:sent-to-me?
+(define-public (bot:sent-to-me? message)
(let ((to-me (make-regexp (bot:match-to-me ""))))
- (lambda (message)
- (if (regexp-exec to-me message) #t #f))))
+ (if (regexp-exec to-me message) #t #f)))
;;;; string-utils
(define-public str-app string-append) ; shorter
std::srand (std::time (0)); // srand for bot-random
#ifdef USESCRIPTS
- Interp::Startup2 ();
botInterp = new BotInterp(this, logs_dir + scriptLogFileName);
+ Interp::Startup2 (this);
botInterp->LoadScript(autoexecFileName);
#endif
}
BotInterp::BotInterp(Bot *b, String fn)
: bot(b), counter(0)
{
- logPort = scm_open_file(Utils::str2scm (fn),
- Utils::str2scm ("a"));
+ logPort = scm_open_file (Utils::str2scm (fn),
+ Utils::str2scm ("a"));
+
scm_gc_protect_object(logPort);
}
}
-void Interp::Startup2 ()
+void Interp::Startup2 (Bot *b)
{
+ bot = b;
+
scm_c_call_with_current_module (bot_module,
interp_post_startup_helper,
bot_module);
#endif
public:
static void Startup();
- static void Startup2 ();
+ static void Startup2 (Bot *b);
static void Shutdown();
static void Execute(Bot *, String);
static void LoadScript(Bot *, String);