[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.18.5.11 Extending the spam elisp package

Say you want to add a new back end called blackbox. For filtering incoming mail, provide the following:

  1. code

     
    (defvar spam-use-blackbox nil
      "True if blackbox should be used.")
    

    Add
     
        (spam-use-blackbox	 . spam-check-blackbox)
    
    to spam-list-of-checks.

  2. functionality

    Write the spam-check-blackbox function. It should return `nil' or spam-split-group. See the existing spam-check-* functions for examples of what you can do.

    Make sure to add spam-use-blackbox to spam-list-of-statistical-checks if Blackbox is a statistical mail analyzer that needs the full message body to operate.

For processing spam and ham messages, provide the following:

  1. code

    Note you don't have to provide a spam or a ham processor. Only provide them if Blackbox supports spam or ham processing.

     
    (defvar gnus-group-spam-exit-processor-blackbox "blackbox"
      "The Blackbox summary exit spam processor.
    Only applicable to spam groups.")
    
    (defvar gnus-group-ham-exit-processor-blackbox "blackbox"
      "The whitelist summary exit ham processor.
    Only applicable to non-spam (unclassified and ham) groups.")
    
    

  2. functionality

     
    (defun spam-blackbox-register-spam-routine ()
      (spam-generic-register-routine
       ;; the spam function
       (lambda (article)
         (let ((from (spam-fetch-field-from-fast article)))
           (when (stringp from)
    	   (blackbox-do-something-with-this-spammer from))))
       ;; the ham function
       nil))
    
    (defun spam-blackbox-register-ham-routine ()
      (spam-generic-register-routine
       ;; the spam function
       nil
       ;; the ham function
       (lambda (article)
         (let ((from (spam-fetch-field-from-fast article)))
           (when (stringp from)
    	   (blackbox-do-something-with-this-ham-sender from))))))
    

    Write the blackbox-do-something-with-this-ham-sender and blackbox-do-something-with-this-spammer functions. You can add more complex code than fetching the message sender, but keep in mind that retrieving the whole message takes significantly longer than the sender through spam-fetch-field-from-fast, because the message senders are kept in memory by Gnus.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on October, 20 2003 using texi2html