[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sup-talk] New User Hooks Details
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