[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sup-talk] Hook before-add-message, any way to know if this message is in a topic I replied to ?
This one time, at SUP Camp, Tero Tilus said, On 2010-12-20 14:12:
> Wael Nasreddine, 2010-12-20 13:45:
> > I would like to see at glance emails in topic I replied to
> You'd basically check all the messages in the same thread with the
> received mail and see if you appear in from. I think it could look
> something like
> ts = ThreadSet.new(...something...)
> ts.load_thread_for_message message
> participated = ts.thread_for(message).authors.include? 'my@email'
> message.add_label :inbox if participated
> More advanced suppers please step in and correct.
I added this method to my before-add-message hook and I call it at the
very end of the before-add-hook (so it's executed at the end)
------- CUT
def show_if_participated(message)
return if message.has_label? :inbox
my_emails = ['wael.nasreddine@gmail.com', 'anotheremail@example.com']
ts = ThreadSet.new Index.instance, $config[:thread_by_subject]
ts.load_thread_for_message message
message_thread = ts.thread_for message
return unless message_thread
message.add_label :inbox if my_emails.any? { |email|
message_thread.authors.include? email }
end
------- CUT
However it's not working, I remove ~/.sup/xapian and ran sup-sync,
this email does not have the inbox label however it's one of the
thread that I replied to in a mailing list, what's wrong with my
function?
Regards,
Wael Nasreddine
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Waël Nasreddine
website http://wael.nasreddine.com
Blog http://emxyptlk.com
TechnoGate http://technogate.fr
mobile 06.32.94.70.13
landline 09.70.444.236
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk