"Antispam" plugin for Tkabber.

I. The idea.

This plugin provides functionality to block annoying
subscription requests and chat messages from spammers
by simply not showing them to the user.
A message from an unknown JID (that is not in the roster)
is required to contain a special antispam password to be
considered not spam.

II. Configuration.

There are several options that affect the behavior of this
plugin. They can be found in the Tkabber settings dialog
("Customize") by the following path:
Tkabber -> Plugins -> Atispam.

::plugins::antispam::options(enabled)

Specifies whether the spam protection is on. When this mode is
on, Tkabber will discard all subscription requests and messages
from all JIDs that don't exist in the roster and meet the 
restriction rules (see below). Also, Tkabber will optionally
reply to the sender with a message describing how to bypass
the spam protection.

::plugins::antispam::options(disable_regex)

A regexp determining JIDs for which the spam protection is
always disabled. No automatic reply will ever be sent to JIDs 
that match the expression and their messages and subscription
requests are always shown. A value of "^$" (without the quotes),
which is default, means no restrictions (because no JID will
match this regular expression).

::plugins::antispam::options(enable_regex)

A regexp determining JIDs for which the spam protection is
enabled. Only JIDs restricted to matching this expression and
not matching the disable_regex expression (defined in the 
previous paragraph) will be sent an automatic reply, and their
messages will be discarded until receiving a correct password.
When set to an empty string (the default) matches any JID.

::plugins::antispam::options(message)

The body of the password request that is sent in response to 
a chat message or a subscription request when the antispam 
protection is on. Before sending, the following substitutions 
are made in the reply:
Token    Replaced by
%%       %
%p       Password (see below)
If this value is an empty string, the password request 
will not be sent.

::plugins::antispam::options(password)

A regular expression, that an incoming message must match for
the sender to be considered "legal". When the match occurs,
messages from the sending JID will no longer be blocked.

III. Debugging.

To enable debug messages from this plugin put the following line
in your configuration file:

lappend debug_lvls antispam

Or, if you are using the debug plugin, insert a line into the
finload procedure in your configuration file (create one if it
does not exist) so it looks like this:

proc finload {} {
   # Other stuff ...
   set ::plugins::debug::debug(antispam) 1
}

IV. Cautions.

Care must be taken when using this plugin. Until tuned properly
it may hinder communication with transports. Please adjust the
disable_regex and enable_regex settings before turning the
plugin on. For example, if you expect to receive spam from
ICQ-contacts only, you can set enable_regex to something like
@icq-transport-jid.

WARNING: This plugin does not support the multilogin feature
(connecting to multiple accounts from one Tkabber instance).


vim:et:ts=4:sw=4:tw=64
