Fixed: echo module was echoing back commands
authorDan
Sat, 03 Jan 2009 17:09:16 -0500
changeset 41 1d854f22ac5a
parent 40 1855846cbdab
child 42 c24a2311f232
Fixed: echo module was echoing back commands
enanobot.php
modules/echo.php
--- a/enanobot.php	Thu Jan 01 00:18:34 2009 -0500
+++ b/enanobot.php	Sat Jan 03 17:09:16 2009 -0500
@@ -180,7 +180,7 @@
   else if ( in_array($message['nick'], $privileged_list) && preg_match('/^Shutdown(?: (.+))?$/i', $message['message'], $match) && $message['action'] == 'PRIVMSG' )
   {
     $GLOBALS['_shutdown'] = true;
-    $quitmessage = empty($match[1]) ? "Remote bot shutdown ordered by {$message['nick']}" : $match[1];
+    $quitmessage = empty($match[1]) ? "Remote bot shutdown requested by {$message['nick']}" : $match[1];
     $irc->close($quitmessage, true);
     return 'BREAK';
   }
--- a/modules/echo.php	Thu Jan 01 00:18:34 2009 -0500
+++ b/modules/echo.php	Sat Jan 03 17:09:16 2009 -0500
@@ -17,13 +17,14 @@
 {
   global $privileged_list;
   
-  if ( in_array($message['nick'], $privileged_list) && preg_match("/^(?:\!echo-|\/msg )([^\007, \r\n\a\t]+) /", $message['message'], $match) )
+  if ( in_array($message['nick'], $privileged_list) && preg_match("/^(?:\!echo-|\/msg )([^\007, \r\n\a\t]+) (.+)/", $message['message'], $match) )
   {
     global $libirc_channels;
     $channel_name =& $match[1];
     if ( isset($libirc_channels[$channel_name]) && is_object($libirc_channels[$channel_name]) )
     {
-      $libirc_channels[$channel_name]->msg(eb_censor_words(preg_replace("/^(?:\!echo-|\/msg )((?:#|&)[^\007, \r\n\a\t]+) /", '', $message['message'])), true);
+      echo "!!! {$match[2]}\n";
+      $libirc_channels[$channel_name]->msg(eb_censor_words($match[2]), true);
     }
   }
   else if ( in_array($message['nick'], $privileged_list) && preg_match("/^(?:\!pm|\/msg) ([^\007, \r\n\a\t]+) (.+)/", $message['message'], $match) )