Subject: Re: [sup-talk] Filters doesn't work

From: Mark Alexander <[email-masked]>
Date: Fri, 18 Nov 2011 16:21:41 -0500

Excerpts from Alfredo Palhares's message of Fri Nov 18 15:32:20 -0500 2011:

> Hello, i made a hook that adds labels, as referenced in the wiki[1]
> i created a before-add-message.rb into ~/.sip/hooks. it don't get
> anything in the logs, can anyone help me ? 

Are you sure the file is in ~/.sup/hooks, not ~/.sip/hooks?

> As attachement i send the script.

The script looks OK to me, except for this line:

  message.add_label = "texhax"

Try removing the '=' character.  It might be causing a syntax
error that prevents your script from loading.

Just as a reference, here is my ~/.sup/hooks/before-add-message.rb,
somewhat sanitized:

# Label by subject.  This is useful for messages
# generated automatically by Bugzilla or cron jobs.
case message.subj
when /\[FDBuilders/
  message.add_label :fd
when /\[P4 SUBMIT/
  message.add_label :p4
when /\[Bug/
  message.add_label :bugs
end

# Label by recipients.  This is useful for mailing lists.
to_string = message.recipients.map { |t| t.email }.join(" ")
case to_string
# Personal labels
when /\bsup-(devel|talk)@rubyforge.org\b/
  message.add_label :sup
# WIDGET labels
when /pi@widget/
  message.add_label :pi
when /tipsandtricks/
  message.add_label :tips
when /git-users/
  message.add_label :git
when /monitor-list/
  message.add_label :mon
when /acpi-dudes/
  message.add_label :acpi
end

# Label from from.  This is useful for personal emails.
case message.from.email
when /@amazon/
  message.add_label :amazon
when /@facebook/
  message.add_label :facebook
when /@netflix/
  message.add_label :netflix
end
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: Alfredo Palhares <[email-masked]>
Date: Fri, 18 Nov 2011 21:32:20 +0100

Hello, i made a hook that adds labels, as referenced in the wiki[1] i created a before-add-message.rb into ~/.sip/hooks. it don't get anything in the logs, can anyone help me ?
As attachement i send the script.

	[1] http://sup.rubyforge.org/wiki/wiki.pl?AutoAddLabelsToNewMessages

----
Regards,
Alfredo Palhares