Subject: [sup-talk] [PATCH] Fix for imap based sources

From: [email-masked] (Marcus Williams)
Date: Thu, 25 Oct 2007 11:25:39 +0100

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

---

From: [email-masked] (Ian Taylor)
Date: Thu, 01 Nov 2007 20:14:55 -0400

> labels = { :Recent => :unread,

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

---

From: [email-masked] (Colin Bell)
Date: Fri, 02 Nov 2007 12:19:10 +1100

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

Works for me. Thanks