From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.213.28.69 with SMTP id l5cs331864ebc; Sun, 17 Jan 2010 10:22:58 -0800 (PST) Received: by 10.229.101.165 with SMTP id c37mr3549331qco.5.1263752577986; Sun, 17 Jan 2010 10:22:57 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 2si3274666qwi.17.2010.01.17.10.22.57; Sun, 17 Jan 2010 10:22:57 -0800 (PST) Received-SPF: pass (google.com: domain of sup-talk-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-talk-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-talk-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 6AEE815B802D; Sun, 17 Jan 2010 13:22:57 -0500 (EST) Received: from cammunism.org (cammunism.org [70.99.188.231]) by rubyforge.org (Postfix) with ESMTP id C636915B8029 for ; Sun, 17 Jan 2010 13:19:46 -0500 (EST) Received: by cammunism.org (Postfix, from userid 1000) id 855EB7801B73; Sun, 17 Jan 2010 11:19:37 -0700 (MST) From: Cameron Matheson To: sup-talk In-reply-to: <1263747594-sup-5588@deepthought> References: <1263747594-sup-5588@deepthought> Date: Sun, 17 Jan 2010 11:19:37 -0700 Message-Id: <1263751543-sup-5745@cammunism.org> User-Agent: Sup/0.9.1 Subject: Re: [sup-talk] Libnotify popups with sup X-BeenThere: sup-talk@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: User & developer discussion of Sup List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-talk-bounces@rubyforge.org Errors-To: sup-talk-bounces@rubyforge.org 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