I'm implementing tags!

Chuck, Charlie and Charles charles at charlesmcnulty.com
Wed Aug 9 22:07:34 CEST 2006


Joe Auricchio wrote:

> I intend to read tags from, and store them as, IMAP Flags. The result
> should be somewhat interoperable with Thunderbird and Pine. (I've never
> used Pine, so I won't be able to test interop; I'm not a Thunderbird
> user but I have installed it and played with its tagging.)
> 
> Now to the nitty-gritty.
> 
> The plan, so far, is:
> - clean up the way flags are handled in rcube_imap.inc and lib/imap.inc.
> They're up-cased, and "SEEN", "DELETED", etc are magical. I believe a
> better way to do this is to preserve flag case all the way through, and
> use "\Seen", "\Deleted", etc as IMAP does, including the backslash.
> Dealing with the backslash can mean some icky-looking code, but it
> shouldn't be a big problem.
> - add API for working with arbitrary tags. I think I'll start with
> steps/mail/mark.inc. I need to investigate exactly what this file is and
> when it gets called, though.
> - UI for tags. Not sure whether to clone GMail or what. Input would be
> especially appreciated here, I have a little UI-fu but I'm not a designer.
> 
> -joe
> 
> 

Implementing them as IMAP flags certainly sounds interesting.  I think
you'll probably still need a database component though.  IMAP is good at
returning the flags associated with a single message, but I don't know
that it has a method retrieving all flags attached to all the messages
in a folder, for instance.  I would recommend storing the tags in a
table, and using that to populate your various lists of tags, and also
use it as the base for applying tags to messages.

I got pretty far along with a tags implementation myself and then
abandoned it.  I didn't use the IMAP flag capabilities though.  I was
putting them all in the database along with the IMAP Message-ID, and I
was using this library:
http://www.getluky.net/freetag/ which is pretty good.  The javascript I
wrote should still be pretty good, if you'd like to use that as a
jumping off point I can post it here or something.

Basically I got as far as tagging messages and seeing those tags in the
subject (like gmail) but didn't even get started on "virtual folders"
and the like, which of course would be the ultimate goal of such a project.

As far as steps/mail/mark.inc it is used to tag messages as read and
deleted only, but it shouldn't be too hard to modify it to pass in
arbitrary flags.  It's called from within the javascript (app.js) by
running an AJAX call with a certain action which then causes index.php
to literally include() mark.inc  I'm going purely off of memory here and
I remember it being a little confusing at first, but it works.

Would you like to IRC or IM about it sometime?  I'm not free any
evenings this week and I'm out of town this weekend, but I can usually
carve out some of my companies time during the day (8AM-5PM CDT)

-Charles





More information about the Dev mailing list