You are here

function antispam_comment in AntiSpam 6

Implementation of hook_comment().

File

./antispam.module, line 830

Code

function antispam_comment(&$comment, $op) {
  switch ($op) {
    case 'insert':
    case 'update':
      if (!variable_get('antispam_check_comments', 0) || antispam_is_spam_moderator('comments') || !variable_get('antispam_connection_enabled', 1)) {
        antispam_notify_moderators('comment', $comment, $comment->status == COMMENT_PUBLISHED ? TRUE : FALSE, FALSE);
      }
      break;
    case 'delete':
      db_query('DELETE FROM {antispam_spam_marks} WHERE content_type = \'comment\' AND content_id = %d', $comment->cid);
      break;
    case 'view':
      $rec = db_fetch_object(db_query('SELECT signature, spaminess FROM {antispam_spam_marks} WHERE content_type = \'comment\' AND content_id = %d', $comment->cid));
      if ($rec) {
        return $rec;
      }
      else {
        return array(
          'signature' => '',
          'spaminess' => 1,
        );
      }
      break;
  }
}