diff --git a/mollom.module b/mollom.module index 5e42bb5..b2c4260 100644 --- a/mollom.module +++ b/mollom.module @@ -620,7 +620,7 @@ function _mollom_protectable_forms() { 'mode' => MOLLOM_MODE_ANALYSIS, ); } - + // Trackbacks if (module_exists('trackback')) { $forms['trackback'] = array( @@ -1173,7 +1173,8 @@ function mollom($method, $data = array()) { watchdog('mollom', 'No Mollom servers could be reached or all servers returned an error -- the server list was emptied.', NULL, WATCHDOG_ERROR); } -/** Implementation of hook_trackback(). +/** + * Implementation of hook_trackback(). * * Checks incoming Trackbacks with Mollom */ @@ -1181,44 +1182,39 @@ function mollom_trackback(&$trackback, $op) { if (variable_get('mollom_trackback', 0)) { switch ($op) { case 'receive': - case 'insert': $data = array( 'post_title' => $trackback->subject, 'post_body' => $trackback->excerpt, // Dev. Mode: 'spam', 'ham', 'unsure' 'author_name' => $trackback->name, // Site name of Trackback - 'author_url' => $trackback->url, + 'author_url' => $trackback->url, // URL passed to trackback 'author_ip' => $trackback->site, ); $response = mollom('mollom.checkContent', $data); - if (isset($trackback->trid) && !empty($trackback->trid)) { - - switch ($response['spam']) { - case MOLLOM_ANALYSIS_HAM: - // Do nothing/publicise - $operation = 'publish'; - break; - - case MOLLOM_ANALYSIS_SPAM: - // Delete the trackback - $operation = 'delete'; - break; - - case MOLLOM_ANALYSIS_UNSURE: - /** - * Put into Trackback's moderation queue and allow for the site's - * maintainer to tell Mollom whether it was good or bad - possibly by - * catching $op == 'publish'/'unpublish'/'delete'? Or add new 'publish - * and report as ham to Mollom' and 'delete and report as spam to Mollom'? - **/ - $operation = 'unpublish'; - break; - } - _trackback_operation($operation, $trackback->trid); // perform the trackback operation + + switch ($response['spam']) { + case MOLLOM_ANALYSIS_HAM: + // Do nothing/publicise + break; + + case MOLLOM_ANALYSIS_SPAM: + // Delete the trackback + $trackback->error = t('Mollom detected this Trackback as spam'); + break; + + case MOLLOM_ANALYSIS_UNSURE: + /** + * Put into Trackback's moderation queue and allow for the site's + * maintainer to tell Mollom whether it was good or bad - possibly by + * catching $op == 'publish'/'unpublish'/'delete'? Or add new 'publish + * and report as ham to Mollom' and 'delete and report as spam to Mollom'? + */ + break; } - break; - + + break; // End Receive + // TODO: Tell Mollom when a trackback is deleted case 'delete': break;