FlagsUpdatedImpl flagsUpdated = (FlagsUpdatedImpl) event;
final Mailbox<Id> mailbox = flagsUpdated.getMailbox();
Iterator<UpdatedFlags> flags = flagsUpdated.getUpdatedFlags().iterator();
while(flags.hasNext()) {
UpdatedFlags uFlags = flags.next();
try {
update(session, mailbox, MessageRange.one(uFlags.getUid()), uFlags.getNewFlags());
} catch (MailboxException e) {
session.getLog().debug("Unable to update flags for message " + uFlags.getUid() + " in index for mailbox " + mailbox, e);
}
}
}
} else if (event instanceof MailboxDeletionImpl) {
// delete all indexed messages for the mailbox