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 12:05:33 -0000 @@ -2095,3 +2095,29 @@ 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; +} +?> \ No newline at end of file Index: content/spam_content_comment.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/spam/content/Attic/spam_content_comment.inc,v retrieving revision 1.1.2.1 diff -u -p -r1.1.2.1 spam_content_comment.inc --- content/spam_content_comment.inc 2 Feb 2010 20:31:54 -0000 1.1.2.1 +++ content/spam_content_comment.inc 4 Feb 2010 12:05:36 -0000 @@ -385,3 +385,43 @@ function comment_spam_scan($form, &$form unset($_SESSION['spam_form']); } } + +/** +* 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) ); + } +} Index: content/spam_content_node.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/spam/content/Attic/spam_content_node.inc,v retrieving revision 1.1.2.1 diff -u -p -r1.1.2.1 spam_content_node.inc --- content/spam_content_node.inc 2 Feb 2010 20:31:54 -0000 1.1.2.1 +++ content/spam_content_node.inc 4 Feb 2010 12:05:39 -0000 @@ -198,3 +198,43 @@ function node_spam_scan($form, &$form_st unset($_SESSION['spam_form']); } } + +/** +* 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) ); + } +} Index: content/spam_content_user.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/spam/content/Attic/spam_content_user.inc,v retrieving revision 1.1.2.1 diff -u -p -r1.1.2.1 spam_content_user.inc --- content/spam_content_user.inc 2 Feb 2010 20:31:54 -0000 1.1.2.1 +++ content/spam_content_user.inc 4 Feb 2010 12:05:39 -0000 @@ -256,3 +256,43 @@ function user_spam_scan($form, &$form_st unset($_SESSION['spam_form']); } } + +/** +* 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) ); + } +}