[project @ 2006-06-29 00:17:49 by unknown_lamer]
authorunknown_lamer <unknown>
Thu, 29 Jun 2006 00:17:49 +0000 (00:17 +0000)
committerunknown_lamer <unknown>
Thu, 29 Jun 2006 00:17:49 +0000 (00:17 +0000)
- No longer segfaults when loading bobot-utils.scm
- bot:match-to-me produces a valid regexp again

ChangeLog
NEWS
configure.ac
scripts/bobot-utils.scm
source/Bot.C
source/BotInterp.C
source/Interp.C
source/Interp.H

index 5d9c8ce..34457b1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,26 @@
 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>
 
diff --git a/NEWS b/NEWS
index 4166f92..19a40f9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,10 @@ IMPORTANT NOTES:
 ====== 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
index 8aaab6a..701b02e 100644 (file)
@@ -1,7 +1,7 @@
 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)
index 916a76e..ec1e93f 100644 (file)
 ;;; 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
index 9617219..25e2f92 100644 (file)
@@ -161,8 +161,8 @@ Bot::Bot(String filename, bool debug_on)
   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
 }
index e020cfd..5f2d5b3 100644 (file)
@@ -36,8 +36,9 @@ extern "C"
 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);
 }
 
index da171f9..70ae595 100644 (file)
@@ -295,8 +295,10 @@ Interp::Startup()
 
 }
 
-void Interp::Startup2 ()
+void Interp::Startup2 (Bot *b)
 {
+  bot = b;
+
   scm_c_call_with_current_module (bot_module,
                                  interp_post_startup_helper,
                                  bot_module);
index 57b5a97..d99f445 100644 (file)
@@ -49,7 +49,7 @@ private:
 #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);