Eivind Kvedalen wrote:
first question is, how can i make two differnt instance of Mailbox at
the same time?


You must invoke

mailbox->imapSelect(path)

first to scan the folder (depot.get will only give you an object of the
right Mailbox type) IIRC.

thanks a lot, eivind.


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");
  foo->imapSelect(depot.mailboxToFilename("INBOX/foo"));
  Mailbox::iterator e1 = foo->end();
  for (Mailbox::iterator i1 = foo->begin(); i1 != e1;++i1) {
    Message & message = *i1;
    logger << "INBOX/foo: " << message.getID() << endl;

    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;
    }
  }

i know this sample code doesn't make any sense but thing is, what if i want to manipulate two mailboxes simultaneously.


second one is, how can i make an instance of Message from its `id' when
i know it.


As of today, you can access the messages only by using the Iterator. In
which cases do you know the id first, and have _not_ used the iterator
somehow to get hold of the id? Anyway, I think we should consider making
the get() method public. The Mailbox class contains quite a lot of code
now, and I think we should consider refactoring it (at least the cache
part of the Mailbox class).

i guess i know the id when CopyOerator::process() generates.


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.

the read messages should be taken care as read messages as long as the user does not mark it as unread explicitly.

anyway, how would you hack operator-copy.cc to let COPY behave properly?
isn't it trickier than it might sound, huh?


-- Hiroshima





Reply via email to