Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] [PATCH] Fix for imap based sources
       [not found] <0ae09eda00048831@IMSS-WIN>
@ 2007-10-25 12:35 ` Marcus Williams
  0 siblings, 0 replies; 4+ messages in thread
From: Marcus Williams @ 2007-10-25 12:35 UTC (permalink / raw)


On 25/10/2007 I wrote:
> It also fixes what I think is a bug in the imap sup source - the imap
> "/Seen" flag means a message has been read from the way I interpret the
> RFC, the "/Recent" flag is what you need to check for "unreadness".

... which means I should probably be using it in the imap marked_read?
as well. So the marked_read? method in imap.rb should probably be:

  def marked_read? id
    return @imap_state[id][:flags].include?(:Seen)
  end

Note that I've removed the leading ! operator as well.

Marcus


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

* [sup-talk] [PATCH] Fix for imap based sources
  2007-11-02  0:14 ` Ian Taylor
@ 2007-11-02  1:19   ` Colin Bell
  0 siblings, 0 replies; 4+ messages in thread
From: Colin Bell @ 2007-11-02  1:19 UTC (permalink / raw)


Excerpts from Ian Taylor's message of Fri Nov 02 11:14:55 +1100 2007:
>
> That doesn't seem quite right to me. The RFC seems to state that the
> 'Recent' flag is more of a notification that this is the first session
> to see the message.
>
> What about this instead?
>
>       labels = { :Flagged => :starred,
>                  :Deleted => :deleted
>                }.inject(@labels) do |cur, (imap, sup)|
>         cur + (state[:flags].include?(imap) ? [sup] : [])
>       end
>       labels += [:unread] unless state[:flags].include?(:Seen)
>
> Seems like we want to tag it as unread if it isn't marked as 'Seen'.

Works for me. Thanks


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

* [sup-talk] [PATCH] Fix for imap based sources
  2007-10-25 10:25 Marcus Williams
@ 2007-11-02  0:14 ` Ian Taylor
  2007-11-02  1:19   ` Colin Bell
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Taylor @ 2007-11-02  0:14 UTC (permalink / raw)


Excerpts from Marcus Williams's message of Thu Oct 25 06:25:39 -0400 2007:
> Hi -
> 
> Apply this one at your peril. This patch makes the unread status
> correct on sources that arent mbox - unfortunately I cant test on
> Maildir so if someone wants to confirm it still works that would be
> good :)
> 
> If you implement a new source, it means you now have to add a
> marked_read? method to your source as well. Argument is a message id.
> message.rb now calls this when source_marked_read is called.
> 
> It also fixes what I think is a bug in the imap sup source - the imap
> "/Seen" flag means a message has been read from the way I interpret the
> RFC, the "/Recent" flag is what you need to check for "unreadness".
> 
> This fixes my problem with imap (in that all new messages were getting
> marked as read). To get just this fix all you have to do is replace Seen
> for Recent in the imap.rb. The line currently looks like:
> 
> labels = { :Seen => :unread,
> 
> and it should be
> 
> labels = { :Recent => :unread,
> 
> 
> 
> Marcus

That doesn't seem quite right to me. The RFC seems to state that the
'Recent' flag is more of a notification that this is the first session
to see the message.

What about this instead?

      labels = { :Flagged => :starred,                                                                                                                                                                              
                 :Deleted => :deleted                                                                                                                                                                               
               }.inject(@labels) do |cur, (imap, sup)|                                                                                                                                                              
        cur + (state[:flags].include?(imap) ? [sup] : [])                                                                                                                                                           
      end
      labels += [:unread] unless state[:flags].include?(:Seen)

Seems like we want to tag it as unread if it isn't marked as 'Seen'.

-- 
Ian Taylor


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

* [sup-talk] [PATCH] Fix for imap based sources
@ 2007-10-25 10:25 Marcus Williams
  2007-11-02  0:14 ` Ian Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Marcus Williams @ 2007-10-25 10:25 UTC (permalink / raw)


Hi -

Apply this one at your peril. This patch makes the unread status
correct on sources that arent mbox - unfortunately I cant test on
Maildir so if someone wants to confirm it still works that would be
good :)

If you implement a new source, it means you now have to add a
marked_read? method to your source as well. Argument is a message id.
message.rb now calls this when source_marked_read is called.

It also fixes what I think is a bug in the imap sup source - the imap
"/Seen" flag means a message has been read from the way I interpret the
RFC, the "/Recent" flag is what you need to check for "unreadness".

This fixes my problem with imap (in that all new messages were getting
marked as read). To get just this fix all you have to do is replace Seen
for Recent in the imap.rb. The line currently looks like:

labels = { :Seen => :unread,

and it should be

labels = { :Recent => :unread,



Marcus

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: imap-diffs
Url: http://rubyforge.org/pipermail/sup-talk/attachments/20071025/f4d9e120/attachment.pl 


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

end of thread, other threads:[~2007-11-02  1:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <0ae09eda00048831@IMSS-WIN>
2007-10-25 12:35 ` [sup-talk] [PATCH] Fix for imap based sources Marcus Williams
2007-10-25 10:25 Marcus Williams
2007-11-02  0:14 ` Ian Taylor
2007-11-02  1:19   ` Colin Bell

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