Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: Hamish <dmishd@gmail.com>
To: sup-talk <sup-talk@rubyforge.org>
Subject: [sup-talk] threading and blackberrys
Date: Sun, 06 Mar 2011 22:54:01 +0000	[thread overview]
Message-ID: <1299450523-sup-2185@whisper> (raw)

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


                 reply	other threads:[~2011-03-06 23:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1299450523-sup-2185@whisper \
    --to=dmishd@gmail.com \
    --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