* [sup-talk] [PATCH] New hook (enabling message filters)
@ 2007-10-19 10:52 Marcus Williams
2007-10-19 12:51 ` David Stubbs
[not found] ` <4d4780f700181787@IMSS-WIN>
0 siblings, 2 replies; 10+ messages in thread
From: Marcus Williams @ 2007-10-19 10:52 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [sup-talk] [PATCH] New hook (enabling message filters)
2007-10-19 10:52 [sup-talk] [PATCH] New hook (enabling message filters) Marcus Williams
@ 2007-10-19 12:51 ` David Stubbs
[not found] ` <4d4780f700181787@IMSS-WIN>
1 sibling, 0 replies; 10+ messages in thread
From: David Stubbs @ 2007-10-19 12:51 UTC (permalink / raw)
Excerpts from Marcus Williams's message of Fri Oct 19 11:52:31 +0100 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
Hi Marcus,
Attached is a patch to stop warning for @__say_id when using hooks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hook.diff
Type: application/octet-stream
Size: 354 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/sup-talk/attachments/20071019/1832ed0e/attachment.obj
^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <4d4780f700181787@IMSS-WIN>]
* [sup-talk] [PATCH] New hook (enabling message filters)
[not found] ` <4d4780f700181787@IMSS-WIN>
@ 2007-10-19 13:46 ` Marcus Williams
[not found] ` <4d6e9e1600182d59@IMSS-WIN>
1 sibling, 0 replies; 10+ messages in thread
From: Marcus Williams @ 2007-10-19 13:46 UTC (permalink / raw)
[sent from wrong email address, so apols if people get dupes]
On 19/10/2007 David Stubbs wrote:
> Attached is a patch to stop warning for @__say_id when using hooks.
Ta - and heres an update that includes that and redirects say to log if
running from sup-sync and ask_yes_or_no to gets.
So you should be able to use all three and get something reasonable
under both sup and sup-sync.
Marcus
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: filter-hook.diff
Url: http://rubyforge.org/pipermail/sup-talk/attachments/20071019/34918dc3/attachment.pl
^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <4d6e9e1600182d59@IMSS-WIN>]
* [sup-talk] [PATCH] New hook (enabling message filters)
[not found] ` <4d6e9e1600182d59@IMSS-WIN>
@ 2007-10-19 13:50 ` Marcus Williams
2007-10-19 14:03 ` David Stubbs
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Marcus Williams @ 2007-10-19 13:50 UTC (permalink / raw)
On 19/10/2007 Marcus Williams wrote:
> Ta - and heres an update that includes that and redirects say to log if
> running from sup-sync and ask_yes_or_no to gets.
... this time I'll attach the right patch :(
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: filter-hook.diff
Url: http://rubyforge.org/pipermail/sup-talk/attachments/20071019/b3b0f231/attachment.pl
^ permalink raw reply [flat|nested] 10+ messages in thread
* [sup-talk] [PATCH] New hook (enabling message filters)
2007-10-19 13:50 ` Marcus Williams
@ 2007-10-19 14:03 ` David Stubbs
[not found] ` <4d7f58120018376f@IMSS-WIN>
2007-11-05 2:40 ` William Morgan
2 siblings, 0 replies; 10+ messages in thread
From: David Stubbs @ 2007-10-19 14:03 UTC (permalink / raw)
Excerpts from Marcus Williams's message of Fri Oct 19 14:50:07 +0100 2007:
> On 19/10/2007 Marcus Williams wrote:
> > Ta - and heres an update that includes that and redirects say to log if
> > running from sup-sync and ask_yes_or_no to gets.
>
> ... this time I'll attach the right patch :(
Thanks Marcus,
This seems just what I'm looking for ;-). I've only just started to
use Sup over the last 2 days - I'm hooked!
There are a few things I want to get sorted spam filtering is one of them. I'm
assuming I'll be able to use your new patch to do spam filtering.
I'm going to have a play over the weekend.
Thanks!
^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <4d7f58120018376f@IMSS-WIN>]
* [sup-talk] [PATCH] New hook (enabling message filters)
[not found] ` <4d7f58120018376f@IMSS-WIN>
@ 2007-10-19 14:18 ` Marcus Williams
2007-10-19 14:21 ` David Stubbs
0 siblings, 1 reply; 10+ messages in thread
From: Marcus Williams @ 2007-10-19 14:18 UTC (permalink / raw)
On 19/10/2007 David Stubbs wrote:
> There are a few things I want to get sorted spam filtering is one of
> them. I'm assuming I'll be able to use your new patch to do spam
> filtering.
Yep, you can mark things directly as spam by adding the spam label I
think, although I've not tried this yet. You could also kill a message
by adding killed as a label.
So assuming your spam checker adds "SPAM" or something to the subject
you can just do:
message.add_label "spam" if message.subj =~ /SPAM/
I think you can also use the message.raw_headers to look for specific
headers (like X-Spam-Status if you're using spamassassin).
I'm not sure if the reserved labels like spam/killed etc can be added as
strings or if you have to add them as symbols :spam or :killed - they're
symbols in the code but they may get converted into strings when added
to the index. Easy enough to test though.
Marcus
^ permalink raw reply [flat|nested] 10+ messages in thread
* [sup-talk] [PATCH] New hook (enabling message filters)
2007-10-19 14:18 ` Marcus Williams
@ 2007-10-19 14:21 ` David Stubbs
0 siblings, 0 replies; 10+ messages in thread
From: David Stubbs @ 2007-10-19 14:21 UTC (permalink / raw)
Excerpts from Marcus Williams's message of Fri Oct 19 15:18:37 +0100 2007:
> On 19/10/2007 David Stubbs wrote:
> > There are a few things I want to get sorted spam filtering is one of
> > them. I'm assuming I'll be able to use your new patch to do spam
> > filtering.
>
> Yep, you can mark things directly as spam by adding the spam label I
> think, although I've not tried this yet. You could also kill a message
> by adding killed as a label.
>
> So assuming your spam checker adds "SPAM" or something to the subject
> you can just do:
>
> message.add_label "spam" if message.subj =~ /SPAM/
>
> I think you can also use the message.raw_headers to look for specific
> headers (like X-Spam-Status if you're using spamassassin).
>
> I'm not sure if the reserved labels like spam/killed etc can be added as
> strings or if you have to add them as symbols :spam or :killed - they're
> symbols in the code but they may get converted into strings when added
> to the index. Easy enough to test though.
>
> Marcus
Funky,
I'll give it a go!
^ permalink raw reply [flat|nested] 10+ messages in thread
* [sup-talk] [PATCH] New hook (enabling message filters)
2007-10-19 13:50 ` Marcus Williams
2007-10-19 14:03 ` David Stubbs
[not found] ` <4d7f58120018376f@IMSS-WIN>
@ 2007-11-05 2:40 ` William Morgan
2007-11-05 15:03 ` Marcus Williams
2 siblings, 1 reply; 10+ messages in thread
From: William Morgan @ 2007-11-05 2:40 UTC (permalink / raw)
Excerpts from Marcus Williams's message of Fri Oct 19 06:50:07 -0700 2007:
> On 19/10/2007 Marcus Williams wrote:
> > Ta - and heres an update that includes that and redirects say to log if
> > running from sup-sync and ask_yes_or_no to gets.
>
> ... this time I'll attach the right patch :(
Applied. Thanks!
--
William <wmorgan-sup at masanjin.net>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [sup-talk] [PATCH] New hook (enabling message filters)
2007-11-05 2:40 ` William Morgan
@ 2007-11-05 15:03 ` Marcus Williams
2007-11-05 15:38 ` William Morgan
0 siblings, 1 reply; 10+ messages in thread
From: Marcus Williams @ 2007-11-05 15:03 UTC (permalink / raw)
On 5.11.2007, William Morgan wrote:
> > > Ta - and heres an update that includes that and redirects say to log if
> > > running from sup-sync and ask_yes_or_no to gets.
> Applied. Thanks!
What I really want to do is get the inbox mode to do handle the cases
when the hook adds the spam/deleted/starred/archive labels. What I
mean is, if the hook adds a spam label then I dont want it to appear
in the inbox.
Currently I have to hit "@" after a poll. This is useful for
debugging, but I'm not sure its what people would expect.
Marcus
^ permalink raw reply [flat|nested] 10+ messages in thread
* [sup-talk] [PATCH] New hook (enabling message filters)
2007-11-05 15:03 ` Marcus Williams
@ 2007-11-05 15:38 ` William Morgan
0 siblings, 0 replies; 10+ messages in thread
From: William Morgan @ 2007-11-05 15:38 UTC (permalink / raw)
Excerpts from Marcus Williams's message of Mon Nov 05 07:03:40 -0800 2007:
> What I really want to do is get the inbox mode to do handle the cases
> when the hook adds the spam/deleted/starred/archive labels. What I
> mean is, if the hook adds a spam label then I dont want it to appear
> in the inbox.
Try modifying InboxMode#is_relevant? (called by
ThreadIndexMode#handle_add_update).
--
William <wmorgan-sup at masanjin.net>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-11-05 15:38 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-19 10:52 [sup-talk] [PATCH] New hook (enabling message filters) Marcus Williams
2007-10-19 12:51 ` David Stubbs
[not found] ` <4d4780f700181787@IMSS-WIN>
2007-10-19 13:46 ` Marcus Williams
[not found] ` <4d6e9e1600182d59@IMSS-WIN>
2007-10-19 13:50 ` Marcus Williams
2007-10-19 14:03 ` David Stubbs
[not found] ` <4d7f58120018376f@IMSS-WIN>
2007-10-19 14:18 ` Marcus Williams
2007-10-19 14:21 ` David Stubbs
2007-11-05 2:40 ` William Morgan
2007-11-05 15:03 ` Marcus Williams
2007-11-05 15:38 ` William Morgan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox