Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] Hook for in-reply-to
@ 2010-12-17 14:03 Matti Eiden
  2010-12-17 14:30 ` Ben Walton
  0 siblings, 1 reply; 4+ messages in thread
From: Matti Eiden @ 2010-12-17 14:03 UTC (permalink / raw)
  To: sup-talk

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 "moodlepost0@moodle.tamk.fi".

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
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [sup-talk] Hook for in-reply-to
  2010-12-17 14:03 [sup-talk] Hook for in-reply-to Matti Eiden
@ 2010-12-17 14:30 ` Ben Walton
  2010-12-17 19:04   ` Matti Eiden
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Walton @ 2010-12-17 14:30 UTC (permalink / raw)
  To: sup-talk

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

_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [sup-talk] Hook for in-reply-to
  2010-12-17 14:30 ` Ben Walton
@ 2010-12-17 19:04   ` Matti Eiden
  2010-12-18 14:39     ` Johann Klähn
  0 siblings, 1 reply; 4+ messages in thread
From: Matti Eiden @ 2010-12-17 19:04 UTC (permalink / raw)
  To: sup-talk

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 = "moodlepost0@moodle.tamk.fi"
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
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [sup-talk] Hook for in-reply-to
  2010-12-17 19:04   ` Matti Eiden
@ 2010-12-18 14:39     ` Johann Klähn
  0 siblings, 0 replies; 4+ messages in thread
From: Johann Klähn @ 2010-12-18 14:39 UTC (permalink / raw)
  To: sup-talk

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 = "moodlepost0@whatever.org"

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
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-12-18 14:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-17 14:03 [sup-talk] Hook for in-reply-to Matti Eiden
2010-12-17 14:30 ` Ben Walton
2010-12-17 19:04   ` Matti Eiden
2010-12-18 14:39     ` Johann Klähn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox