Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bot_actions/README.txt,v
retrieving revision 1.2
diff -u -r1.2 README.txt
--- README.txt	24 Sep 2008 04:40:50 -0000	1.2
+++ README.txt	29 Nov 2010 03:18:20 -0000
@@ -1,11 +1,9 @@
 $Id: README.txt,v 1.2 2008/09/24 04:40:50 t0talmeltd0wn Exp $
 
-This module provides an IRC action to Drupal's core. Requires Token and Bot
-modules.
+This module provides an IRC action to Drupal's core. Requires Bot module.
 
-NOTE: Installation currently requires a patched version of the Bot module.
-Until the patch is applied to Bot's HEAD, please refer to the Bot Actions
-project page on drupal.org for details on patching Bot.
+The module integrates the action configuration form with token module if this
+one is enabled.
 
 Written and maintained by:
 Sean Edwards
Index: bot_actions.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bot_actions/bot_actions.info,v
retrieving revision 1.1
diff -u -r1.1 bot_actions.info
--- bot_actions.info	24 Sep 2008 04:30:07 -0000	1.1
+++ bot_actions.info	29 Nov 2010 03:17:37 -0000
@@ -5,5 +5,4 @@
 package = Bot
 
 dependencies[] = bot
-dependencies[] = token
 
Index: bot_actions.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bot_actions/bot_actions.module,v
retrieving revision 1.2
diff -u -r1.2 bot_actions.module
--- bot_actions.module	24 Sep 2008 04:40:50 -0000	1.2
+++ bot_actions.module	29 Nov 2010 03:17:23 -0000
@@ -21,17 +21,12 @@
  * Action callback for sending a message via IRC bot.
  */
 function bot_actions_send_message_action(&$object, $context) {
-  if (!function_exists('bot_action_queue') || !function_exists('bot_message_queue')) {
-    watchdog('Bot', 'You are running an unpatched copy of the Bot module. Bot actions are not available.', array(), WATCHDOG_WARNING);
-  }
+  $message = array(
+    'recipient' => $context['to'],
+    'message'   => function_exists('token_replace_multiple') ? token_replace_multiple($context['message'], $context) : $context['message'],
+  );
 
-  $msg = token_replace_multiple($context['message'], $context);
-  $to = $context['to'];
-  if (substr($msg, 0, 4) == '/me ') {
-    bot_action_queue($to, substr($msg, 4));
-  } else {
-    bot_message_queue($to, $msg);
-  }
+  bot_actions_message_queue($message);
 }
 
 /**
@@ -54,16 +49,18 @@
     '#default_value' => isset($context['message']) ? $context['message'] : 'Something has happened!',
   );
 
-  $form['help'] = array(
-    '#type' => 'fieldset',
-    '#collapsible' => FALSE,
-    '#title' => t('Placeholder tokens'),
-    '#description' => t('The following placeholder tokens can be used in the command. Some tokens may not be available, depending on the context in which the action is triggered.'),
-  );
-
-  $form['help']['tokens'] = array(
-    '#value' => theme('token_help', 'all'),
-  );
+  if (function_exists('token_replace_multiple')) {
+    $form['help'] = array(
+      '#type' => 'fieldset',
+      '#collapsible' => FALSE,
+      '#title' => t('Placeholder tokens'),
+      '#description' => t('The following placeholder tokens can be used in the command. Some tokens may not be available, depending on the context in which the action is triggered.'),
+    );
+
+    $form['help']['tokens'] = array(
+      '#value' => theme('token_help', 'all'),
+    );
+  }
 
   return $form;
 }
@@ -78,3 +75,38 @@
   );
 }
 
+/**
+ * Store a message in the database to be processed by the bot module.
+ *
+ * @param array $message
+ *  Message array with 'recipient' and 'message' attributes.
+ */
+function bot_actions_message_queue($message) {
+  $message += array(
+    'timestamp' => time(),
+  );
+
+  drupal_write_record("bot_actions_message", $message);
+}
+
+/**
+ * Implementation of hook_irc_bot_cron_fastest().
+ */
+function bot_actions_irc_bot_cron_fastest() {
+
+  // every 15 seconds, we'll display a maximum of three messages.
+  $results = db_query_range('SELECT * FROM {bot_actions_message} ORDER BY qid ASC', 0, 3);
+
+  while ($result = db_fetch_object($results)) {
+    if (substr($result->message, 0, 4) == '/me ') {
+      bot_action($result->recipient, substr($result->message, 4));
+    }
+    else {
+      bot_message($result->recipient, $result->message);
+    }
+
+    // Regardless the processing, remove the entry.
+    db_query("DELETE FROM {bot_actions_message} WHERE qid = %d", $result->qid);
+  }
+
+}
--- bot_actions.install
+++ bot_actions.install
@@ -0,0 +1,62 @@
+<?php
+// $Id$
+
+/**
+ * @file Install/uninstall functions for the bot_actions module.
+ */
+
+/**
+ * Implementation of hook_install().
+ */
+function bot_actions_install() {
+  drupal_install_schema('bot_actions');
+}
+
+/**
+ * Implementation of hook_schema().
+ */
+function bot_actions_schema() {
+  $schema = array();
+
+  $schema['bot_actions_message'] = array(
+    'description' => 'Store messages for the bot to process.',
+    'fields' => array(
+      'qid' => array(
+        'description' => "Unique message ID.",
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ),
+      'recipient' => array(
+        'description' => 'The IRC nick or channel this entry is addressed to.',
+        'type' => 'varchar',
+        'length' => 60,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'message' => array(
+        'description' => 'The string of the message.',
+        'type' => 'text',
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'timestamp' => array(
+        'description' => 'At what time this message was created.',
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'primary key' => array('qid'),
+  );
+
+  return $schema;
+}
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function bot_actions_uninstall() {
+  drupal_uninstall_schema('bot_actions');
+}


