Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] Hook before-add-message, any way to know if this message is in a topic I replied to ?
@ 2010-12-20 11:45 Wael Nasreddine
  2010-12-20 13:12 ` Tero Tilus
  0 siblings, 1 reply; 5+ messages in thread
From: Wael Nasreddine @ 2010-12-20 11:45 UTC (permalink / raw)
  To: sup-talk

Hello,

I filter all email from a mailing list out of my inbox into the
list_XXX where XXX is the name of the list, this is fine however I
would like to see at glance emails in topic I replied to, for instance
a reply to this email ends up in the list_sup_talk Label, which forces
me to look for updates, what would be cool is a way to read emails to
the list whenever I have time but replies to my questions or to any of
answers should stay in the inbox (have the inbox label)

Any way to do that? Is there any method in the message variable that
can be called to know that?

BTW, how can I run a console from within a hook with all the
environment loaded? This actually allows me to call message.methods
myself and interact with it..

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

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

* Re: [sup-talk] Hook before-add-message, any way to know if this message is in a topic I replied to ?
  2010-12-20 11:45 [sup-talk] Hook before-add-message, any way to know if this message is in a topic I replied to ? Wael Nasreddine
@ 2010-12-20 13:12 ` Tero Tilus
  2010-12-23 12:04   ` Wael Nasreddine
  0 siblings, 1 reply; 5+ messages in thread
From: Tero Tilus @ 2010-12-20 13:12 UTC (permalink / raw)
  To: sup-talk

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.

--
Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


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

* Re: [sup-talk] Hook before-add-message, any way to know if this message is in a topic I replied to ?
  2010-12-20 13:12 ` Tero Tilus
@ 2010-12-23 12:04   ` Wael Nasreddine
  2011-01-03 20:46     ` Tero Tilus
  0 siblings, 1 reply; 5+ messages in thread
From: Wael Nasreddine @ 2010-12-23 12:04 UTC (permalink / raw)
  To: sup-talk

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

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

* Re: [sup-talk] Hook before-add-message, any way to know if this message is in a topic I replied to ?
  2010-12-23 12:04   ` Wael Nasreddine
@ 2011-01-03 20:46     ` Tero Tilus
  2011-01-03 21:02       ` Wael Nasreddine
  0 siblings, 1 reply; 5+ messages in thread
From: Tero Tilus @ 2011-01-03 20:46 UTC (permalink / raw)
  To: sup-talk

Wael Nasreddine, 2010-12-23 14:04:
> 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?

On the surface it looks like it should work.  Couple of questions
raise when I look at the code.  Does the thread loading actually work
like that?  I might have been awfully wrong.  Does #authors return
email addresses or Person instances?  Did your reply come from one of
the addresses listed in my_emails?  Did you reply only once and was
that message the last one of it's thread to be indexed?  Your first
mail to particular thread obviously won't trigger
show_if_participated(), but subsequent mails will.

Does your hook look like this?  (Judging by your explanation, it most
probably does)

  ...
  def show_if_participated(message)
  end
  ...
  show_if_participated(message)
  ...

-- 
Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


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

* Re: [sup-talk] Hook before-add-message, any way to know if this message is in a topic I replied to ?
  2011-01-03 20:46     ` Tero Tilus
@ 2011-01-03 21:02       ` Wael Nasreddine
  0 siblings, 0 replies; 5+ messages in thread
From: Wael Nasreddine @ 2011-01-03 21:02 UTC (permalink / raw)
  To: sup-talk

This one time, at SUP Camp, Tero Tilus said, On 2011-01-03 21:46:
> Wael Nasreddine, 2010-12-23 14:04:
> > 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?

> On the surface it looks like it should work.  Couple of questions
> raise when I look at the code.  Does the thread loading actually work
> like that?  I might have been awfully wrong.  Does #authors return
> email addresses or Person instances?
I'm not sure, someone else might know about this.


> Did your reply come from one of
> the addresses listed in my_emails?
Of course, I made sure all my aliases are listed in this Array (BTW
any way to get all the addresses listed in the config file into this
array?)

> Did you reply only once and was
> that message the last one of it's thread to be indexed?  Your first
> mail to particular thread obviously won't trigger
> show_if_participated(), but subsequent mails will.

Well This email ended up in the list_sup_talk and out of the inbox,
even though I did reply couple of times to it

> Does your hook look like this?  (Judging by your explanation, it most
> probably does)

Yes exactly like this, I'll attach the before-add-hook in another
personal email to you since it has many addresses to people I know
won't like to be spammed (@list: sorry)

>   ...
>   def show_if_participated(message)
>   end
>   ...
>   show_if_participated(message)
>   ...

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          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

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

end of thread, other threads:[~2011-01-03 21:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-20 11:45 [sup-talk] Hook before-add-message, any way to know if this message is in a topic I replied to ? Wael Nasreddine
2010-12-20 13:12 ` Tero Tilus
2010-12-23 12:04   ` Wael Nasreddine
2011-01-03 20:46     ` Tero Tilus
2011-01-03 21:02       ` Wael Nasreddine

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