Hi, Hiroshima, :-)
On Thu, 29 May 2003, HIROSHIMA Naoki wrote:
>actually, that was my first guess but since the following code did not
>work as expected, i thought there must be another way...
> Mailbox* foo = depot.get("INBOX/foo");
That line asks the depot to get a Mailbox * object that matches the type
of INBOX/foo. What you would usually get is either a 0-object or a Maildir
* object.
> foo->imapSelect(depot.mailboxToFilename("INBOX/foo"));
Right - there is some API cluttering here, but that line opens the mailbox
"INBOX/foo" in the Mailbox object you got from the depot.
Now you run through all messages in the INBOX/foo mailbox:
> Mailbox::iterator e1 = foo->end();
> for (Mailbox::iterator i1 = foo->begin(); i1 != e1;++i1) {
> Message & message = *i1;
> logger << "INBOX/foo: " << message.getID() << endl;
Of for each of those, you open and select INBOX/bar and print the ID of
all messages there.
> Mailbox* bar = depot.get("INBOX/bar");
> bar->imapSelect(depot.mailboxToFilename("INBOX/bar"));
> Mailbox::iterator e2 = bar->end();
> for (Mailbox::iterator i2 = bar->begin(); i2 != e2;++i2) {
> Message & message = *i2;
> logger << "INBOX/bar: " << message.getID() << endl;
> }
> }
That code is supposed to work ;-) although it's quite inefficient but I
guess you know that. I'll take a look and see if I can make it work.
>i know this sample code doesn't make any sense but thing is, what if i
>want to manipulate two mailboxes simultaneously.
Sure :)
>well, the thing i wanted to do is to make copied messages have the same
>flags of the originals. right now, binc will copy messages to specified
>folder as new and will not take care of those flags at all, which must
>be wrong behavior.
>if you copy or move a read message to other folder, it will appear as
>unread.
Yes, that is a problem today. The easiest approach I can think of is that
the COPY operator stores the flags on the messages as they are written to
new/ in the Maildir. I have no idea wether this is allowed or not in
Maildir, but if there is no direct indication of this _not_ being allowed
I think we should post to [EMAIL PROTECTED] and see what the gurus say about
it.
Andy :-)
PS: The COPY, FETCH and APPEND operators suffer today from the incomplete
Mailbox/Message design. Hacks to make the flags stuff work are fine, but
the code is likely to change. :-)
--
Andreas Aardal Hanssen | http://www.andreas.hanssen.name/gpg
Author of Binc IMAP | Nil desperandum