? bot-coder_style_fixes-187137.patch
? coder_style_fixes.patch
Index: bot.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bot/bot.module,v
retrieving revision 1.9.2.9
diff -u -p -r1.9.2.9 bot.module
--- bot.module	29 Jun 2007 02:38:43 -0000	1.9.2.9
+++ bot.module	27 Oct 2007 17:17:42 -0000
@@ -12,9 +12,9 @@
 function bot_help($section) {
   switch ($section) {
     case 'bot':
-      return '<p>'.t('Listed here are the bot\'s enabled features and settings. Information about the bot\'s features is also available by asking it directly for "help", and then for more detail with "help &lt;feature&gt;" (such as "help Drupal URLs"). This would best be done in a private message, so as not to disrupt regular channel activity.').'</p>';
+      return '<p>'. t('Listed here are the bot\'s enabled features and settings. Information about the bot\'s features is also available by asking it directly for "help", and then for more detail with "help &lt;feature&gt;" (such as "help Drupal URLs"). This would best be done in a private message, so as not to disrupt regular channel activity.') .'</p>';
     case 'admin/settings/bot':
-      return '<p>'.t('Configure your bot framework with these settings.').'</p>';
+      return '<p>'. t('Configure your bot framework with these settings.') .'</p>';
   }
 }
 
@@ -126,7 +126,7 @@ function bot_action($to, $action) {
 function bot_message($to, $message) {
   global $irc; // from bot_start.php.
   $type = strpos($to, '#') == 0 ? 'CHANNEL' : 'QUERY';
-  $irc->message(constant('SMARTIRC_TYPE_'.$type), $to, $message);
+  $irc->message(constant('SMARTIRC_TYPE_'. $type), $to, $message);
 
   // allow modules to react to bot responses. do NOT use
   // bot_message() in your implementation as you'll cause
@@ -141,16 +141,19 @@ function bot_message($to, $message) {
  */
 function bot_overview() {
   drupal_add_css(drupal_get_path('module', 'bot') .'/bot.css');
-  $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>';
+    
   $output .= '<ul id="bot_features">';
 
   $irc_features = module_invoke_all('help', 'irc:features');
   asort($irc_features); // alphabetical listing of features.
   foreach ($irc_features as $irc_feature) {
     $feature_help = module_invoke_all('help', 'irc:features#'. preg_replace('/[^\w\d]/', '_', drupal_strtolower(trim($irc_feature))));
-    $output .= '<li><span class="bot_feature">'.check_plain($irc_feature).':</span> '.check_plain(array_shift($feature_help)).'</li>';
+    $output .= '<li><span class="bot_feature">'. check_plain($irc_feature) .':</span> '. check_plain(array_shift($feature_help)) .'</li>';
   }
 
   $output .= '</ul>';
Index: bot_start.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bot/bot_start.php,v
retrieving revision 1.2.2.3
diff -u -p -r1.2.2.3 bot_start.php
--- bot_start.php	23 Oct 2007 17:13:19 -0000	1.2.2.3
+++ bot_start.php	27 Oct 2007 17:17:42 -0000
@@ -26,7 +26,7 @@ while ($param = array_shift($_SERVER['ar
     case '--url':
       $drupal_base_url = parse_url(array_shift($_SERVER['argv']));
       $_SERVER['HTTP_HOST'] = $drupal_base_url['host'];
-      $_SERVER['PHP_SELF'] = $drupal_base_url['path'].'/'.$script_name;
+      $_SERVER['PHP_SELF'] = $drupal_base_url['path'] .'/'. $script_name;
       $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'];
       $_SERVER['REMOTE_ADDR'] = NULL; // any values here do rather...
       $_SERVER['REQUEST_METHOD'] = NULL; // ...odd things. uh huh.
@@ -39,19 +39,21 @@ require_once './includes/bootstrap.inc';
 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
 require_once('Net/SmartIRC.php');
 
-// prevent MySQL timeouts on slow channels.
+// Prevent MySQL timeouts on slow channels.
 db_query('SET SESSION wait_timeout = %d', 24*60*60);
 
-// initialize the bot with some sane defaults.
-global $irc; $bot = new drupal_wrapper(); $irc = new Net_SmartIRC();
-$irc->setDebug( variable_get('bot_debugging', 0) ? SMARTIRC_DEBUG_ALL : SMARTIRC_DEBUG_NONE );
-$irc->setAutoReconnect(TRUE);  // reconnect to the server if disconnected.
-$irc->setAutoRetry(TRUE);      // retry if a server connection fails.
-$irc->setChannelSyncing(TRUE); // keep a list of joined users per channel.
-$irc->setUseSockets(TRUE);     // uses real sockets instead of fsock().
+// Initialize the bot with some sane defaults.
+global $irc;
+$bot = new drupal_wrapper();
+$irc = new Net_SmartIRC();
+$irc->setDebug(variable_get('bot_debugging', 0) ? SMARTIRC_DEBUG_ALL : SMARTIRC_DEBUG_NONE);
+$irc->setAutoReconnect(TRUE);  // Reconnect to the server if disconnected.
+$irc->setAutoRetry(TRUE);      // Retry if a server connection fails.
+$irc->setChannelSyncing(TRUE); // Keep a list of joined users per channel.
+$irc->setUseSockets(TRUE);     // Uses real sockets instead of fsock().
 
-// send every message type the library supports to our wrapper class.
-// we can automate the creation of these actionhandlers, but not the
+// Send every message type the library supports to our wrapper class.
+// We can automate the creation of these actionhandlers, but not the
 // class methods below (only PHP 5 supports default methods easily).
 $irc_message_types = array(
   'UNKNOWN',    'CHANNEL', 'QUERY',    'CTCP',        'NOTICE',       'WHO',
@@ -65,15 +67,15 @@ foreach ($irc_message_types as $irc_mess
   $irc->registerActionhandler(constant('SMARTIRC_TYPE_'.$irc_message_type), '.*', $bot, 'invoke_irc_msg_'.strtolower($irc_message_type));
 }
 
-// set up a five minute timer similar to Drupal's hook_cron(). this
+// Set up a five minute timer similar to Drupal's hook_cron(). this
 // is primarily used in the shipped code to clear cached data.
 $irc->registerTimehandler(300000, $bot, 'invoke_irc_bot_cron');
 
-// connect and begin listening.
+// Connect and begin listening.
 $irc->connect(variable_get('bot_server', 'irc.freenode.net'), variable_get('bot_server_port', 6667));
-$irc->login(variable_get('bot_nickname', 'bot_module'), variable_get('bot_nickname', 'bot_module').' :http://drupal.org/project/bot', 8, variable_get('bot_nickname', 'bot_module'), (variable_get('bot_password', '') != '') ? variable_get('bot_password', '') : NULL);
+$irc->login(variable_get('bot_nickname', 'bot_module'), variable_get('bot_nickname', 'bot_module') .': http://drupal.org/project/bot', 8, variable_get('bot_nickname', 'bot_module'), (variable_get('bot_password', '') != '') ? variable_get('bot_password', '') : NULL);
 
-// to support passwords, we have to make a single join per channel.
+// To support passwords, we have to make a single join per channel.
 $channels = preg_split('/\s*,\s*/', variable_get('bot_channels', '#test'));
 foreach ($channels as $channel) {
   $channel_parts = explode(' ', $channel);
@@ -81,10 +83,10 @@ foreach ($channels as $channel) {
 }
 
 $irc->join(preg_split('/\s*,\s*/', variable_get('bot_channels', '#test')));
-$irc->listen(); // go into the forever loop - no code after this is run.
-$irc->disconnect(); // if we stop listening, disconnect properly.
+$irc->listen(); // Go into the forever loop - no code after this is run.
+$irc->disconnect(); // If we stop listening, disconnect properly.
 
-// pass off IRC messages to our modules via Drupal's hook system.
+// Pass off IRC messages to our modules via Drupal's hook system.
 class drupal_wrapper {
   function invoke_irc_bot_cron(&$irc)                 { module_invoke_all('irc_bot_cron'); }
   function invoke_irc_msg_unknown(&$irc, &$data)      { module_invoke_all('irc_msg_unknown', $data); }
Index: bot_agotchi/bot_agotchi.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bot/bot_agotchi/bot_agotchi.module,v
retrieving revision 1.4.2.5
diff -u -p -r1.4.2.5 bot_agotchi.module
--- bot_agotchi/bot_agotchi.module	29 Jun 2007 02:38:43 -0000	1.4.2.5
+++ bot_agotchi/bot_agotchi.module	27 Oct 2007 17:17:42 -0000
@@ -20,7 +20,7 @@ function bot_agotchi_help($section) {
     case 'irc:features#botagotchi':
       return t('Proper care and feeding lets your botagotchi grow and be happy!');
     case 'admin/settings/bot/agotchi':
-      return '<p>'.t('Configure your botagotchi with these settings.').'</p>';
+      return '<p>'. t('Configure your botagotchi with these settings.') .'</p>';
   }
 }
 
Index: bot_factoid/bot_factoid.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bot/bot_factoid/Attic/bot_factoid.module,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 bot_factoid.module
--- bot_factoid/bot_factoid.module	29 Jun 2007 02:38:43 -0000	1.1.2.5
+++ bot_factoid/bot_factoid.module	27 Oct 2007 17:17:42 -0000
@@ -18,7 +18,7 @@ function bot_factoid_help($section) {
     case 'bot/factoid':
       return '<p>'. t('Browse all the factoids the bot knows about.') .'</p>';
     case 'admin/settings/bot/factoid':
-      return '<p>'. t('Configure factoid learning with these settings.').'</p>';
+      return '<p>'. t('Configure factoid learning with these settings.') .'</p>';
   }
 }
 
@@ -88,7 +88,10 @@ function bot_factoid_irc_msg_channel($da
     if ($factoid = bot_factoid_load($subject, $data)) {
       if (preg_match("/^\/me /", $factoid['result'])) {
         bot_action($to, str_replace('/me ', '', $factoid['result']));
-      } else { bot_message($to, $factoid['result']); }
+      }
+      else {
+        bot_message($to, $factoid['result']);
+      }
     }
   }
 
@@ -225,7 +228,10 @@ function bot_factoid_save($string) {
     // if "also" starts the statement, we're adding.
     if (preg_match("/^also\s+/i", $statement)) {
       $statement = preg_replace("/^also\s+/i", '', $statement);
-    } else { bot_factoid_delete($subject); }
+    }
+    else {
+      bot_factoid_delete($subject);
+    }
 
     db_query("INSERT INTO {bot_factoid} SET subject = '%s', is_are = '%s', statement = '%s'", $subject, $is_are, $statement);
     return 1; // if we set something, send back a happy.
Index: bot_project/bot_project.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/bot/bot_project/Attic/bot_project.module,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 bot_project.module
--- bot_project/bot_project.module	24 Oct 2007 16:50:10 -0000	1.1.2.2
+++ bot_project/bot_project.module	27 Oct 2007 17:17:42 -0000
@@ -22,9 +22,9 @@ function bot_project_help($section) {
     case 'irc:features#function_lookups':
       return t('The bot provides function lookups, triggered by "<function>?", based on the host\'s installed branches. Branches besides the default, if any, can be specified with "<function>:<branch>?".');
     case 'bot/project_urls':
-      return '<p>'. t('View the most recent and popular project URLs mentioned in the IRC channels.'). '</p>';
+      return '<p>'. t('View the most recent and popular project URLs mentioned in the IRC channels.') .'</p>';
     case 'admin/settings/bot/project':
-      return '<p>'. t('Configure the project toolkit features with these settings.'). '</p>';
+      return '<p>'. t('Configure the project toolkit features with these settings.') .'</p>';
   }
 }
 
@@ -126,7 +126,7 @@ function bot_project_irc_msg_channel($da
 
       // we'll always display a title, so grab that first for db storage.
       preg_match('/<title>(.*?) \|.*?<\/title>/', $result->data, $title_match);
-      $title = $title_match[1] ? $title_match[1] : '<'.t('unable to determine title').'>';
+      $title = $title_match[1] ? $title_match[1] : '<'. t('unable to determine title') .'>';
 
       // save and set count into message.
       $count = bot_project_url_save($url, $title);
@@ -196,7 +196,7 @@ function bot_project_irc_msg_channel($da
 
         // grab the title from the HTML and add our shortened commit message to it.
         preg_match('/<title>(.*?) - .*? - Trac<\/title>/', $result->data, $title_match);
-        $title = $title_match[1] ? $title_match[1] : '<'.t('unable to determine title').'>';
+        $title = $title_match[1] ? $title_match[1] : '<'. t('unable to determine title') .'>';
         $count = bot_project_url_save($url, "$title - $commit_msg");
 
         // and finally generate the final version of our IRC message.
@@ -222,14 +222,14 @@ function bot_project_urls_overview() {
   $output = NULL; $headers = array(t('URL or Title'), t('#'), t('Last Seen'));
   drupal_add_css(drupal_get_path('module', 'bot_project') .'/bot_project.css');
 
-  $output .= '<h2>'.t('Popular project URLs in the last 14 days').'</h2>';
+  $output .= '<h2>'. t('Popular project URLs in the last 14 days') .'</h2>';
   $results = pager_query('SELECT * FROM {bot_urls} WHERE last_seen >= %d ORDER BY count DESC, last_seen DESC', 10, 1, NULL, time() - 60*60*24*14);
   $rows = array(); while ($result = db_fetch_object($results)) { // titles could possibly be blank.
     $rows[] = array(array('data' => l($result->title ? $result->title : $result->url, $result->url), 'class' => 'title'),
       array('data' => $result->count, 'class' => 'count'), array('data' => format_date($result->last_seen), 'class' => 'last_seen'));
   } $output .= theme('table', $headers, $rows, array('id' => 'project_urls_popular')) . theme('pager', NULL, 10, 1);
 
-  $output .= '<h2>'.t('Most recent project URLs').'</h2>';
+  $output .= '<h2>'. t('Most recent project URLs') .'</h2>';
   $results = pager_query('SELECT * FROM {bot_urls} ORDER BY last_seen DESC', 10, 2);
   $rows = array(); while ($result = db_fetch_object($results)) { // titles could possibly be blank.
     $rows[] = array(array('data' => l($result->title ? $result->title : $result->url, $result->url), 'class' => 'title'),
@@ -245,10 +245,13 @@ function bot_project_urls_overview() {
 function bot_project_settings() {
   $form = array();
 
-  $results = db_query('SELECT branch_name, title FROM {api_branch} ORDER BY title');
-  $branches = array(); while ($result = db_fetch_object($results)) { $branches[$result->branch_name] = $result->title; }
-
   if (module_exists('api')) {
+    $results = db_query('SELECT branch_name, title FROM {api_branch} ORDER BY title');
+    $branches = array();
+    while ($result = db_fetch_object($results)) {
+      $branches[$result->branch_name] = $result->title;
+    }
+    
     $form['bot_project_api'] = array(
       '#collapsible'   => TRUE,
       '#title'         => t('api.module integration'),
