Index: flag.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/flag/Attic/flag.inc,v
retrieving revision 1.1.2.30
diff -u -p -r1.1.2.30 flag.inc
--- flag.inc	14 Mar 2009 06:13:54 -0000	1.1.2.30
+++ flag.inc	9 Sep 2009 09:05:34 -0000
@@ -186,6 +186,7 @@ class flag_flag {
    */
   function default_options() {
     return array(
+      'events' => array('flag', 'unflag'),
       'flag_short' => '',
       'flag_long' => '',
       'flag_message' => '',
@@ -399,14 +400,12 @@ class flag_flag {
     $flagged = $this->_is_flagged($content_id, $uid);
     if ($action == 'unflag' && $flagged) {
       $this->_unflag($content_id, $uid);
-      // Let other modules perform actions.
-      module_invoke_all('flag', 'unflag', $this, $content_id, $account);
     }
     elseif ($action == 'flag' && !$flagged) {
       $this->_flag($content_id, $uid);
-      // Let other modules perform actions.
-      module_invoke_all('flag', 'flag', $this, $content_id, $account);
     }
+    // Let other modules perform actions.
+    module_invoke_all('flag', $action, $this, $content_id, $account);
 
     return TRUE;
   }
@@ -806,6 +805,7 @@ class flag_node extends flag_flag {
       'show_on_form' => FALSE,
       'i18n' => 0,
     );
+    $options = module_invoke_all('flag_node_default_options', $options);
     return $options;
   }
 
@@ -980,6 +980,7 @@ class flag_comment extends flag_flag  {
     $options += array(
       'show_on_comment' => TRUE,
     );
+    $options = module_invoke_all('flag_comment_default_options', $options);
     return $options;
   }
 
@@ -1094,6 +1095,7 @@ class flag_user extends flag_flag {
     $options += array(
       'show_on_profile' => TRUE,
     );
+    $options = module_invoke_all('flag_user_default_options', $options);
     return $options;
   }
 
Index: flag.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/flag/Attic/flag.module,v
retrieving revision 1.11.2.68
diff -u -p -r1.11.2.68 flag.module
--- flag.module	14 Mar 2009 06:13:54 -0000	1.11.2.68
+++ flag.module	9 Sep 2009 09:05:34 -0000
@@ -595,72 +595,50 @@ function flag_form(&$form_state, $name, 
     '#required' => TRUE,
     '#access' => empty($flag->locked['title']),
   );
-
-  $form['flag_short'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Flag link text'),
-    '#default_value' => $flag->flag_short,
-    '#description' => t('The text for the "flag this" link for this flag.'),
-    '#required' => TRUE,
-    '#access' => empty($flag->locked['flag_short']),
+  
+  if (!isset($flag->events)) {
+    $flag->events = array('flag', 'unflag');
+  }
+  
+  $form['events'] = array(
+    '#type' => 'value',
+    '#value' => $flag->events,
   );
+  
+  foreach ($flag->events as $event) {
+    $form[$event .'_short'] = array(
+      '#type' => 'textfield',
+      '#title' => t('!event link text', array('!event' => $event)),
+      '#default_value' => isset($flag->{$event .'_short'}) ? $flag->{$event .'_short'} : '',
+      '#description' => t('The text for the "!event this" link for this flag.', array('!event' => $event)),
+      '#required' => TRUE,
+      '#access' => empty($flag->locked[$event .'_short']),
+    );
 
-  $form['flag_long'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Flag link description'),
-    '#default_value' => $flag->flag_long,
-    '#description' => t('The description of the "flag this" link. Usually displayed on mouseover.'),
-    '#access' => empty($flag->locked['flag_long']),
-  );
-
-  $form['flag_confirmation'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Flag confirmation message'),
-    '#default_value' => $flag->flag_confirmation,
-    '#description' => t('Message displayed if the user has clicked the "flag this" link and confirmation is required. Usually presented in the form of a question such as, "Are you sure you want to flag this content?"'),
-    '#access' => empty($flag->locked['flag_confirmation']),
-  );
-
-  $form['flag_message'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Flagged message'),
-    '#default_value' => $flag->flag_message,
-    '#description' => t('Message displayed after flagging content. If JavaScript is enabled, it will be displayed below the link. If not, it will be displayed in the message area.'),
-    '#access' => empty($flag->locked['flag_message']),
-  );
-
-  $form['unflag_short'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Unflag link text'),
-    '#default_value' => $flag->unflag_short,
-    '#description' => t('The text for the "unflag this" link for this flag.'),
-    '#required' => TRUE,
-    '#access' => empty($flag->locked['unflag_short']),
-  );
+    $form[$event .'_long'] = array(
+      '#type' => 'textfield',
+      '#title' => t('!event link description', array('!event' => $event)),
+      '#default_value' => isset($flag->{$event .'_long'}) ? $flag->{$event .'_long'} : '',
+      '#description' => t('The description of the "!event this" link. Usually displayed on mouseover.', array('!event' => $event)),
+      '#access' => empty($flag->locked[$event .'_long']),
+    );
 
-  $form['unflag_long'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Unflag link description'),
-    '#default_value' => $flag->unflag_long,
-    '#description' => t('The description of the "unflag this" link. Usually displayed on mouseover.'),
-    '#access' => empty($flag->locked['unflag_long']),
-  );
-
-  $form['unflag_confirmation'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Unflag confirmation message'),
-    '#default_value' => $flag->unflag_confirmation,
-    '#description' => t('Message displayed if the user has clicked the "unflag this" link and confirmation is required. Usually presented in the form of a question such as, "Are you sure you want to unflag this content?"'),
-    '#access' => empty($flag->locked['unflag_confirmation']),
-  );
-
-  $form['unflag_message'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Unflagged message'),
-    '#default_value' => $flag->unflag_message,
-    '#description' => t('Message displayed after content has been unflagged. If JavaScript is enabled, it will be displayed below the link. If not, it will be displayed in the message area.'),
-    '#access' => empty($flag->locked['unflag_message']),
-  );
+    $form[$event .'_confirmation'] = array(
+      '#type' => 'textfield',
+      '#title' => t('!event confirmation message', array('!event' => $event)),
+      '#default_value' => isset($flag->{$event .'_confirmation'}) ? $flag->{$event .'_confirmation'} : '',
+      '#description' => t('Message displayed if the user has clicked the "!event this" link and confirmation is required. Usually presented in the form of a question such as, "Are you sure you want to !event this content?"', array('!event' => $event)),
+      '#access' => empty($flag->locked[$event .'_confirmation']),
+    );
+
+    $form[$event .'_message'] = array(
+      '#type' => 'textfield',
+      '#title' => t('!event message', array('!event' => $event)),
+      '#default_value' => isset($flag->{$event .'_message'}) ? $flag->{$event .'_message'} : '',
+      '#description' => t('Message displayed after content has been !event. If JavaScript is enabled, it will be displayed below the link. If not, it will be displayed in the message area.', array('!event' => $event)),
+      '#access' => empty($flag->locked[$event .'_message']),
+    );
+  }
 
   if (module_exists('token')) {
     $form['token_help'] = array(
@@ -753,17 +731,15 @@ function flag_form(&$form_state, $name, 
  */
 function flag_form_validate($form, &$form_state) {
   $form_values = $form_state['values'];
-
+  
   if ($form_values['link_type'] == 'confirm') {
-    if (empty($form_values['flag_confirmation'])) {
-      form_set_error('flag_confirmation', t('A flag confirmation message is required when using the confirmation link type.'));
-    }
-    if (empty($form_values['unflag_confirmation'])) {
-      form_set_error('unflag_confirmation', t('An unflag confirmation message is required when using the confirmation link type.'));
+    foreach ($form_values['events'] as $event) {
+      if (empty($form_values[$event .'_confirmation'])) {
+        form_set_error($event .'_confirmation', t('The !event confirmation message is required when using the confirmation link type.', array('!event' => $event)));
+      }
     }
   }
 
-
   $flag = $form['#flag'];
   $flag->form_input($form_values);
   $flag->validate();
