Index: spam.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/spam/spam.module,v
retrieving revision 1.51.4.1.2.41.2.30.2.18
diff -u -p -r1.51.4.1.2.41.2.30.2.18 spam.module
--- spam.module	2 Feb 2010 20:31:53 -0000	1.51.4.1.2.41.2.30.2.18
+++ spam.module	4 Feb 2010 03:54:42 -0000
@@ -2095,3 +2095,149 @@ function spam_publish($type, $id, $extra
   cache_clear_all();
   spam_update_statistics(t('publish @type', array('@type' => $type)));
 }
+
+/**
+* Implementation of hook_action_info().
+*/
+function spam_action_info() {
+  $spam_actions = array();
+  $spam_types = array( 'node', 'comment', 'user' );
+  foreach ($spam_types as $type) {
+    if (module_exists($type)) {
+      $spam_actions['spam_mark_'.$type.'_as_spam_action'] = array(
+	'description' => t('Mark '.$type.' as spam'),
+	'type' => $type,
+	'configurable' => FALSE,
+	'hooks' => array( 'any' => TRUE )
+	);
+      $spam_actions['spam_mark_'.$type.'_as_not_spam_action'] = array(
+	'description' => t('Mark '.$type.' as not spam'),
+	'type' => $type,
+	'configurable' => FALSE,
+	'hooks' => array( 'any' => TRUE )
+	);
+    }
+  }
+  return $spam_actions;
+}
+
+/**
+* Implementation of a Drupal action.
+* Mark node as spam.
+*/
+function spam_mark_node_as_spam_action(&$object, $context = array()) {
+  // get the nid from the object
+  if (isset($object->nid)) {
+    $nid = $object->nid;
+  }
+  elseif (isset($context['nid'])) {
+    $nid = $context['nid'];
+  }
+  // make sure we have a node record
+  if ($nid) {
+    spam_mark_as_not_spam('node', $nid);
+    // record a message noting the action taken
+    watchdog('action', 'Marked node %nid as spam.', array('%nid' => $nid) );
+  }
+}
+
+/**
+* Implementation of a Drupal action.
+* Mark node as not spam.
+*/
+function spam_mark_node_as_not_spam_action(&$object, $context = array()) {
+  // get the nid from the object
+  if (isset($object->nid)) {
+    $nid = $object->nid;
+  }
+  elseif (isset($context['nid'])) {
+    $nid = $context['nid'];
+  }
+  // make sure we have a node record
+  if ($nid) {
+    spam_mark_as_not_spam('node', $nid);
+    // record a message noting the action taken
+    watchdog('action', 'Marked node %nid as not spam.', array('%nid' => $nid) );
+  }
+}
+
+/**
+* Implementation of a Drupal action.
+* Mark user as spam.
+*/
+function spam_mark_user_as_spam_action(&$object, $context = array()) {
+  // get the uid from the object
+  if (isset($object->uid)) {
+    $uid = $object->uid;
+  }
+  elseif (isset($context['uid'])) {
+    $uid = $context['uid'];
+  }
+  // make sure we have a user record
+  if ($uid) {
+    spam_mark_as_not_spam('user', $uid);
+    // record a message noting the action taken
+    watchdog('action', 'Marked user %uid as not spam.', array('%uid' => $uid) );
+  }
+}
+
+/**
+* Implementation of a Drupal action.
+* Mark user as not spam.
+*/
+function spam_mark_user_as_not_spam_action(&$object, $context = array()) {
+  // get the uid from the object
+  if (isset($object->uid)) {
+    $uid = $object->uid;
+  }
+  elseif (isset($context['uid'])) {
+    $uid = $context['uid'];
+  }
+  // make sure we have a comment record
+  if ($uid) {
+    spam_mark_as_not_spam('user', $uid);
+    // record a message noting the action taken
+    watchdog('action', 'Marked user %uid as not spam.', array('%uid' => $uid) );
+  }
+}
+
+/**
+* Implementation of a Drupal action.
+* Mark comment as spam.
+*/
+function spam_mark_comment_as_spam_action(&$object, $context = array()) {
+  // get the cid from the object
+  if (isset($object->cid)) {
+    $cid = $object->cid;
+  }
+  elseif (isset($context['cid'])) {
+    $cid = $context['cid'];
+  }
+  // make sure we have a comment record
+  if ($cid) {
+    spam_mark_as_not_spam('comment', $cid);
+    // record a message noting the action taken
+    watchdog('action', 'Marked comment %cid as spam.', array('%cid' => $cid) );
+  }
+}
+
+/**
+* Implementation of a Drupal action.
+* Mark comment as not spam.
+*/
+function spam_mark_comment_as_not_spam_action(&$object, $context = array()) {
+  // get the cid from the object
+  if (isset($object->cid)) {
+    $cid = $object->cid;
+  }
+  elseif (isset($context['cid'])) {
+    $cid = $context['cid'];
+  }
+  // make sure we have a comment record
+  if ($cid) {
+    spam_mark_as_not_spam('comment', $cid);
+    // record a message noting the action taken
+    watchdog('action', 'Marked comment %cid as not spam.', array('%cid' => $cid) );
+  }
+}
+?>
\ No newline at end of file
