Subject: Re: [sup-talk] Hook for in-reply-to

From: Johann Klähn <[email-masked]>
Date: Sat, 18 Dec 2010 15:39:59 +0100

FYI you can create a small script to fix already indexed mails.
Be sure to quit sup before you do this and change the moodlepost address.

require 'sup'
include Redwood
start
i = Index.init
i.load

moodle_junk = "[email-masked]"

i.each_message do |m|
  if m.replytos.include?(moodle_junk)
    m.replytos.delete(moodle_junk)
    i.update_message_state m
  end

  if m.refs.include?(moodle_junk)
    m.refs.delete(moodle_junk)
    i.update_message_state m
  end
end

i.save
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: Matti Eiden <[email-masked]>
Date: Fri, 17 Dec 2010 16:03:38 +0200

Hey folks,

I gave up using sup a while ago (read half a year) when I began
getting a lot of email from my university's Moodle. Moodle has/had a
rather stupid bug (now fixed, but it's gonna take years to reach my
university), which was that every email that wasn't based on a reply
(For example a new forum thread notification at moodle), received a
default In-Reply-To header of "[email-masked]".

You can probably imagine what happens: Every email coming from moodle
gets threaded under non-existing email "moodlepost0". In fact, they
wont appear in my inbox at all.

So I'd need a hook to kill this moodlepost0 from every email I
receive. I found this on pastebin, which looks like sup stuff:

http://pastebin.com/vzuXu9gr

In what file should I use it in? And is there a way to make the whole
index go through the hook, so I can recover all my old moodle emails
and get them threaded properly too?

Thanks,
Matti Eiden

---

From: Matti Eiden <[email-masked]>
Date: Fri, 17 Dec 2010 21:04:27 +0200

For anyone concerned, here's what worked for me. It was important to
delete the reference too, which included the same thing, as I guess
the threading function of sup automatically sets the reference to
in-reply-to if it's missing.

Here's also the original bug report at Moodle;
http://tracker.moodle.org/browse/MDL-22551

Thanks Ben for pointing me in the right direction.

##hooks/before-add-message.rb

fail_replyto = "[email-masked]"
if message.replytos.include?(fail_replyto)
  message.replytos.delete(fail_replyto)
end

if message.refs.include?(fail_replyto)
  message.refs.delete(fail_replyto)
end
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: Ben Walton <[email-masked]>
Date: Fri, 17 Dec 2010 09:30:49 -0500

Excerpts from Matti Eiden's message of Fri Dec 17 09:03:38 -0500 2010:

Hi Matti,

> In what file should I use it in? And is there a way to make the
> whole index go through the hook, so I can recover all my old moodle
> emails and get them threaded properly too?

I _think_ you'd want to apply that in the before-add-message hook
(~/.sup/hooks/before-add-message.rb).  That type of things makes me
want to cry...glad moodle fixed it though.

Thanks
-Ben
--
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302