Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.715
diff -u -p -r1.715 system.module
--- modules/system/system.module	23 Jun 2009 12:11:19 -0000	1.715
+++ modules/system/system.module	25 Jun 2009 17:29:26 -0000
@@ -2180,7 +2180,7 @@ function system_send_email_action_form($
     '#default_value' => $context['message'],
     '#cols' => '80',
     '#rows' => '20',
-    '#description' => t('The message that should be sent. You may include the following variables: %site_name, %username, %node_url, %node_type, %title, %teaser, %body, %term_name, %term_description, %term_id, %vocabulary_name, %vocabulary_description, %vocabulary_id. Not all variables will be available in all contexts.'),
+    '#description' => t('The message that should be sent. You may include the following variables: %site_name, %username, %node_url, %node_type, %title, %teaser, %body, %comment_subject, %comment_body, %comment_delete_url, %comment_edit_url, %comment_username,.%term_name, %term_description, %term_id, %vocabulary_name, %vocabulary_description, %vocabulary_id. Not all variables will be available in all contexts.'),
   );
   return $form;
 }
@@ -2270,6 +2270,11 @@ function system_send_email_action($objec
     $params['node'] = $node;
   }
 
+  // Include comment info if this is a comment
+  if (isset($comment)) {
+    $params['comment'] = $comment;
+  }
+
   if (drupal_mail('system', 'action_send_email', $recipient, $language, $params)) {
     watchdog('action', 'Sent email to %recipient', array('%recipient' => $recipient));
   }
@@ -2313,6 +2318,19 @@ function system_mail($key, &$message, $p
       '%body' => $node->body,
     );
   }
+
+  // Comment-based variables are available if we have a comment.
+  if (isset($params['comment'])) {
+    $comment = $params['comment'];
+    $variables += array(
+      '%comment_subject' => $comment->subject,
+      '%comment_body' => $comment->comment,
+      '%comment_username' => $comment->name,
+      '%comment_delete_url' => url('comment/delete/' . $comment->cid, array('absolute'=>TRUE)),
+      '%comment_edit_url' => url('comment/edit/' . $comment->cid, array('absolute'=>TRUE)),
+    );
+  }
+
   $subject = strtr($context['subject'], $variables);
   $body = strtr($context['message'], $variables);
   $message['subject'] .= str_replace(array("\r", "\n"), '', $subject);
@@ -2326,7 +2344,7 @@ function system_message_action_form($con
     '#default_value' => isset($context['message']) ? $context['message'] : '',
     '#required' => TRUE,
     '#rows' => '8',
-    '#description' => t('The message to be displayed to the current user. You may include the following variables: %site_name, %username, %node_url, %node_type, %title, %teaser, %body, %term_name, %term_description, %term_id, %vocabulary_name, %vocabulary_description, %vocabulary_id. Not all variables will be available in all contexts.'),
+    '#description' => t('The message that should be sent. You may include the following variables: %site_name, %username, %node_url, %node_type, %title, %teaser, %body, %comment_subject, %comment_body, %comment_delete_url, %comment_edit_url, %comment_username,.%term_name, %term_description, %term_id, %vocabulary_name, %vocabulary_description, %vocabulary_id. Not all variables will be available in all contexts.'),
   );
   return $form;
 }
@@ -2388,6 +2406,17 @@ function system_message_action(&$object,
       )
     );
   }
+   // Comment-based variables are available if we have a comment.
+  if (isset($comment)) {
+    $variables += array(
+      '%comment_subject' => filter_xss($comment->subject),
+      '%comment_body' => filter_xss($comment->comment),
+      '%comment_username' => check_plain($comment->name),
+      '%comment_delete_url' => url('comment/delete/' . $comment->cid, array('absolute'=>TRUE)),
+      '%comment_edit_url' => url('comment/edit/' . $comment->cid, array('absolute'=>TRUE)),
+    );
+  }
+
   $context['message'] = strtr($context['message'], $variables);
   drupal_set_message($context['message']);
 }
