[Dovecot] Re: dovecot-stable branch

Geo Carncross geocar-dovecot at internetconnection.net
Tue Feb 1 20:12:23 EET 2005


On Tue, 2005-02-01 at 19:31 +0200, Timo Sirainen wrote:
> On Tue, 2005-02-01 at 12:00 -0500, Geo Carncross wrote:
> > I wish keywords could be used as a replacement for UIDs that'd never
> > change ( e.g. KEYWORD $MID=989498397.32217.wumpus,S=6013 ), but most
> > IMAP servers don't seem to optimize SEARCH KEYWORD for this.
> 
> I don't think that is a good way to use keywords. Keywords are required
> (I think) to be shown in PERMANENTFLAGS reply and then it would contain
> every message's UID.

Not if \* is listed in PERMANENTFLAGS.

I'm not saying it's the best way to go about this (ANNOTATE is new to me
and certainly looks a lot better)

> Also servers' internal implementations usually treat them as flags which
> are reused between multiple messages. I've tried to make Dovecot's
> implementation so that setting a separate keyword for each message
> wouldn't be too slow or memory hungry, but in index file they're still
> stored in a bitmask, so it uses 4 bytes per 32 keywords for all
> messages.

That's terrible! Fortunately existing clients don't have heavy-use of
keywords... I agree, ANNOTATE certainly seems like the best place for
this.


> ANNOTATE extension is really where this belongs. I'll probably implement
> it at some point, but I don't really know where I'd store them. Perhaps
> I should finally use Berkeley DB for that.. or SQL as alternative.
> Although having some simpler (but slower) choice would be nice too. So I
> guess I'll just use some generic key -> value mapper API which has
> different backends..

SQLite works well- and you'd get it's indexer for free. Separate
backends are fine. I don't entrust my data to Berkeley DB however...


> > I wish keywords could be used as a replacement for folders such that a
> > message could be in multiple folders, but IMAP clients would need a way
> > to fetch all the keywords efficiently. Perhaps just adding them to the
> > PERMANENTFLAGS response would be enough...
> > 
> > Some thought should go into the support of clients that support this
> > kind of behavior, and provide a way to map "folders" and "keywords" in
> > both directions.
> 
> I've recently discussed about this in private mail with a few people.
> Virtual folders implemented with keywords would be a nice idea. Each
> keyword would map to virtual folder under the mailbox.
> 
> "?keyword" would mean the keyword was set automatically by some virtual
> folder rule. It's removed if the rule is changed and doesn't match
> anymore.
> 
> "keyword" means the message was explicitly copied into the virtual
> folder and it's not removed automatically.
> 
> "-keyword" means the message was explicitly moved away from the virtual
> folder and it's not added again automatically by any rule.
> 
> \Deleted + EXPUNGE probably would expunge the message from all virtual
> folders. I'm not sure how the "moving away" would work then.. COPY +
> \Deleted + EXPUNGE sequence somehow should remember that the message was
> wanted to be expunged only from that mailbox.
> 
> I think ?keyword should be shown to client as keyword without the ?
> character and -keywords not at all.

Perhaps reference counting the messages would be adequate. Using
$MDNStatus, ?keyword would be unnecessary, and likewise, -keyword as
well. One could simply use KEYWORD and UNKEYWORD and keep a reference-
count of how many of these vfolder-like keywords are associated with a
message and EXPUNGE can only prune it if \Deleted is set and it's
reference count is Zero (i.e. it's not in INBOX or Archive or another
"real" folder).

Otherwise, setting \Deleted on a message would remove the vfolder
keyword or set the "-xxx" where xxx is the folder that the message
physically exists in.

In this method, Thunderbird would suddenly see Junk and NotJunk folders.
What is done about SUBSCRIBE and UNSUBSCRIBE? Do they always start
unsubscribed? That's certainly easier, but if they start subscribed, is
it really important to "remember" that keyword if all messages have been
removed from that keyword?

A client interested in discerning keywords from folders can do so by
examining PERMANENTFLAGS and the folder list. This causes problems if a
user creates a "Junk" folder themselves- in which case, what does the
Junk keyword refer to?

-- 
Internet Connection High Quality Web Hosting
http://www.internetconnection.net/




More information about the dovecot mailing list