/[drupal]/contributions/modules/bot/bot.module
ViewVC logotype

Diff of /contributions/modules/bot/bot.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.9.2.9.2.3 by morbus, Wed Apr 9 01:02:02 2008 UTC revision 1.9.2.9.2.4 by morbus, Fri Apr 25 01:29:02 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: bot.module,v 1.9.2.9.2.2 2008/04/09 00:50:39 morbus Exp $  // $Id: bot.module,v 1.9.2.9.2.3 2008/04/09 01:02:02 morbus Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 28  function bot_perm() { Line 28  function bot_perm() {
28  /**  /**
29   * Implementation of hook_menu().   * Implementation of hook_menu().
30   */   */
31  function bot_menu($may_cache) {  function bot_menu() {
32    $items['bot'] = array(    $items['bot'] = array(
33      'access arguments'  => array('access content'),      'access arguments'  => array('access content'),
34      'description'       => "View the bot's enabled features and settings.",      'description'       => "View the bot's enabled features and settings.",
# Line 74  function bot_irc_msg_channel($data, $fro Line 74  function bot_irc_msg_channel($data, $fro
74    // our IRC help interface which piggybacks off of Drupal's hook_help().    // our IRC help interface which piggybacks off of Drupal's hook_help().
75    if (preg_match("/^($addressed)help\s*([^\?]*)\s*\??/i", $data->message, $help_matches)) {    if (preg_match("/^($addressed)help\s*([^\?]*)\s*\??/i", $data->message, $help_matches)) {
76      if (!$help_matches[2]) { // no specific help was asked for so give 'em a list.      if (!$help_matches[2]) { // no specific help was asked for so give 'em a list.
77        $irc_features = module_invoke_all('help', 'irc:features');        $irc_features = module_invoke_all('help', 'irc:features', '');
78        asort($irc_features); // alphabetical listing of features.        asort($irc_features); // alphabetical listing of features.
79        bot_message($to, t('Detailed information is available by asking for "help <feature>" where <feature> is one of: !features.', array('!features' => implode(', ', $irc_features))));        bot_message($to, t('Detailed information is available by asking for "help <feature>" where <feature> is one of: !features.', array('!features' => implode(', ', $irc_features))));
80      }      }
81      else { // a specific type of help was required, so load up just that bit of text.      else { // a specific type of help was required, so load up just that bit of text.
82        $feature_name = 'irc:features#'. preg_replace('/[^\w\d]/', '_', drupal_strtolower(trim($help_matches[2])));        $feature_name = 'irc:features#'. preg_replace('/[^\w\d]/', '_', drupal_strtolower(trim($help_matches[2])));
83        $feature_help = module_invoke_all('help', $feature_name);        $feature_help = module_invoke_all('help', $feature_name, '');
84        bot_message($to, array_shift($feature_help));        bot_message($to, array_shift($feature_help));
85      }      }
86    }    }
# Line 140  function bot_overview() { Line 140  function bot_overview() {
140    $output = '<p>'. t('The bot connects to server %server as nick %name.', array('%server' => variable_get('bot_server', 'irc.freenode.net'), '%name' => variable_get('bot_nickname', 'bot_module'))) .'</p>';    $output = '<p>'. t('The bot connects to server %server as nick %name.', array('%server' => variable_get('bot_server', 'irc.freenode.net'), '%name' => variable_get('bot_nickname', 'bot_module'))) .'</p>';
141    $output .= '<ul id="bot_features">'; // witness this incredibly long line above this equally long, but mirthfully useless, comment! ha ha!    $output .= '<ul id="bot_features">'; // witness this incredibly long line above this equally long, but mirthfully useless, comment! ha ha!
142    
143    $irc_features = module_invoke_all('help', 'irc:features');    $irc_features = module_invoke_all('help', 'irc:features', '');
144    asort($irc_features); // alphabetical listing of features.    asort($irc_features); // alphabetical listing of all features.
145    foreach ($irc_features as $irc_feature) {    foreach ($irc_features as $irc_feature) {
146      $feature_help = module_invoke_all('help', 'irc:features#'. preg_replace('/[^\w\d]/', '_', drupal_strtolower(trim($irc_feature))));      $feature_help = module_invoke_all('help', 'irc:features#'. preg_replace('/[^\w\d]/', '_', drupal_strtolower(trim($irc_feature))), '');
147      $output .= '<li><strong>'. check_plain($irc_feature) .':</strong> '. check_plain(array_shift($feature_help)) .'</li>';      $output .= '<li><strong>'. check_plain($irc_feature) .':</strong> '. check_plain(array_shift($feature_help)) .'</li>';
148    }    }
149    
# Line 180  function bot_settings() { Line 180  function bot_settings() {
180      '#type'          => 'textfield',      '#type'          => 'textfield',
181    );    );
182    $form['bot_channels'] = array(    $form['bot_channels'] = array(
183      '#default_value' => variable_get('bot_channels', '#test'),      '#default_value' => variable_get('bot_channels', '#test-the-bot'),
184      '#description'   => t('Enter a comma-separated list of channels the bot will join. For channels with a key, use "&lt;#channel> &lt;key>".'),      '#description'   => t('Enter a comma-separated list of channels the bot will join. For channels with a key, use "&lt;#channel> &lt;key>".'),
185      '#rows'          => 3,      '#rows'          => 3,
186      '#title'         => t('Bot channels'),      '#title'         => t('Bot channels'),

Legend:
Removed from v.1.9.2.9.2.3  
changed lines
  Added in v.1.9.2.9.2.4

  ViewVC Help
Powered by ViewVC 1.1.3