From: Cameron Matheson <cam+sup@cammunism.org>
To: sup-talk <sup-talk@rubyforge.org>
Subject: Re: [sup-talk] Libnotify popups with sup
Date: Sun, 17 Jan 2010 11:19:37 -0700 [thread overview]
Message-ID: <1263751543-sup-5745@cammunism.org> (raw)
In-Reply-To: <1263747594-sup-5588@deepthought>
Excerpts from Anirudh Sanjeev's message of Sun Jan 17 10:13:12 -0700 2010:
> I want to write a small hook to sup to use libnotify and show a small
> popup whenever email comes from specific sources.
>
> I need to be able to mention a list of email addresses of people who's
> emails are important to me and need to be notified of, and the other
> ones I can just ignore.
>
> I don't know any ruby, but I'm sure that this isn't something too
> difficult to implement. I am not sure how to use the hooks and the API
> in them. I guess I have to use a hook that is executed when the email is
> received, but I'm not sure how to get the exact text of the email
> address.
You can see the hooks (and the variables they expose) by running sup -l.
I think you want the after-poll hook. Something like this might work
(I'm modifying my after-poll.rb slightly)
require 'cgi'
notify_addresses = %w(
someguy@example.com
otherguy@example.com
)
from_and_subj.each do |m|
next if notify_addresses.select { |a| m[0].include? a }.empty?
msg = CGI.escapeHTML(m.join "\n")
system("notify-send", "-t", "10000", "New E-Mail", msg)
end
(the HTML escaping is necessary for notify-send to work, otherwise you
just get a blank popup).
Cam
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
next prev parent reply other threads:[~2010-01-17 18:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-17 17:13 Anirudh Sanjeev
2010-01-17 18:10 ` Ben Gamari
2010-01-17 18:19 ` Cameron Matheson [this message]
2010-01-17 18:20 ` Ben Gamari
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1263751543-sup-5745@cammunism.org \
--to=cam+sup@cammunism.org \
--cc=sup-talk@rubyforge.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox