From mboxrd@z Thu Jan 1 00:00:00 1970 From: marcus-sup@quintic.co.uk (Marcus Williams) Date: Fri, 19 Oct 2007 11:52:31 +0100 Subject: [sup-talk] [PATCH] New hook (enabling message filters) Message-ID: <47188C6F.30008@quintic.co.uk> 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