[sup-talk] [PATCH] New hook (enabling message filters)

Marcus Williams marcus-sup at quintic.co.uk
Fri Oct 19 06:52:31 EDT 2007


Hi -

Attached is a patch to poll.rb to add the ability to filter messages
pre-indexing. Theres one current problem with it which I cant figure out
and thats the warnings you get when its run from sup-sync about missing
a say_id - I think this is something to do with not having a buffer
manager in sup-sync. Anyone any ideas how to get the say method in
hooks.rb to fail gracefully to something else if the buffermanager isnt
available?

This hook allows you to do this in your .sup/hooks/before-add-message.rb:

##
if message.subj =~ /^\[sup-talk\]/
    message.add_label "sup"
    message.add_label "list"
end

message.add_label "work" if message.from =~ /mywork at email.com/
message.add_label "home" if message.from =~ /myhome at email.com/
##

.... and then when polling or during sup-sync this hook gets run for
every message it adds to the index. "message" is the about-to-be-indexed
email, changes made to it get passed on into the index.

Any comments or fixes (like the "say" issue), mail me (or reply on list)

Marcus

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: filter-hook.diff
Url: http://rubyforge.org/pipermail/sup-talk/attachments/20071019/4144dbc4/attachment.pl 


More information about the sup-talk mailing list