[Mailman-Developers] Implementing a new feature, first steps

Mark Sapiro mark at msapiro.net
Wed Mar 3 05:41:10 CET 2010


Ben Wilber wrote:
>
>I am interested in implementing a new feature in Mailman and am in need of a
>bit of direction.  The feature I'm considering would match the subject of an
>inbound message against one or more regexes and upon finding a match would
>redirect the message to a different, pre-defined, list.  The web interface
>would have a text box accepting a regex and a drop-down list of mailing
>lists to redirect the message to.  The original sender would get an
>auto-response saying something like "Based on the content of your subject
>line, we have redirected your message to this list ..." etc.
>
>I've been picking through the code (very nice and well-documented) and have
>not been able to find the right spot to insert a bit of code to do what I
>want.  Would anyone be able to point me to the right handler class to
>modify?  Maybe I need a new handler that gets called as a sort of filter?
>I'm not exactly sure yet and I don't see anything that seems to have that
>kind of interface.


It would probably be best to add a new Handlers/ module to actually
test the subject and requeue the post for another list, but that's the
easiest part.

You also need a new Gui/ module and class to implement the web
interface to maintain the list attribute that will be used for this.
Take a look at header_filter_rules (in Gui/Privacy.py and
handlers/SpamDetect.py) for an example.

Finally, you need to modify InitVars() in MailList.py to initialize the
list attribute for new lists and you have to increment
DATA_FILE_VERSION in Version.py so that MailList will update old lists
and add code to NewVars() in versions.py to add the list attribute for
old lists upon upgrade.


>Of course, any code I write (and which you find useful) will go right back
>upstream!


Thank you. However, it won't go in 2.1.x, because that's bug fix only
and it probably won't be applicable, at least directly, to MM 3.

-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan



More information about the Mailman-Developers mailing list