From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.42.228.136 with SMTP id je8cs111507icb; Sun, 6 Mar 2011 15:18:54 -0800 (PST) Received: by 10.42.138.74 with SMTP id b10mr3942448icu.367.1299453534589; Sun, 06 Mar 2011 15:18:54 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id vp1si5502222icb.53.2011.03.06.15.18.54; Sun, 06 Mar 2011 15:18:54 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 09728185836C; Sun, 6 Mar 2011 18:18:54 -0500 (EST) Received: from mail-wy0-f178.google.com (mail-wy0-f178.google.com [74.125.82.178]) by rubyforge.org (Postfix) with ESMTP id 6552818581B2 for ; Sun, 6 Mar 2011 17:54:08 -0500 (EST) Received: by wyf28 with SMTP id 28so4341546wyf.23 for ; Sun, 06 Mar 2011 14:54:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:content-type:subject:from:to:date:message-id :user-agent:content-transfer-encoding; bh=TG06xOaRO+ywyDU91/C/AvlYm4w1Lf6pWgMY45m9m5U=; b=YwU6RwcMMUNiI7EWj/zba7xXg1v0Jo2vXWJF5KoKK1Sf2hRGO29mPUiza9MyJ0s4tL I3HmNf3LOT2UfqyCIVXfapLDjM2pYFHR6KDGD0DCivWNYC3dqwLdDaLe9Ra2roG/d77m uO5WsW72xZTM9ks2eQTDJuy0J3NZHwq1V8aCI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:subject:from:to:date:message-id:user-agent :content-transfer-encoding; b=BUgBvOMt/mteeW1lxor2vL51zrFNXc7QLn2X7h0LxYXdNWfzT6BJQfwLL87SRUQR+Z CuqbP2ewPByKeNnI+aQb2J7QV9F9Bo3PUIHEykBUppUlmGFXymR9JFQlgILxOBR1nTYy 1bbDcEujuR5bxJcSV2FswT+mRSeWLm1tOu4os= Received: by 10.227.0.88 with SMTP id 24mr2860939wba.123.1299452047465; Sun, 06 Mar 2011 14:54:07 -0800 (PST) Received: from localhost (cpc12-cmbg15-2-0-cust81.5-4.cable.virginmedia.com [86.30.247.82]) by mx.google.com with ESMTPS id y29sm1601583wbd.16.2011.03.06.14.54.04 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 06 Mar 2011 14:54:06 -0800 (PST) From: Hamish To: sup-talk Date: Sun, 06 Mar 2011 22:54:01 +0000 Message-Id: <1299450523-sup-2185@whisper> User-Agent: Sup/git Subject: [sup-talk] threading and blackberrys 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 Hello all Where I work some people use Blackberries, and they don't add an In-Reply-To header to email, so I do quite a bit of manual re-threading using the '#' key. I'd like to not have to do it so much, but I don't want to just thread all mail by subject, as the blackberry messages are not /so/ frequent. So I've put the below in my before-add-message.rb hook that others might find useful. The code: * only runs if the message is from a blackberry and the subject indicates it is a reply. * looks for the most recent message that matches the subject, and adds a ref to that message, so they should then be in the same thead. Any feedback or improvements appreciated. Hamish subj = message.subj.downcase # if from a blackberry and is a reply, then try to find a matching thread if message.id.downcase.include?('blackberry') && Message.subj_is_reply?(subj) thread_subj = Message.normalize_subj subj query = Index.parse_query "subject:\"#{thread_subj}\"" # the query returns newest match first first_id = Index.each_id(query) { |id| break id } message.add_ref(first_id) unless first_id.nil? end _______________________________________________ sup-talk mailing list sup-talk@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-talk