[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Important marks don't seem to be synced on IMAP folders



At Tue, 21 Jun 2011 14:27:03 -0400,
Erik Hetzner wrote:
> 
> At Tue, 21 Jun 2011 13:07:04 -0400,
> Erik Hetzner wrote:
> > Hi,
> > 
> > The problem appears to be that calling:
> > 
> >   (elmo-folder-list-flagged folder flag)
> > 
> > merges IMAP4 flags with msgdb flags, which causes a problem with the
> > diffing that happens in wl-summary-sync-marks. Is this expected
> > behavior?
> > 
> > To fix, we can change the definition of wl-summary-sync-marks to call
> > elmo-folder-list-flagged-internal directly, as at then end of this
> > message.
> > 
> > I don’t know if wl-summary-sync-marks is wrong here or if
> > elmo-folder-list-flagged should not be merging flags.
> 
> Hi,
> 
> The function I attached fails on filter folders. I can avoid the
> error, but I cannot make filter folders sync marks properly with IMAP.
> This seems to me an argument that we perhaps need 3 ways of getting
> flags from elmo-folder-list-flagged:
> 
> 1. Merged flags (elmo-folder-list-flagged folder flag)
> 2. msgdb flags only  (elmo-folder-list-flagged folder flag 'in-msgdb)
> 3. Server flags only (elmo-folder-list-flagged folder flag 'on-server)
>    This would be new functionality.
> 
> Any thoughts?

If you flag a message, WL stores the message in a special folder, a
flag folder. This folder type is explained in the manual, 3.13:

----
A folder named ‘'flag’ is a special virtual folder which collects
messages which have global-flag.

There is ‘important’ flag defined as global-flag by default. You can
review important messages at once after you put important marks on
the messages in the different folders. If global-flag is omitted, it
is treated as ‘important’ flag is specified.

In addition, in summary mode, to be described later, you can freely
define global flags and put them on messages. See section Usage
(Tips).

In this folder, if you delete message, global-flag put on the
message is removed. If you append messages to this folder, the
message will have global-flag.
----

For IMAP folders WL additionally pushes the flags of a message to the
server as permanent flags (rfc3501, 2.3.2). If you now open the IMAP
folder and `wl-summary-auto-sync-marks' is set, WL iterates over the
list of registered global flags, searches for messages in the mailbox
with this flag set -- and then adds or overlays the list of messages
with information from the flag folder (the merging behavior).

Benefit of the flag folder: You can conveniently use flags even if the
folder type or the IMAP server does not support (permanent) flags.

Now the problem at hand is, that WL puts messages in the flag folder
but does not remove a message from the flag folder when syncing marks
in Summary.

Overlaying the messages happens in the luna method
`elmo-folder-list-flagged' in elmo.el.


  (luna-define-method elmo-folder-list-flagged ((folder elmo-folder) flag
                                                &optional in-msgdb)
    (let ((msgs (if in-msgdb
                    t
                  (elmo-folder-list-flagged-internal folder flag))))
      (unless (listp msgs)
        (setq msgs (elmo-msgdb-list-flagged (elmo-folder-msgdb folder) flag)))
      (if in-msgdb
          msgs
        (elmo-uniq-list
         (nconc (elmo-folder-list-global-flag-messages folder flag) msgs)
         #'delq))))

Creating the uniq-list is the culprit, at least for IMAP folders
with permanent flags. Problem: At this point we do not know if the
lack of flagged messages in the folder response means that the
folder supports permanent flags but does not contain messages with
the flag -or- the folder does not support flags at all.

What about a customization variable that tells
`elmo-folder-list-flagged' to rather update the flag folder with the
folder information than overlaying?

Best,
  -- David
-- 
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

Attachment: pgpHORyEUqHiA.pgp
Description: PGP signature