Index: twitter.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/twitter/twitter.module,v
retrieving revision 1.3.2.5
diff -b -u -p -r1.3.2.5 twitter.module
--- twitter.module	10 Feb 2009 19:33:00 -0000	1.3.2.5
+++ twitter.module	13 Mar 2009 06:01:05 -0000
@@ -87,6 +87,9 @@ function twitter_nodeapi(&$node, $op, $a
     case 'update':
       if (!empty($node->status) && !empty($node->twitter) && !empty($node->twitter['post'])) {
         $twitter_accounts = twitter_get_user_accounts($node->uid, TRUE);
+        if (variable_get('twitter_enable_global_account', FALSE)) {
+          $twitter_accounts += array(variable_get('twitter_global_screen_name', '') => array('password' => variable_get('twitter_global_password', '')));
+        }
         $replacements = array('!title' => $node->title,
                               '!url' => url('node/'. $node->nid, array('absolute' => TRUE, 'alias' => TRUE)),
                               '!url-alias' => url('node/'. $node->nid, array('absolute' => TRUE)),
Index: twitter.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/twitter/twitter.inc,v
retrieving revision 1.3.2.6
diff -b -u -p -r1.3.2.6 twitter.inc
--- twitter.inc	17 Jan 2009 20:01:05 -0000	1.3.2.6
+++ twitter.inc	13 Mar 2009 06:01:12 -0000
@@ -27,6 +27,10 @@ function twitter_form($account = NULL) {
   }
 
   $twitter_accounts = drupal_map_assoc(array_keys(twitter_get_user_accounts($account->uid, TRUE)));
+  if (variable_get('twitter_enable_global_account', FALSE)) {
+    $twitter_accounts += array(variable_get('twitter_global_screen_name', '') => variable_get('twitter_global_screen_name', '') .' '. t('(Global)'));
+  }
+  
   if (count($twitter_accounts)) {
     $form = array();
     $form['status'] = array(
Index: twitter.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/twitter/twitter.pages.inc,v
retrieving revision 1.2.2.4
diff -b -u -p -r1.2.2.4 twitter.pages.inc
--- twitter.pages.inc	17 Jan 2009 20:43:53 -0000	1.2.2.4
+++ twitter.pages.inc	13 Mar 2009 06:01:19 -0000
@@ -57,9 +57,56 @@ function twitter_admin_form() {
       array('!identica' => l('Identi.ca', 'http://laconi.ca/trac/wiki/TwitterCompatibleAPI'))),
   );
 
+  $form['global_account'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Global Twitter account'),
+    '#description' => t('If you wish to provide a global Twitter account, then posts for enabled node types can optionally be posted to a site-wide global Twitter account.'),
+  );
+  $form['global_account']['twitter_enable_global_account'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Enable global Twitter account'),
+    '#default_value' => variable_get('twitter_enable_global_account', FALSE),
+  );
+  $form['global_account']['twitter_global_screen_name'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Twitter user name'),
+    '#default_value' => variable_get('twitter_global_screen_name', ''),
+  );
+  $form['global_account']['twitter_global_password'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Password'),
+    '#description' => t("If you wish to post to Twitter from Drupal, you must enter the global Twitter account's password."),
+    '#default_value' => variable_get('twitter_global_password', ''),
+  );
+
   return system_settings_form($form);
 }
 
+/**
+ * Form validation handler for twitter_admin_form
+ */
+function twitter_admin_form_validate($form, &$form_state) {
+  if ($form_state['values']['twitter_enable_global_account']) {
+
+    $name = $form_state['values']['twitter_global_screen_name'];
+    $pass = $form_state['values']['twitter_global_password'];
+
+    if (empty($name)) {
+      form_set_error('twitter_global_screen_name', t('You must provide the Twitter screen name for your global Twitter account.'));
+    }
+    if (empty($pass)) {
+      form_set_error('twitter_global_password', t('You must provide the Twitter password for your global Twitter account.'));
+    }
+    
+    if (!empty($name) && !empty($pass)) {
+      $valid = twitter_authenticate($name, $pass);
+      if (!$valid) {
+        form_set_error('twitter_global_password', t('Twitter authentication failed. Please check your global account name and password and try again.'));
+      }
+    }
+  }
+}
+
 function twitter_user_settings($account) {
   module_load_include('inc', 'twitter');
 
