* [sup-talk] New User Hooks Details
@ 2011-02-03 15:58 Philippe LeCavalier
2011-02-03 23:01 ` Tero Tilus
2011-02-03 23:48 ` Hamish D
0 siblings, 2 replies; 6+ messages in thread
From: Philippe LeCavalier @ 2011-02-03 15:58 UTC (permalink / raw)
To: sup-talk
I'm having a hard time using the hooks system.
I'm trying to add the 'AutoAddLabelsToNewMessages'. I've followed the wiki and created '~/.sup/hooks/before-add-message.rb' with a few hooks but sup isn't calling them before polling.
One bit of info that seems odd to me is when I issue 'sup -l' the hooks listed are nowhere to be found in the hooks folder yet they appear to be working. Is that normal?
ruby 1.8.7 (2010-08-16 patchlevel 302) [i486-linux]
sup 0.12.1
sample hook:
#Mark Lists <lists>
addressfile = File.open("/home/plecavalier/.sup/hooks/label.lists","r")
if ! addressfile.grep(/#{message.list_address}/).empty?
message.add_label :lists
end
contents of ~/.sup.hooks/label.lists
plecavalier@plc:~/.sup/hooks$ cat label.lists
cups@easysw.com
samba@lists.samba.org
rsync@lists.samba.org
offlineimap-project@lists.alioth.debian.org
bind-users@lists.isc.org
The only thing I can think of is possibly setting the execute bit but I wanted to checking here prior.
--
Thanks,
Phil
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [sup-talk] New User Hooks Details
2011-02-03 15:58 [sup-talk] New User Hooks Details Philippe LeCavalier
@ 2011-02-03 23:01 ` Tero Tilus
2011-02-03 23:48 ` Hamish D
1 sibling, 0 replies; 6+ messages in thread
From: Tero Tilus @ 2011-02-03 23:01 UTC (permalink / raw)
To: Sup users
Philippe LeCavalier, 2011-02-03 17:58:
> One bit of info that seems odd to me is when I issue 'sup -l' the
> hooks listed are nowhere to be found in the hooks folder yet they
> appear to be working. Is that normal?
The `sup -l` lists all the hooks sup looks for upon start. If a hook
file exists, sup loads it and calls the ruby code in the file the way
documented in `sup -l`.
> # Mark Lists <lists>
> addressfile = File.open("/home/plecavalier/.sup/hooks/label.lists","r")
> if ! addressfile.grep(/#{message.list_address}/).empty?
> message.add_label :lists
> end
Looks sound on the surface. This is your
~/.sup/hooks/before-add-message.rb? New mails coming from
mailinglists listed in label.lists don't get lists-tag? You could add
some logging and see whats going on.
debug "before-add-message"
File.open("/home/plecavalier/.sup/hooks/label.lists") do |addressfile|
unless addressfile.grep(/#{message.list_address}/).empty?
debug "list message #{message.id.inspect}"
message.add_label :lists
else
debug "non-list message #{message.id.inspect}"
end
end
Then
$ SUP_LOG_LEVEL=debug sup
and wait for incoming mail or temporarily use another SUP_BASE (than
$HOME/.sup) with a sources.yaml pointing to a test corpus of mails.
Debug output goes to log buffer.
--
Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [sup-talk] New User Hooks Details
2011-02-03 15:58 [sup-talk] New User Hooks Details Philippe LeCavalier
2011-02-03 23:01 ` Tero Tilus
@ 2011-02-03 23:48 ` Hamish D
2011-02-04 1:28 ` Antono Vasiljev
2011-02-05 2:15 ` Philippe LeCavalier
1 sibling, 2 replies; 6+ messages in thread
From: Hamish D @ 2011-02-03 23:48 UTC (permalink / raw)
To: Philippe LeCavalier; +Cc: sup-talk
> One bit of info that seems odd to me is when I issue 'sup -l' the hooks listed are nowhere to be found in the hooks folder yet they appear to be working. Is that normal?
sup -l will list the hooks you can use - it doesn't check what hooks
you've actually created.
> sample hook:
> #Mark Lists <lists>
> addressfile = File.open("/home/plecavalier/.sup/hooks/label.lists","r")
> if ! addressfile.grep(/#{message.list_address}/).empty?
> message.add_label :lists
> end
You can stick debug statements in - say:
debug "list address is #{message.list_address.inspect}, type is
#{message.list_address.class.to_s}"
and then see it in the log (while using sup, press ";" and scroll down
to the log buffer).
I think that message.list_address is actually of class Person, so you
would want to use message.list_address.email for your case. I've
updated the wiki to correct that - I think I may have written the
wrong information into the wiki to start with :/ so sorry for the
mistake.
Hamish
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [sup-talk] New User Hooks Details
2011-02-03 23:48 ` Hamish D
@ 2011-02-04 1:28 ` Antono Vasiljev
2011-02-05 2:15 ` Philippe LeCavalier
1 sibling, 0 replies; 6+ messages in thread
From: Antono Vasiljev @ 2011-02-04 1:28 UTC (permalink / raw)
To: sup-talk
On Thu, 2011-02-03 at 23:48 +0000, Hamish D wrote:
> debug "list address is #{message.list_address.inspect}, type is
> #{message.list_address.class.to_s}"
>
> and then see it in the log (while using sup, press ";" and scroll down
> to the log buffer).
>
> I think that message.list_address is actually of class Person, so you
> would want to use message.list_address.email for your case. I've
> updated the wiki to correct that - I think I may have written the
> wrong information into the wiki to start with :/ so sorry for the
> mistake.
Oh. Spent some hours debugging this issue. And list_address.to_s gives
list address so it was kinda magic that list != list :)
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [sup-talk] New User Hooks Details
2011-02-03 23:48 ` Hamish D
2011-02-04 1:28 ` Antono Vasiljev
@ 2011-02-05 2:15 ` Philippe LeCavalier
2011-02-05 2:54 ` Blake Sweeney
1 sibling, 1 reply; 6+ messages in thread
From: Philippe LeCavalier @ 2011-02-05 2:15 UTC (permalink / raw)
To: Hamish D; +Cc: sup-talk
Hi.
Excerpts from Hamish D's message of Thu Feb 03 18:48:56 -0500 2011:
> > One bit of info that seems odd to me is when I issue 'sup -l' the hooks listed are nowhere to be found in the hooks folder yet they appear to be working. Is that normal?
>
> sup -l will list the hooks you can use - it doesn't check what hooks
> you've actually created.
>
> > sample hook:
> > #Mark Lists <lists>
> > addressfile = File.open("/home/plecavalier/.sup/hooks/label.lists","r")
> > if ! addressfile.grep(/#{message.list_address}/).empty?
> > message.add_label :lists
> > end
>
> You can stick debug statements in - say:
>
> debug "list address is #{message.list_address.inspect}, type is
> #{message.list_address.class.to_s}"
>
> and then see it in the log (while using sup, press ";" and scroll down
> to the log buffer).
>
> I think that message.list_address is actually of class Person, so you
> would want to use message.list_address.email for your case. I've
> updated the wiki to correct that - I think I may have written the
> wrong information into the wiki to start with :/ so sorry for the
> mistake.
Thanks for this. And thanks to everyone else who posted suggestions. Suffice it to say, I would have never figured that out on my own.
I'm also seeing allot more info now with debugs here there and everywhere and can work from that.
One question came to mind while I was fixing my hooks...Does the email address have to be complete or can it be just the domain? (I'm referring to the email address list in the referenced file of course)
--
Thanks,
Phil
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [sup-talk] New User Hooks Details
2011-02-05 2:15 ` Philippe LeCavalier
@ 2011-02-05 2:54 ` Blake Sweeney
0 siblings, 0 replies; 6+ messages in thread
From: Blake Sweeney @ 2011-02-05 2:54 UTC (permalink / raw)
To: Philippe LeCavalier; +Cc: sup-talk
On Fri, Feb 4, 2011 at 9:15 PM, Philippe LeCavalier
<support@plecavalier.com> wrote:
> Hi.
>
> Excerpts from Hamish D's message of Thu Feb 03 18:48:56 -0500 2011:
>> > One bit of info that seems odd to me is when I issue 'sup -l' the hooks listed are nowhere to be found in the hooks folder yet they appear to be working. Is that normal?
>>
>> sup -l will list the hooks you can use - it doesn't check what hooks
>> you've actually created.
>>
>> > sample hook:
>> > #Mark Lists <lists>
>> > addressfile = File.open("/home/plecavalier/.sup/hooks/label.lists","r")
>> > if ! addressfile.grep(/#{message.list_address}/).empty?
>> > message.add_label :lists
>> > end
>>
>> You can stick debug statements in - say:
>>
>> debug "list address is #{message.list_address.inspect}, type is
>> #{message.list_address.class.to_s}"
>>
>> and then see it in the log (while using sup, press ";" and scroll down
>> to the log buffer).
>>
>> I think that message.list_address is actually of class Person, so you
>> would want to use message.list_address.email for your case. I've
>> updated the wiki to correct that - I think I may have written the
>> wrong information into the wiki to start with :/ so sorry for the
>> mistake.
> Thanks for this. And thanks to everyone else who posted suggestions. Suffice it to say, I would have never figured that out on my own.
>
> I'm also seeing allot more info now with debugs here there and everywhere and can work from that.
>
> One question came to mind while I was fixing my hooks...Does the email address have to be complete or can it be just the domain? (I'm referring to the email address list in the referenced file of course)
>
> --
> Thanks,
> Phil
> _______________________________________________
> sup-talk mailing list
> sup-talk@rubyforge.org
> http://rubyforge.org/mailman/listinfo/sup-talk
>
I'm a bit biased but I think my gem sup_tag could help out. It makes
tagging messages pretty easy. For example:
tag do
list_address /sup-talk/, :sup
end
tags all messages with sup-talk in the list address as sup. Checkout out:
https://github.com/blakesweeney/sup_tag
Blake
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-02-05 3:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-03 15:58 [sup-talk] New User Hooks Details Philippe LeCavalier
2011-02-03 23:01 ` Tero Tilus
2011-02-03 23:48 ` Hamish D
2011-02-04 1:28 ` Antono Vasiljev
2011-02-05 2:15 ` Philippe LeCavalier
2011-02-05 2:54 ` Blake Sweeney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox