Only in bot_log2/: bot_log.js
diff -upr bot_log/bot_log.module bot_log2/bot_log.module
--- bot_log/bot_log.module	2010-10-21 07:51:36.000000000 -0500
+++ bot_log2/bot_log.module	2011-02-04 09:45:36.000000000 -0600
@@ -30,6 +30,13 @@ function bot_log_menu() {
     'page callback'     => 'bot_log_day',
     'title'             => 'Logs',
   );
+  $items['bot/log/ajax'] = array(
+    'access arguments'  => array('view bot logs'),
+    'description'       => "Grab new log messages to update log table with Ajax.",
+    'page callback'     => 'bot_log_ajax',
+    'title'             => 'Logs',
+    'type'              => MENU_CALLBACK,
+  );
   $items['admin/settings/bot/log'] = array(
     'access arguments'  => array('administer bot'),
     'description'       => 'Configure bot logging with these settings.',
@@ -237,6 +244,8 @@ function bot_log_day($channel = NULL, $d
 
   // there is a channel! and the user can view it! holy crap!
   if (isset($channel) && user_access("view bot logs: #$channel")) {
+    drupal_add_js(drupal_get_path('module', 'bot_log') . '/bot_log.js');
+    
     // all time calcs are in GMT.
     $day = $day ? $day : gmdate('Y-m-d');
     $day_start = strtotime("$day GMT");
@@ -256,6 +265,38 @@ function bot_log_day($channel = NULL, $d
 }
 
 /**
+ * Displays either an overview of all channels, or a specific channel's day.
+ *
+ * @param $channel
+ *   The channel (without the first #, since this commonly comes from URLs).
+ * @param $id
+ *   The last id in the log.
+ * @return $html
+ *   A themed log for display.
+ */
+function bot_log_ajax($channel = NULL, $id = NULL) {
+  $output = '';
+  
+  // there is a channel! and the user can view it! holy crap!
+  if (!is_null($channel) && user_access("view bot logs: #$channel")) {
+    drupal_add_js(drupal_get_path('module', 'bot_log') . '/bot_log.js');
+    
+    // see bot_log_irc_msg_quit() for why we use a regexp on channels for lookups.
+    $results = db_query("SELECT * FROM {bot_log} WHERE channel REGEXP '.*#%s( |$)' AND id > %d ORDER BY id ASC", $channel, $id);
+    $logs = array();
+    while ($result = db_fetch_array($results)) {
+      $logs[] = $result; 
+    }
+    $output .= theme('bot_log_day', $channel, gmdate('Y-m-d'), $logs, 'rows');
+    
+    print($output);
+    exit;
+  }
+
+  return $output;
+}
+
+/**
  * Themes the logs for a day.
  *
  * @param $channel
@@ -273,10 +314,12 @@ function theme_bot_log_day($channel, $da
   include_once("Net/SmartIRC/defines.php"); // type constants.
   $output = NULL;
 
-  if ($format == 'html') {
-    drupal_set_title(t('IRC log for @channel, @date (GMT)', array('@channel' => '#'. $channel, '@date' => $date)));
-    drupal_add_css(drupal_get_path('module', 'bot_log') .'/bot_log.css');
-    $output .= drupal_get_form('bot_log_filter_form', $channel, $date);
+  if ($format == 'html' || $format == 'rows') {
+    if ($format == 'html') {
+      drupal_set_title(t('IRC log for @channel, @date (GMT)', array('@channel' => '#'. $channel, '@date' => $date)));
+      drupal_add_css(drupal_get_path('module', 'bot_log') .'/bot_log.css');
+      $output .= drupal_get_form('bot_log_filter_form', $channel, $date);
+    }
     $rows = array(); // goodies sent to theme_table().
 
     foreach ($logs as $log) {
@@ -345,11 +388,16 @@ function theme_bot_log_day($channel, $da
       $last_class = $nick_class; // and this one too. MAN ALIVE.
     }
 
-    if (count($rows) == 0) { // so somewhere in my youth or childHOoOodd... i must have done somethinnNNgn good..>.>...
+    if ($format == 'html' && count($rows) == 0) { // so somewhere in my youth or childHOoOodd... i must have done somethinnNNgn good..>.>...
       $rows[] = array('class' => 'bot-log-none', 'data' => array(array('colspan' => 3, 'data' => t('No logs are available.'))));
     } // nothing comes from NOthiIIng. nothing ever coulLLLLdllLd! SOUND OF MUSIC RULEZZZZZ ALL TIME LOW-Z.
-
-    $output .= theme('table', array(t('Time'), t('Nick'), t('Message')), $rows, array('id' => 'bot-log-day'));
+    
+    if ($format == 'html') {
+      $output .= theme('table', array(t('Time'), t('Nick'), t('Message')), $rows, array('id' => 'bot-log-day'));
+    }
+    elseif ($format == 'rows') {
+      $output .= theme('table', array(t('Time'), t('Nick'), t('Message')), $rows);
+    }
   }
 
   return $output;
