Extending the Spam package
Say you want to add a new back end called blackbox. For filtering incoming mail, provide the following:
Code
emacs-lisp(defvar spam-use-blackbox nil "True if blackbox should be used.")Write
spam-check-blackboxif Blackbox can check incoming mail.Write
spam-blackbox-register-routineandspam-blackbox-unregister-routineusing the bogofilter register/unregister routines as a start, or other register/unregister routines more appropriate to Blackbox, if Blackbox can register/unregister spam and ham.Functionality
The
spam-check-blackboxfunction should return ‘nil’ orspam-split-group, observing the other conventions. See the existingspam-check-*functions for examples of what you can do, and stick to the template unless you fully understand the reasons why you aren’t.
For processing spam and ham messages, provide the following:
Code
Note you don’t have to provide a spam or a ham processor. Only provide them if Blackbox supports spam or ham processing.
Also, ham and spam processors are being phased out as single variables. Instead the form
(spam spam-use-blackbox)or(ham spam-use-blackbox)is favored. For now, spam/ham processor variables are still around but they won’t be for long.emacs-lisp(defvar gnus-group-spam-exit-processor-blackbox "blackbox-spam" "The Blackbox summary exit spam processor. Only applicable to spam groups.") (defvar gnus-group-ham-exit-processor-blackbox "blackbox-ham" "The whitelist summary exit ham processor. Only applicable to non-spam (unclassified and ham) groups.")Gnus parameters
Add
emacs-lisp(const :tag "Spam: Blackbox" (spam spam-use-blackbox)) (const :tag "Ham: Blackbox" (ham spam-use-blackbox))to the
spam-processgroup parameter ingnus.el. Make sure you do it twice, once for the parameter and once for the variable customization.Add
emacs-lisp(variable-item spam-use-blackbox)to the
spam-autodetect-methodsgroup parameter ingnus.elif Blackbox can check incoming mail for spam contents.Finally, use the appropriate
spam-install-*-backendfunction inspam.el. Here are the available functions.This function will simply install an alias for a back end that does everything like the original back end. It is currently only used to make
spam-use-BBDB-exclusiveact likespam-use-BBDB.This function installs a back end that has no check function, but can register/unregister ham or spam. The
spam-use-gmaneback end is such a back end.spam-install-checkonly-backendThis function will install a back end that can only check incoming mail for spam contents. It can’t register or unregister messages.
spam-use-blackholesandspam-use-hashcashare such back ends.spam-install-statistical-checkonly-backendThis function installs a statistical back end (one which requires the full body of a message to check it) that can only check incoming mail for contents.
spam-use-regex-bodyis such a filter.spam-install-statistical-backendThis function install a statistical back end with incoming checks and registration/unregistration routines.
spam-use-bogofilteris set up this way.This is the most normal back end installation, where a back end that can check and register/unregister messages is set up without statistical abilities. The
spam-use-BBDBis such a back end.Mover back ends are internal to
spam.eland specifically move articles around when the summary is exited. You will very probably never install such a back end.