use of com.zimbra.common.mailbox.BaseFolderInfo in project zm-mailbox by Zimbra.
the class ImapListener method handleModify.
protected void handleModify(int changeId, Change chg, AddedItems added) {
if (chg.what instanceof ZimbraTag && (chg.why & Change.NAME) != 0) {
mFolder.handleTagRename(changeId, (ZimbraTag) chg.what, chg);
} else {
boolean isFolder = (chg.what instanceof BaseItemInfo && ((BaseItemInfo) chg.what).getMailItemType() == MailItemType.FOLDER);
boolean isMsgOrContact = false;
BaseItemInfo item = null;
if (chg.what instanceof BaseItemInfo) {
item = (BaseItemInfo) chg.what;
isMsgOrContact = (item.getMailItemType() == MailItemType.MESSAGE || item.getMailItemType() == MailItemType.CONTACT);
}
try {
if (isFolder && ((BaseFolderInfo) chg.what).getFolderIdInOwnerMailbox() == folderId.id) {
FolderStore folder = (FolderStore) chg.what;
// here we assume that the FolderStore object also implements BaseItemInfo
if ((chg.why & Change.FLAGS) != 0 && (((BaseItemInfo) folder).getFlagBitmask() & Flag.BITMASK_DELETED) != 0) {
// mailbox accessed by sending a untagged BYE response."
if (handler != null) {
handler.close();
}
} else if ((chg.why & (Change.FOLDER | Change.NAME)) != 0) {
mFolder.handleFolderRename(changeId, folder, chg);
}
} else if (isMsgOrContact) {
boolean inFolder = mIsVirtual || item.getFolderIdInMailbox() == folderId.id;
if (!inFolder && (chg.why & Change.FOLDER) == 0) {
return;
}
mFolder.handleItemUpdate(changeId, chg, added);
}
} catch (ServiceException e) {
ZimbraLog.imap.warn("error handling modified items for changeId %s", changeId, e);
return;
}
}
}
Aggregations