Hopefully made MySQL reconnection possible
authorDan
Wed, 07 May 2008 23:33:36 -0400
changeset 3 02e1c3f8f0ef
parent 2 c474904ed707
child 4 8f62a406d9d9
Hopefully made MySQL reconnection possible
enanobot.php
--- a/enanobot.php	Sat Mar 15 20:45:32 2008 -0400
+++ b/enanobot.php	Wed May 07 23:33:36 2008 -0400
@@ -39,12 +39,12 @@
     if ( !$q )
     {
       $m_e = mysql_error();
-      $m_et = true;
-      if ( $m_e == 'MySQL server has gone away' && !$m_et )
+      if ( strpos($m_e, 'gone away') && !$m_et )
       {
         mysql_reconnect();
         continue;
       }
+      $m_et = true;
       $irc->close("MySQL query error: $m_e");
       exit(1);
     }
@@ -192,8 +192,11 @@
   switch($message['action'])
   {
     case 'PRIVMSG':
-      $sql = "INSERT INTO irclog(channel, day, nick, timestamp, line) VALUES
-                ( '$chan_db', '$day', '$nick_db', '$time', '$line_db' );";
+      if ( substr($line_db, 0, 5) != '[off]' )
+      {
+        $sql = "INSERT INTO irclog(channel, day, nick, timestamp, line) VALUES
+                  ( '$chan_db', '$day', '$nick_db', '$time', '$line_db' );";
+      }
       break;
     case 'JOIN':
       $sql = "INSERT INTO irclog(channel, day, nick, timestamp, line) VALUES