diff options
50 files changed, 289 insertions, 305 deletions
diff --git a/build-mac/mailcore2.xcodeproj/project.pbxproj b/build-mac/mailcore2.xcodeproj/project.pbxproj index be7f3652..37a955c6 100644 --- a/build-mac/mailcore2.xcodeproj/project.pbxproj +++ b/build-mac/mailcore2.xcodeproj/project.pbxproj @@ -12,9 +12,9 @@ 9E774D8A1767C7F60065EB9B /* MCIMAPFolderStatus.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9E774D881767C7F60065EB9B /* MCIMAPFolderStatus.cc */; }; 9E774D8B1767CD3C0065EB9B /* MCIMAPFolderStatus.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9E774D871767C54E0065EB9B /* MCIMAPFolderStatus.h */; }; 9E774D8C1767CD490065EB9B /* MCIMAPFolderStatus.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9E774D871767C54E0065EB9B /* MCIMAPFolderStatus.h */; }; - 9EF9AB09175F2EC60027FA3B /* MCOIMAPFolderStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EF9AB07175F2EC60027FA3B /* MCOIMAPFolderStatus.m */; }; - 9EF9AB0A175F2EC60027FA3B /* MCOIMAPFolderStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EF9AB07175F2EC60027FA3B /* MCOIMAPFolderStatus.m */; }; - 9EF9AB0B175F2EC60027FA3B /* MCOIMAPFolderStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EF9AB07175F2EC60027FA3B /* MCOIMAPFolderStatus.m */; }; + 9EF9AB09175F2EC60027FA3B /* MCOIMAPFolderStatus.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9EF9AB07175F2EC60027FA3B /* MCOIMAPFolderStatus.mm */; }; + 9EF9AB0A175F2EC60027FA3B /* MCOIMAPFolderStatus.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9EF9AB07175F2EC60027FA3B /* MCOIMAPFolderStatus.mm */; }; + 9EF9AB0B175F2EC60027FA3B /* MCOIMAPFolderStatus.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9EF9AB07175F2EC60027FA3B /* MCOIMAPFolderStatus.mm */; }; 9EF9AB11175F319A0027FA3B /* MCIMAPFolderStatusOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9EF9AB10175F319A0027FA3B /* MCIMAPFolderStatusOperation.cc */; }; 9EF9AB12175F319A0027FA3B /* MCIMAPFolderStatusOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9EF9AB10175F319A0027FA3B /* MCIMAPFolderStatusOperation.cc */; }; 9EF9AB19175F36600027FA3B /* MCOIMAPFolderStatusOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9EF9AB18175F36600027FA3B /* MCOIMAPFolderStatusOperation.mm */; }; @@ -115,7 +115,7 @@ C64EA6FF169E847800778456 /* MCMessageHeader.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64EA69F169E847800778456 /* MCMessageHeader.cc */; }; C64EA701169E847800778456 /* MCAutoreleasePool.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64EA6A2169E847800778456 /* MCAutoreleasePool.cc */; }; C64EA704169E847800778456 /* MCArray.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64EA6A5169E847800778456 /* MCArray.cc */; }; - C64EA706169E847800778456 /* MCAssert.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64EA6A7169E847800778456 /* MCAssert.cc */; }; + C64EA706169E847800778456 /* MCAssert.c in Sources */ = {isa = PBXBuildFile; fileRef = C64EA6A7169E847800778456 /* MCAssert.c */; }; C64EA708169E847800778456 /* MCData.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64EA6A9169E847800778456 /* MCData.cc */; }; C64EA70A169E847800778456 /* MCHash.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64EA6AB169E847800778456 /* MCHash.cc */; }; C64EA70C169E847800778456 /* MCHashMap.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64EA6AD169E847800778456 /* MCHashMap.cc */; }; @@ -435,7 +435,7 @@ C6BA2B9E1705F4E6003F0E9E /* MCMessageHeader.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64EA69F169E847800778456 /* MCMessageHeader.cc */; }; C6BA2B9F1705F4E6003F0E9E /* MCAutoreleasePool.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64EA6A2169E847800778456 /* MCAutoreleasePool.cc */; }; C6BA2BA01705F4E6003F0E9E /* MCArray.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64EA6A5169E847800778456 /* MCArray.cc */; }; - C6BA2BA11705F4E6003F0E9E /* MCAssert.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64EA6A7169E847800778456 /* MCAssert.cc */; }; + C6BA2BA11705F4E6003F0E9E /* MCAssert.c in Sources */ = {isa = PBXBuildFile; fileRef = C64EA6A7169E847800778456 /* MCAssert.c */; }; C6BA2BA21705F4E6003F0E9E /* MCData.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64EA6A9169E847800778456 /* MCData.cc */; }; C6BA2BA31705F4E6003F0E9E /* MCHash.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64EA6AB169E847800778456 /* MCHash.cc */; }; C6BA2BA41705F4E6003F0E9E /* MCHashMap.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64EA6AD169E847800778456 /* MCHashMap.cc */; }; @@ -1064,7 +1064,7 @@ 9E774D871767C54E0065EB9B /* MCIMAPFolderStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCIMAPFolderStatus.h; sourceTree = "<group>"; }; 9E774D881767C7F60065EB9B /* MCIMAPFolderStatus.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCIMAPFolderStatus.cc; sourceTree = "<group>"; }; 9EF9AB06175F2EC60027FA3B /* MCOIMAPFolderStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCOIMAPFolderStatus.h; sourceTree = "<group>"; }; - 9EF9AB07175F2EC60027FA3B /* MCOIMAPFolderStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MCOIMAPFolderStatus.m; sourceTree = "<group>"; }; + 9EF9AB07175F2EC60027FA3B /* MCOIMAPFolderStatus.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCOIMAPFolderStatus.mm; sourceTree = "<group>"; }; 9EF9AB0E175F30C20027FA3B /* MCIMAPFolderStatusOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCIMAPFolderStatusOperation.h; sourceTree = "<group>"; }; 9EF9AB10175F319A0027FA3B /* MCIMAPFolderStatusOperation.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCIMAPFolderStatusOperation.cc; sourceTree = "<group>"; }; 9EF9AB16175F35C60027FA3B /* MCOIMAPFolderStatusOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCOIMAPFolderStatusOperation.h; sourceTree = "<group>"; }; @@ -1176,7 +1176,7 @@ C64EA6A4169E847800778456 /* MCBaseTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCBaseTypes.h; sourceTree = "<group>"; }; C64EA6A5169E847800778456 /* MCArray.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCArray.cc; sourceTree = "<group>"; }; C64EA6A6169E847800778456 /* MCArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCArray.h; sourceTree = "<group>"; }; - C64EA6A7169E847800778456 /* MCAssert.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCAssert.cc; sourceTree = "<group>"; }; + C64EA6A7169E847800778456 /* MCAssert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = MCAssert.c; sourceTree = "<group>"; }; C64EA6A8169E847800778456 /* MCAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCAssert.h; sourceTree = "<group>"; }; C64EA6A9169E847800778456 /* MCData.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCData.cc; sourceTree = "<group>"; }; C64EA6AA169E847800778456 /* MCData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCData.h; sourceTree = "<group>"; }; @@ -1667,8 +1667,8 @@ C62C6ED716A398FA00737497 /* MCIMAPFolderInfoOperation.h */, C64BB22916E5C0A3000DB34C /* MCIMAPCapabilityOperation.cc */, C64BB22A16E5C0A3000DB34C /* MCIMAPCapabilityOperation.h */, - 9EF9AB0E175F30C20027FA3B /* MCIMAPFolderStatusOperation.h */, 9EF9AB10175F319A0027FA3B /* MCIMAPFolderStatusOperation.cc */, + 9EF9AB0E175F30C20027FA3B /* MCIMAPFolderStatusOperation.h */, ); path = imap; sourceTree = "<group>"; @@ -1759,7 +1759,7 @@ C64EA6A4169E847800778456 /* MCBaseTypes.h */, C64EA6A5169E847800778456 /* MCArray.cc */, C64EA6A6169E847800778456 /* MCArray.h */, - C64EA6A7169E847800778456 /* MCAssert.cc */, + C64EA6A7169E847800778456 /* MCAssert.c */, C64EA6A8169E847800778456 /* MCAssert.h */, C64EA6A9169E847800778456 /* MCData.cc */, C64EA6AA169E847800778456 /* MCData.h */, @@ -2071,7 +2071,7 @@ C6F61F9717016B460073032E /* MCOIMAPSearchExpression.h */, C6F61F9817016B460073032E /* MCOIMAPSearchExpression.mm */, 9EF9AB06175F2EC60027FA3B /* MCOIMAPFolderStatus.h */, - 9EF9AB07175F2EC60027FA3B /* MCOIMAPFolderStatus.m */, + 9EF9AB07175F2EC60027FA3B /* MCOIMAPFolderStatus.mm */, 9EF9AB16175F35C60027FA3B /* MCOIMAPFolderStatusOperation.h */, 9EF9AB18175F36600027FA3B /* MCOIMAPFolderStatusOperation.mm */, ); @@ -2303,7 +2303,7 @@ C64EA6FF169E847800778456 /* MCMessageHeader.cc in Sources */, C64EA701169E847800778456 /* MCAutoreleasePool.cc in Sources */, C64EA704169E847800778456 /* MCArray.cc in Sources */, - C64EA706169E847800778456 /* MCAssert.cc in Sources */, + C64EA706169E847800778456 /* MCAssert.c in Sources */, C64EA708169E847800778456 /* MCData.cc in Sources */, C64EA70A169E847800778456 /* MCHash.cc in Sources */, C64EA70C169E847800778456 /* MCHashMap.cc in Sources */, @@ -2441,7 +2441,7 @@ C6CF62C6175324F0006398B9 /* MCMailProvider.cc in Sources */, C6CF62C8175324F0006398B9 /* MCMailProvidersManager.cc in Sources */, C6CF62CA175324F0006398B9 /* MCNetService.cc in Sources */, - 9EF9AB09175F2EC60027FA3B /* MCOIMAPFolderStatus.m in Sources */, + 9EF9AB09175F2EC60027FA3B /* MCOIMAPFolderStatus.mm in Sources */, 9EF9AB11175F319A0027FA3B /* MCIMAPFolderStatusOperation.cc in Sources */, 9EF9AB19175F36600027FA3B /* MCOIMAPFolderStatusOperation.mm in Sources */, 9E774D891767C7F60065EB9B /* MCIMAPFolderStatus.cc in Sources */, @@ -2454,7 +2454,7 @@ files = ( C64EA7AB16A00AF600778456 /* main.mm in Sources */, C6A81BAF170684D300882C15 /* test-all.mm in Sources */, - 9EF9AB0B175F2EC60027FA3B /* MCOIMAPFolderStatus.m in Sources */, + 9EF9AB0B175F2EC60027FA3B /* MCOIMAPFolderStatus.mm in Sources */, 9EF9AB1B175F36600027FA3B /* MCOIMAPFolderStatusOperation.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2481,7 +2481,7 @@ C6BA2B9E1705F4E6003F0E9E /* MCMessageHeader.cc in Sources */, C6BA2B9F1705F4E6003F0E9E /* MCAutoreleasePool.cc in Sources */, C6BA2BA01705F4E6003F0E9E /* MCArray.cc in Sources */, - C6BA2BA11705F4E6003F0E9E /* MCAssert.cc in Sources */, + C6BA2BA11705F4E6003F0E9E /* MCAssert.c in Sources */, C6BA2BA21705F4E6003F0E9E /* MCData.cc in Sources */, C6BA2BA31705F4E6003F0E9E /* MCHash.cc in Sources */, C6BA2BA41705F4E6003F0E9E /* MCHashMap.cc in Sources */, @@ -2619,7 +2619,7 @@ C6CF62C7175324F0006398B9 /* MCMailProvider.cc in Sources */, C6CF62C9175324F0006398B9 /* MCMailProvidersManager.cc in Sources */, C6CF62CB175324F0006398B9 /* MCNetService.cc in Sources */, - 9EF9AB0A175F2EC60027FA3B /* MCOIMAPFolderStatus.m in Sources */, + 9EF9AB0A175F2EC60027FA3B /* MCOIMAPFolderStatus.mm in Sources */, 9EF9AB12175F319A0027FA3B /* MCIMAPFolderStatusOperation.cc in Sources */, 9EF9AB1A175F36600027FA3B /* MCOIMAPFolderStatusOperation.mm in Sources */, 9E774D8A1767C7F60065EB9B /* MCIMAPFolderStatus.cc in Sources */, diff --git a/example/ios/iOS UI Test/iOS UI Test/MCTMsgViewController.mm b/example/ios/iOS UI Test/iOS UI Test/MCTMsgViewController.mm index dd2b36ee..ca3aecfc 100755 --- a/example/ios/iOS UI Test/iOS UI Test/MCTMsgViewController.mm +++ b/example/ios/iOS UI Test/iOS UI Test/MCTMsgViewController.mm @@ -91,7 +91,7 @@ MCLog("%s is missing, fetching", partUniqueID.description.UTF8String); if ([_pending containsObject:partUniqueID]) { - return NULL; + return nil; } MCOIMAPPart * part = (MCOIMAPPart *) [_message partForUniqueID:partUniqueID]; @@ -205,7 +205,9 @@ typedef void (^DownloadCallback)(NSError * error); [op setProgress:^(unsigned int current, unsigned int maximum) { MCLog("progress content: %u/%u", current, maximum); }]; - [_ops addObject:op]; + if (op != nil) { + [_ops addObject:op]; + } if (downloadFinished != NULL) { NSMutableArray * blocks; blocks = [_callbacks objectForKey:partUniqueID]; diff --git a/example/mac/macExample/macExample/MCTMsgViewController.m b/example/mac/macExample/macExample/MCTMsgViewController.m index dcb6f41c..f26b783f 100644 --- a/example/mac/macExample/macExample/MCTMsgViewController.m +++ b/example/mac/macExample/macExample/MCTMsgViewController.m @@ -76,7 +76,7 @@ NSLog(@"%@ is missing, fetching", partUniqueID); if ([_pending containsObject:partUniqueID]) { - return NULL; + return nil; } MCOIMAPPart * part = (MCOIMAPPart *) [_message partForUniqueID:partUniqueID]; diff --git a/src/async/imap/MCIMAPFetchFoldersOperation.h b/src/async/imap/MCIMAPFetchFoldersOperation.h index ebc49ca8..c59bf85a 100644 --- a/src/async/imap/MCIMAPFetchFoldersOperation.h +++ b/src/async/imap/MCIMAPFetchFoldersOperation.h @@ -32,7 +32,7 @@ namespace mailcore { virtual void main(); private: - String * mFolder; + String * /* IMAPFolder */ mFolder; bool mFetchSubscribedEnabled; Array * mFolders; void setDelimiterDataOnMainThread(char * delimiterData); diff --git a/src/async/imap/MCIMAPFetchMessagesOperation.h b/src/async/imap/MCIMAPFetchMessagesOperation.h index c719ef6a..64f75bbf 100644 --- a/src/async/imap/MCIMAPFetchMessagesOperation.h +++ b/src/async/imap/MCIMAPFetchMessagesOperation.h @@ -44,7 +44,7 @@ namespace mailcore { bool mFetchByUidEnabled; IndexSet * mIndexes; IMAPMessagesRequestKind mKind; - Array * mMessages; + Array * /* IMAPMessage */ mMessages; IndexSet * mVanishedMessages; uint64_t mModSequenceValue; diff --git a/src/async/imap/MCIMAPFolderStatusOperation.cc b/src/async/imap/MCIMAPFolderStatusOperation.cc index 89484624..0ca7d884 100644 --- a/src/async/imap/MCIMAPFolderStatusOperation.cc +++ b/src/async/imap/MCIMAPFolderStatusOperation.cc @@ -16,40 +16,12 @@ using namespace mailcore; IMAPFolderStatusOperation::IMAPFolderStatusOperation() { - mUidNext = 0; - mUidValidity = 0; - mMessageCount = 0; - mRecentCount = 0; - mUnseenCount = 0; + mStatus = NULL; } IMAPFolderStatusOperation::~IMAPFolderStatusOperation() { -} - -uint32_t IMAPFolderStatusOperation::uidNext() -{ - return mUidNext; -} - -uint32_t IMAPFolderStatusOperation::uidValidity() -{ - return mUidValidity; -} - -uint32_t IMAPFolderStatusOperation::messageCount() -{ - return mMessageCount; -} - -uint32_t IMAPFolderStatusOperation::recentCount() -{ - return mRecentCount; -} - -uint32_t IMAPFolderStatusOperation::unseenCount() -{ - return mUnseenCount; + MC_SAFE_RELEASE(mStatus); } void IMAPFolderStatusOperation::main() @@ -68,13 +40,12 @@ void IMAPFolderStatusOperation::main() return; } - - mUidNext = status->uidNext(); - mUidValidity = status->uidValidity(); - mMessageCount = status->messageCount(); - mRecentCount = status->recentCount(); - mUnseenCount = status->unseenCount(); - + MC_SAFE_REPLACE_RETAIN(IMAPFolderStatus, mStatus, status); setError(error); } +IMAPFolderStatus * IMAPFolderStatusOperation::status() +{ + return mStatus; +} + diff --git a/src/async/imap/MCIMAPFolderStatusOperation.h b/src/async/imap/MCIMAPFolderStatusOperation.h index 71811ca7..d8c30fea 100644 --- a/src/async/imap/MCIMAPFolderStatusOperation.h +++ b/src/async/imap/MCIMAPFolderStatusOperation.h @@ -17,27 +17,21 @@ namespace mailcore { + class IMAPFolderStatus; + class IMAPFolderStatusOperation : public IMAPOperation { public: IMAPFolderStatusOperation(); virtual ~IMAPFolderStatusOperation(); - virtual uint32_t uidNext(); - virtual uint32_t uidValidity(); - virtual uint32_t messageCount(); - virtual uint32_t recentCount(); - virtual uint32_t unseenCount(); + // Results. + virtual IMAPFolderStatus * status(); public: // subclass behavior virtual void main(); private: - - uint32_t mUidNext; - uint32_t mUidValidity; - uint32_t mMessageCount; - uint32_t mRecentCount; - uint32_t mUnseenCount; + IMAPFolderStatus * mStatus; }; } diff --git a/src/async/imap/MCIMAPIdleOperation.h b/src/async/imap/MCIMAPIdleOperation.h index de19469a..32ed0877 100644 --- a/src/async/imap/MCIMAPIdleOperation.h +++ b/src/async/imap/MCIMAPIdleOperation.h @@ -31,7 +31,7 @@ namespace mailcore { private: uint32_t mLastKnownUid; - bool mSetupSuccess; + bool mSetupSuccess; void prepare(); void unprepare(); }; diff --git a/src/async/imap/MCIMAPStoreLabelsOperation.h b/src/async/imap/MCIMAPStoreLabelsOperation.h index fea31fd8..117a0a83 100644 --- a/src/async/imap/MCIMAPStoreLabelsOperation.h +++ b/src/async/imap/MCIMAPStoreLabelsOperation.h @@ -27,8 +27,8 @@ namespace mailcore { virtual void setKind(IMAPStoreFlagsRequestKind kind); virtual IMAPStoreFlagsRequestKind kind(); - virtual void setLabels(Array * labels); - virtual Array * labels(); + virtual void setLabels(Array * /* String */ labels); + virtual Array * /* String */ labels(); public: // subclass behavior virtual void main(); @@ -36,7 +36,7 @@ namespace mailcore { private: IndexSet * mUids; IMAPStoreFlagsRequestKind mKind; - Array * mLabels; + Array * /* String */ mLabels; }; } diff --git a/src/async/pop/MCPOPAsyncSession.cc b/src/async/pop/MCPOPAsyncSession.cc index 2cdbd225..39f356db 100644 --- a/src/async/pop/MCPOPAsyncSession.cc +++ b/src/async/pop/MCPOPAsyncSession.cc @@ -144,6 +144,11 @@ POPOperation * POPAsyncSession::deleteMessagesOperation(IndexSet * indexes) return op; } +POPOperation * POPAsyncSession::disconnectOperation() +{ + return deleteMessagesOperation(IndexSet::indexSet()); +} + POPOperation * POPAsyncSession::checkAccountOperation() { POPCheckAccountOperation * op = new POPCheckAccountOperation(); diff --git a/src/async/pop/MCPOPAsyncSession.h b/src/async/pop/MCPOPAsyncSession.h index f05b98b5..166675e0 100644 --- a/src/async/pop/MCPOPAsyncSession.h +++ b/src/async/pop/MCPOPAsyncSession.h @@ -52,7 +52,7 @@ namespace mailcore { virtual void setCheckCertificateEnabled(bool enabled); virtual bool isCheckCertificateEnabled(); - virtual POPFetchMessagesOperation * fetchMessagesOperation(); + virtual POPFetchMessagesOperation * fetchMessagesOperation(); virtual POPFetchHeaderOperation * fetchHeaderOperation(unsigned int index); @@ -61,6 +61,8 @@ namespace mailcore { // Will disconnect. virtual POPOperation * deleteMessagesOperation(IndexSet * indexes); + virtual POPOperation * disconnectOperation(); + virtual POPOperation * checkAccountOperation(); private: diff --git a/src/async/pop/MCPOPFetchMessagesOperation.h b/src/async/pop/MCPOPFetchMessagesOperation.h index e9d68014..74c97d4d 100644 --- a/src/async/pop/MCPOPFetchMessagesOperation.h +++ b/src/async/pop/MCPOPFetchMessagesOperation.h @@ -26,7 +26,7 @@ namespace mailcore { virtual void main(); private: - Array * mMessages; + Array * /* POPMessageInfo */ mMessages; }; } diff --git a/src/core/abstract/MCAbstractMessage.h b/src/core/abstract/MCAbstractMessage.h index 49c4805b..d7384b36 100644 --- a/src/core/abstract/MCAbstractMessage.h +++ b/src/core/abstract/MCAbstractMessage.h @@ -21,8 +21,8 @@ namespace mailcore { virtual AbstractPart * partForContentID(String * contentID); virtual AbstractPart * partForUniqueID(String * uniqueID); - virtual Array * attachments(); - virtual Array * htmlInlineAttachments(); + virtual Array * /* AbstractPart */ attachments(); + virtual Array * /* AbstractPart */ htmlInlineAttachments(); public: //subclass behavior AbstractMessage(AbstractMessage * other); diff --git a/src/core/abstract/MCAbstractMessagePart.cc b/src/core/abstract/MCAbstractMessagePart.cc index 649fcc32..d2cb232e 100644 --- a/src/core/abstract/MCAbstractMessagePart.cc +++ b/src/core/abstract/MCAbstractMessagePart.cc @@ -66,21 +66,6 @@ AbstractPart * AbstractMessagePart::mainPart() void AbstractMessagePart::setMainPart(AbstractPart * mainPart) { MC_SAFE_REPLACE_RETAIN(AbstractPart, mMainPart, mainPart); - applyMessage(); -} - -void AbstractMessagePart::applyMessage() -{ - if (mMainPart == NULL) - return; - - mMainPart->setMessage(message()); -} - -void AbstractMessagePart::setMessage(AbstractMessage * message) -{ - AbstractPart::setMessage(message); - applyMessage(); } AbstractPart * AbstractMessagePart::partForContentID(String * contentID) diff --git a/src/core/abstract/MCAbstractMessagePart.h b/src/core/abstract/MCAbstractMessagePart.h index 1ff1def6..bd2ac4e0 100644 --- a/src/core/abstract/MCAbstractMessagePart.h +++ b/src/core/abstract/MCAbstractMessagePart.h @@ -27,8 +27,6 @@ namespace mailcore { virtual String * description(); virtual Object * copy(); - virtual void setMessage(AbstractMessage * message); - virtual AbstractPart * partForContentID(String * contentID); virtual AbstractPart * partForUniqueID(String * uniqueID); @@ -36,7 +34,6 @@ namespace mailcore { AbstractPart * mMainPart; MessageHeader * mHeader; void init(); - void applyMessage(); }; } diff --git a/src/core/abstract/MCAbstractMultipart.cc b/src/core/abstract/MCAbstractMultipart.cc index 7a2f551e..d70b2974 100644 --- a/src/core/abstract/MCAbstractMultipart.cc +++ b/src/core/abstract/MCAbstractMultipart.cc @@ -39,7 +39,6 @@ Array * AbstractMultipart::parts() void AbstractMultipart::setParts(Array * parts) { MC_SAFE_REPLACE_COPY(Array, mParts, parts); - applyMessage(); } String * AbstractMultipart::description() @@ -70,23 +69,6 @@ Object * AbstractMultipart::copy() return new AbstractMultipart(this); } -void AbstractMultipart::applyMessage() -{ - if (mParts == NULL) - return; - - for(unsigned int i = 0 ; i < mParts->count() ; i ++) { - AbstractPart * part = (AbstractPart *) mParts->objectAtIndex(i); - part->setMessage(message()); - } -} - -void AbstractMultipart::setMessage(AbstractMessage * message) -{ - AbstractPart::setMessage(message); - applyMessage(); -} - AbstractPart * AbstractMultipart::partForContentID(String * contentID) { for(unsigned int i = 0 ; i < parts()->count() ; i ++) { diff --git a/src/core/abstract/MCAbstractMultipart.h b/src/core/abstract/MCAbstractMultipart.h index da77f9a6..11d33666 100644 --- a/src/core/abstract/MCAbstractMultipart.h +++ b/src/core/abstract/MCAbstractMultipart.h @@ -22,14 +22,12 @@ namespace mailcore { virtual String * description(); virtual Object * copy(); - virtual void setMessage(AbstractMessage * message); virtual AbstractPart * partForContentID(String * contentID); virtual AbstractPart * partForUniqueID(String * uniqueID); private: Array * mParts; void init(); - void applyMessage(); }; } diff --git a/src/core/abstract/MCAbstractPart.cc b/src/core/abstract/MCAbstractPart.cc index a1cf57b0..6991e5fc 100644 --- a/src/core/abstract/MCAbstractPart.cc +++ b/src/core/abstract/MCAbstractPart.cc @@ -160,16 +160,6 @@ void AbstractPart::setInlineAttachment(bool inlineAttachment) mInlineAttachment = inlineAttachment; } -AbstractMessage * AbstractPart::message() -{ - return mMessage; -} - -void AbstractPart::setMessage(AbstractMessage * message) -{ - mMessage = message; -} - void AbstractPart::importIMAPFields(struct mailimap_body_fields * fields, struct mailimap_body_ext_1part * extension) { diff --git a/src/core/abstract/MCAbstractPart.h b/src/core/abstract/MCAbstractPart.h index fe8a57d5..b38c1b38 100644 --- a/src/core/abstract/MCAbstractPart.h +++ b/src/core/abstract/MCAbstractPart.h @@ -40,9 +40,6 @@ namespace mailcore { virtual bool isInlineAttachment(); virtual void setInlineAttachment(bool inlineAttachment); - virtual AbstractMessage * message(); - virtual void setMessage(AbstractMessage * message); - virtual AbstractPart * partForContentID(String * contentID); virtual AbstractPart * partForUniqueID(String * uniqueID); @@ -67,7 +64,6 @@ namespace mailcore { String * mContentLocation; bool mInlineAttachment; PartType mPartType; - AbstractMessage * mMessage; // weak void init(); }; diff --git a/src/core/abstract/MCMessageHeader.h b/src/core/abstract/MCMessageHeader.h index 3e481db3..f90c1c2d 100644 --- a/src/core/abstract/MCMessageHeader.h +++ b/src/core/abstract/MCMessageHeader.h @@ -19,11 +19,11 @@ namespace mailcore { virtual void setMessageID(String * messageID); virtual String * messageID(); - virtual void setReferences(Array * references); - virtual Array * references(); + virtual void setReferences(Array * /* String */ references); + virtual Array * /* String */ references(); - virtual void setInReplyTo(Array * inReplyTo); - virtual Array * inReplyTo(); + virtual void setInReplyTo(Array * /* String */ inReplyTo); + virtual Array * /* String */ inReplyTo(); virtual void setDate(time_t date); virtual time_t date(); @@ -37,17 +37,17 @@ namespace mailcore { virtual void setFrom(Address * from); virtual Address * from(); - virtual void setTo(Array * to); - virtual Array * to(); + virtual void setTo(Array * /* Address */ to); + virtual Array * /* Address */ to(); - virtual void setCc(Array * cc); - virtual Array * cc(); + virtual void setCc(Array * /* Address */ cc); + virtual Array * /* Address */ cc(); - virtual void setBcc(Array * bcc); - virtual Array * bcc(); + virtual void setBcc(Array * /* Address */ bcc); + virtual Array * /* Address */ bcc(); - virtual void setReplyTo(Array * replyTo); - virtual Array * replyTo(); + virtual void setReplyTo(Array * /* Address */ replyTo); + virtual Array * /* Address */ replyTo(); virtual void setSubject(String * subject); virtual String * subject(); diff --git a/src/core/basetypes/MCAssert.cc b/src/core/basetypes/MCAssert.c index 82b5de26..ce9b5703 100644 --- a/src/core/basetypes/MCAssert.cc +++ b/src/core/basetypes/MCAssert.c @@ -3,7 +3,7 @@ #include <stdio.h> #include <stdlib.h> -void mailcore::assertInteral(const char * filename, unsigned int line, int cond, const char * condString) +void MCAssertInternal(const char * filename, unsigned int line, int cond, const char * condString) { if (cond) { return; diff --git a/src/core/basetypes/MCAssert.h b/src/core/basetypes/MCAssert.h index f2e1f484..54979d64 100644 --- a/src/core/basetypes/MCAssert.h +++ b/src/core/basetypes/MCAssert.h @@ -2,16 +2,14 @@ #define __MAILCORE_MCASSERT_H_ -#ifdef __cplusplus - -#define MCAssert(cond) mailcore::assertInteral(__FILE__, __LINE__, cond, #cond) - -namespace mailcore { +#define MCAssert(cond) MCAssertInternal(__FILE__, __LINE__, cond, #cond) - void assertInteral(const char * filename, unsigned int line, int cond, const char * condString); - +#ifdef __cplusplus +extern "C" { +#endif + void MCAssertInternal(const char * filename, unsigned int line, int cond, const char * condString); +#ifdef __cplusplus } - #endif #endif diff --git a/src/core/imap/MCIMAPFolderStatus.cc b/src/core/imap/MCIMAPFolderStatus.cc index 7b6a8bbd..d2cb2281 100644 --- a/src/core/imap/MCIMAPFolderStatus.cc +++ b/src/core/imap/MCIMAPFolderStatus.cc @@ -17,6 +17,7 @@ void IMAPFolderStatus::init() mRecentCount = 0; mUidNext = 0; mUidValidity = 0; + mHighestModSeqValue = 0; } IMAPFolderStatus::IMAPFolderStatus() @@ -32,63 +33,90 @@ IMAPFolderStatus::IMAPFolderStatus(IMAPFolderStatus * other) setMessageCount(other->messageCount()); setRecentCount(other->recentCount()); setUidNext(other->uidNext()); - setUidValidity(other->uidValidity()); + setUidValidity(other->uidValidity()); + setHighestModSeqValue(other->highestModSeqValue()); } IMAPFolderStatus::~IMAPFolderStatus() -{ } +{ +} Object * IMAPFolderStatus::copy() { return new IMAPFolderStatus(this); } -void IMAPFolderStatus::setUnseenCount(u_int32_t unseen) +void IMAPFolderStatus::setUnseenCount(uint32_t unseen) { mUnseenCount = unseen; } -u_int32_t IMAPFolderStatus::unseenCount() +uint32_t IMAPFolderStatus::unseenCount() { return mUnseenCount; } -void IMAPFolderStatus::setMessageCount(u_int32_t messages) +void IMAPFolderStatus::setMessageCount(uint32_t messages) { mMessageCount = messages; } -u_int32_t IMAPFolderStatus::messageCount() +uint32_t IMAPFolderStatus::messageCount() { return mMessageCount; } -void IMAPFolderStatus::setRecentCount(u_int32_t recent) +void IMAPFolderStatus::setRecentCount(uint32_t recent) { mRecentCount = recent; } -u_int32_t IMAPFolderStatus::recentCount() +uint32_t IMAPFolderStatus::recentCount() { return mRecentCount; } -void IMAPFolderStatus::setUidNext(u_int32_t uidNext) +void IMAPFolderStatus::setUidNext(uint32_t uidNext) { mUidNext = uidNext; } -u_int32_t IMAPFolderStatus::uidNext() +uint32_t IMAPFolderStatus::uidNext() { return mUidNext; } -void IMAPFolderStatus::setUidValidity(u_int32_t uidValidity) +void IMAPFolderStatus::setUidValidity(uint32_t uidValidity) { mUidValidity = uidValidity; } -u_int32_t IMAPFolderStatus::uidValidity() +uint32_t IMAPFolderStatus::uidValidity() { return mUidValidity; } + +void IMAPFolderStatus::setHighestModSeqValue(uint64_t highestModSeqValue) +{ + mHighestModSeqValue = highestModSeqValue; +} + +uint64_t IMAPFolderStatus::highestModSeqValue() +{ + return mHighestModSeqValue; +} + +String * IMAPFolderStatus::description() +{ + String * result = String::string(); + result->appendUTF8Format("<%s:%p msg_count: %u, unseen_count: %u, recent_count: %u, uid_next: %u, uid_validity: %u, highestmodseqvalue :%llu>", + className()->UTF8Characters(), + this, + (unsigned int) messageCount(), + (unsigned int) unseenCount(), + (unsigned int) recentCount(), + (unsigned int) uidNext(), + (unsigned int) uidValidity(), + (unsigned long long) highestModSeqValue()); + return result; +} diff --git a/src/core/imap/MCIMAPFolderStatus.h b/src/core/imap/MCIMAPFolderStatus.h index 818cd790..5a6dbac2 100644 --- a/src/core/imap/MCIMAPFolderStatus.h +++ b/src/core/imap/MCIMAPFolderStatus.h @@ -23,31 +23,36 @@ namespace mailcore { IMAPFolderStatus(); virtual ~IMAPFolderStatus(); - virtual void setUnseenCount(u_int32_t unseen); - virtual u_int32_t unseenCount(); + virtual void setUnseenCount(uint32_t unseen); + virtual uint32_t unseenCount(); - virtual void setMessageCount(u_int32_t messages); - virtual u_int32_t messageCount(); + virtual void setMessageCount(uint32_t messages); + virtual uint32_t messageCount(); - virtual void setRecentCount(u_int32_t recent); - virtual u_int32_t recentCount(); + virtual void setRecentCount(uint32_t recent); + virtual uint32_t recentCount(); - virtual void setUidNext(u_int32_t uidNext); - virtual u_int32_t uidNext(); + virtual void setUidNext(uint32_t uidNext); + virtual uint32_t uidNext(); - virtual void setUidValidity(u_int32_t uidValidity); - virtual u_int32_t uidValidity(); + virtual void setUidValidity(uint32_t uidValidity); + virtual uint32_t uidValidity(); + + virtual void setHighestModSeqValue(uint64_t highestModSeqValue); + virtual uint64_t highestModSeqValue(); public: // subclass behavior IMAPFolderStatus(IMAPFolderStatus * other); virtual Object * copy(); + virtual String * description(); private: - u_int32_t mUnseenCount; - u_int32_t mMessageCount; - u_int32_t mRecentCount; - u_int32_t mUidNext; - u_int32_t mUidValidity; + uint32_t mUnseenCount; + uint32_t mMessageCount; + uint32_t mRecentCount; + uint32_t mUidNext; + uint32_t mUidValidity; + uint64_t mHighestModSeqValue; void init(); }; diff --git a/src/core/imap/MCIMAPMessage.h b/src/core/imap/MCIMAPMessage.h index 5bc5f843..5a9cadcb 100644 --- a/src/core/imap/MCIMAPMessage.h +++ b/src/core/imap/MCIMAPMessage.h @@ -35,8 +35,8 @@ namespace mailcore { virtual void setMainPart(AbstractPart * mainPart); virtual AbstractPart * mainPart(); - virtual void setGmailLabels(Array * labels); - virtual Array * gmailLabels(); + virtual void setGmailLabels(Array * /* String */ labels); + virtual Array * /* String */ gmailLabels(); virtual AbstractPart * partForPartID(String * partID); @@ -58,7 +58,7 @@ namespace mailcore { MessageFlag mFlags; MessageFlag mOriginalFlags; AbstractPart * mMainPart; - Array * mLabels; + Array * /* String */ mLabels; void init(); }; diff --git a/src/core/imap/MCIMAPNamespace.h b/src/core/imap/MCIMAPNamespace.h index 09c029e2..4ce0b546 100644 --- a/src/core/imap/MCIMAPNamespace.h +++ b/src/core/imap/MCIMAPNamespace.h @@ -18,12 +18,12 @@ namespace mailcore { virtual String * mainPrefix(); virtual char mainDelimiter(); - virtual Array * prefixes(); + virtual Array * /* String */ prefixes(); virtual String * pathForComponents(Array * components); virtual String * pathForComponentsAndPrefix(Array * components, String * prefix); - virtual Array * componentsFromPath(String * path); + virtual Array * /* String */ componentsFromPath(String * path); virtual bool containsFolderPath(String * path); @@ -35,7 +35,7 @@ namespace mailcore { virtual Object * copy(); private: - Array * mItems; + Array * /* String */ mItems; void init(); IMAPNamespaceItem * mainItem(); IMAPNamespaceItem * itemForPath(String * path); diff --git a/src/core/imap/MCIMAPNamespaceItem.h b/src/core/imap/MCIMAPNamespaceItem.h index 4cee0aea..8ab094cc 100644 --- a/src/core/imap/MCIMAPNamespaceItem.h +++ b/src/core/imap/MCIMAPNamespaceItem.h @@ -20,7 +20,7 @@ namespace mailcore { virtual char delimiter(); virtual String * pathForComponents(Array * components); - virtual Array * componentsForPath(String * path); + virtual Array * /* String */ componentsForPath(String * path); virtual bool containsFolder(String * folder); diff --git a/src/core/imap/MCIMAPSession.cc b/src/core/imap/MCIMAPSession.cc index cdbe6004..52e819d9 100644 --- a/src/core/imap/MCIMAPSession.cc +++ b/src/core/imap/MCIMAPSession.cc @@ -881,11 +881,14 @@ IMAPFolderStatus * IMAPSession::folderStatus(String * folder, ErrorCode * pError struct mailimap_status_att_list * status_att_list; status_att_list = mailimap_status_att_list_new_empty(); - mailimap_status_att_list_add(status_att_list,MAILIMAP_STATUS_ATT_UNSEEN); - mailimap_status_att_list_add(status_att_list,MAILIMAP_STATUS_ATT_MESSAGES); - mailimap_status_att_list_add(status_att_list,MAILIMAP_STATUS_ATT_RECENT); - mailimap_status_att_list_add(status_att_list,MAILIMAP_STATUS_ATT_UIDNEXT); - mailimap_status_att_list_add(status_att_list,MAILIMAP_STATUS_ATT_UIDVALIDITY); + mailimap_status_att_list_add(status_att_list, MAILIMAP_STATUS_ATT_UNSEEN); + mailimap_status_att_list_add(status_att_list, MAILIMAP_STATUS_ATT_MESSAGES); + mailimap_status_att_list_add(status_att_list, MAILIMAP_STATUS_ATT_RECENT); + mailimap_status_att_list_add(status_att_list, MAILIMAP_STATUS_ATT_UIDNEXT); + mailimap_status_att_list_add(status_att_list, MAILIMAP_STATUS_ATT_UIDVALIDITY); + if (mCondstoreEnabled) { + mailimap_status_att_list_add(status_att_list, MAILIMAP_STATUS_ATT_HIGHESTMODSEQ); + } r = mailimap_status(mImap, MCUTF8(folder), status_att_list, &status); @@ -934,7 +937,15 @@ IMAPFolderStatus * IMAPSession::folderStatus(String * folder, ErrorCode * pError break; case MAILIMAP_STATUS_ATT_UIDVALIDITY: fs->setUidValidity(status_info->st_value); - break; + break; + case MAILIMAP_STATUS_ATT_EXTENSION: { + struct mailimap_extension_data * ext_data = status_info->st_ext_data; + if (ext_data->ext_extension == &mailimap_extension_condstore) { + struct mailimap_condstore_status_info * status_info = (struct mailimap_condstore_status_info *) ext_data->ext_data; + fs->setHighestModSeqValue(status_info->cs_highestmodseq_value); + } + break; + } } } diff --git a/src/core/provider/MCMailProvider.h b/src/core/provider/MCMailProvider.h index 50f3deff..306b180d 100644 --- a/src/core/provider/MCMailProvider.h +++ b/src/core/provider/MCMailProvider.h @@ -26,9 +26,9 @@ namespace mailcore { virtual String * identifier(); - virtual Array * imapServices(); - virtual Array * smtpServices(); - virtual Array * popServices(); + virtual Array * /* NetService */ imapServices(); + virtual Array * /* NetService */ smtpServices(); + virtual Array * /* NetService */ popServices(); virtual bool matchEmail(String * email); virtual bool matchMX(String * hostname); @@ -53,12 +53,12 @@ namespace mailcore { private: String * mIdentifier; - Array * mDomainMatch; - Array * mImapServices; - Array * mSmtpServices; - Array * mPopServices; + Array * /* String */ mDomainMatch; + Array * /* NetService */ mImapServices; + Array * /* NetService */ mSmtpServices; + Array * /* NetService */ mPopServices; HashMap * mMailboxPaths; - Set* mMxSet; + Set * mMxSet; void init(); }; diff --git a/src/core/renderer/MCAddressDisplay.h b/src/core/renderer/MCAddressDisplay.h index d84e55d0..3fe6856d 100644 --- a/src/core/renderer/MCAddressDisplay.h +++ b/src/core/renderer/MCAddressDisplay.h @@ -22,9 +22,9 @@ namespace mailcore { static String * shortDisplayStringForAddress(Address * address); static String * veryShortDisplayStringForAddress(Address * address); - static String * displayStringForAddresses(Array * addresses); - static String * shortDisplayStringForAddresses(Array * addresses); - static String * veryShortDisplayStringForAddresses(Array * addresses); + static String * displayStringForAddresses(Array * /* Address */ addresses); + static String * shortDisplayStringForAddresses(Array * /* Address */ addresses); + static String * veryShortDisplayStringForAddresses(Array * /* Address */ addresses); }; }; diff --git a/src/core/renderer/MCHTMLRenderer.h b/src/core/renderer/MCHTMLRenderer.h index 2a36a9f6..f76510e8 100644 --- a/src/core/renderer/MCHTMLRenderer.h +++ b/src/core/renderer/MCHTMLRenderer.h @@ -31,11 +31,11 @@ namespace mailcore { HTMLRendererIMAPCallback * dataCallback, HTMLRendererTemplateCallback * htmlCallback); - static Array * attachmentsForMessage(AbstractMessage * message); - static Array * htmlInlineAttachmentsForMessage(AbstractMessage * message); + static Array * /* AbstractPart */ attachmentsForMessage(AbstractMessage * message); + static Array * /* AbstractPart */ htmlInlineAttachmentsForMessage(AbstractMessage * message); }; }; #endif -#endif /* defined(__testUI__MCHTMLRenderer__) */ +#endif diff --git a/src/core/rfc822/MCMessageBuilder.cc b/src/core/rfc822/MCMessageBuilder.cc index f8fe0064..435557db 100644 --- a/src/core/rfc822/MCMessageBuilder.cc +++ b/src/core/rfc822/MCMessageBuilder.cc @@ -553,12 +553,6 @@ String * MessageBuilder::textBody() void MessageBuilder::setAttachments(Array * attachments) { - if (attachments != NULL) { - for(unsigned int i = 0 ; i < attachments->count() ; i ++) { - Attachment * attachment = (Attachment *) attachments->objectAtIndex(i); - attachment->setMessage(this); - } - } MC_SAFE_REPLACE_COPY(Array, mAttachments, attachments); } @@ -572,18 +566,11 @@ void MessageBuilder::addAttachment(Attachment * attachment) if (mAttachments == NULL) { mAttachments = new Array(); } - attachment->setMessage(this); mAttachments->addObject(attachment); } void MessageBuilder::setRelatedAttachments(Array * attachments) { - if (attachments != NULL) { - for(unsigned int i = 0 ; i < attachments->count() ; i ++) { - Attachment * attachment = (Attachment *) attachments->objectAtIndex(i); - attachment->setMessage(this); - } - } MC_SAFE_REPLACE_COPY(Array, mRelatedAttachments, attachments); } @@ -597,7 +584,6 @@ void MessageBuilder::addRelatedAttachment(Attachment * attachment) if (mRelatedAttachments == NULL) { mRelatedAttachments = new Array(); } - attachment->setMessage(this); mRelatedAttachments->addObject(attachment); } diff --git a/src/core/rfc822/MCMessageBuilder.h b/src/core/rfc822/MCMessageBuilder.h index 63f325d3..409cd9ee 100644 --- a/src/core/rfc822/MCMessageBuilder.h +++ b/src/core/rfc822/MCMessageBuilder.h @@ -50,8 +50,8 @@ namespace mailcore { private: String * mHTMLBody; String * mTextBody; - Array * mAttachments; - Array * mRelatedAttachments; + Array * /* Attachment */ mAttachments; + Array * /* Attachment */ mRelatedAttachments; String * mBoundaryPrefix; void init(); Data * dataAndFilterBcc(bool filterBcc); diff --git a/src/core/rfc822/MCMessageParser.cc b/src/core/rfc822/MCMessageParser.cc index 2a892e6b..b936fabf 100644 --- a/src/core/rfc822/MCMessageParser.cc +++ b/src/core/rfc822/MCMessageParser.cc @@ -37,7 +37,6 @@ MessageParser::MessageParser(Data * data) msg = data_message_init(data->bytes(), data->length()); mailmessage_get_bodystructure(msg, &mime); mMainPart = (AbstractPart *) Attachment::attachmentsWithMIME(msg->msg_mime)->retain(); - mMainPart->setMessage(this); mMainPart->applyUniquePartID(); header()->importIMFFields(msg->msg_fields); mailmessage_free(msg); diff --git a/src/core/smtp/MCSMTPSession.h b/src/core/smtp/MCSMTPSession.h index dc949731..70237c16 100644 --- a/src/core/smtp/MCSMTPSession.h +++ b/src/core/smtp/MCSMTPSession.h @@ -82,7 +82,7 @@ namespace mailcore { void loginIfNeeded(ErrorCode * pError); bool checkCertificate(); - void sendMessage(Address * from, Array * recipients, Data * messageData, + void sendMessage(Address * from, Array * /* Address */ recipients, Data * messageData, SMTPProgressCallback * callback, ErrorCode * pError); void sendMessage(MessageBuilder * msg, SMTPProgressCallback * callback, ErrorCode * pError); }; diff --git a/src/objc/abstract/MCOAbstractMessage.h b/src/objc/abstract/MCOAbstractMessage.h index a26d5aac..bf442659 100644 --- a/src/objc/abstract/MCOAbstractMessage.h +++ b/src/objc/abstract/MCOAbstractMessage.h @@ -26,11 +26,17 @@ /** Returns the part with the given unique identifier.*/ - (MCOAbstractPart *) partForUniqueID:(NSString *)uniqueID; -/** All attachments in the message */ -- (NSArray *) attachments; - -/** All HTML bodies */ -- (NSArray *) htmlInlineAttachments; +/** All attachments in the message. + It will return an array of MCOIMAPPart for MCOIMAPMessage. + It will return an array of MCOAttachment for MCOMessageParser. + It will return an array of MCOAttachment for MCOMessageBuilder. */ +- (NSArray * /* MCOAbstractPart */) attachments; + +/** All image attachments included inline in the message through cid: URLs. + It will return an array of MCOIMAPPart for MCOIMAPMessage. + It will return an array of MCOAttachment for MCOMessageParser. + It will return an array of MCOAttachment for MCOMessageBuilder. */ +- (NSArray * /* MCOAbstractPart */) htmlInlineAttachments; @end diff --git a/src/objc/abstract/MCOAbstractPart.h b/src/objc/abstract/MCOAbstractPart.h index 0269347a..a3ab44f6 100644 --- a/src/objc/abstract/MCOAbstractPart.h +++ b/src/objc/abstract/MCOAbstractPart.h @@ -66,9 +66,6 @@ typedef enum { /** Returns whether the part is an explicit inline attachment.*/ @property (nonatomic, assign, getter=isInlineAttachment) BOOL inlineAttachment; -/** Returns the owner message of the part.*/ -@property (nonatomic, weak) MCOAbstractMessage * message; - /** Returns the part with the given Content-ID among this part and its subparts.*/ - (MCOAbstractPart *) partForContentID:(NSString *)contentID; diff --git a/src/objc/abstract/MCOAbstractPart.mm b/src/objc/abstract/MCOAbstractPart.mm index 47191ce9..8b2b008d 100644 --- a/src/objc/abstract/MCOAbstractPart.mm +++ b/src/objc/abstract/MCOAbstractPart.mm @@ -57,7 +57,6 @@ MCO_OBJC_SYNTHESIZE_STRING(setUniqueID, uniqueID) MCO_OBJC_SYNTHESIZE_STRING(setContentID, contentID) MCO_OBJC_SYNTHESIZE_STRING(setContentLocation, contentLocation) MCO_OBJC_SYNTHESIZE_BOOL(setInlineAttachment, isInlineAttachment) -MCO_OBJC_SYNTHESIZE(AbstractMessage, setMessage, message) - (MCOAbstractPart *) partForContentID:(NSString *)contentID { diff --git a/src/objc/imap/MCOIMAPFolderStatus.h b/src/objc/imap/MCOIMAPFolderStatus.h index 9ee1813d..d39e1fc5 100644 --- a/src/objc/imap/MCOIMAPFolderStatus.h +++ b/src/objc/imap/MCOIMAPFolderStatus.h @@ -14,10 +14,7 @@ /* This class holds IMAP folder metadata */ -@interface MCOIMAPFolderStatus : NSObject - -/** Create an empty instance */ -+ (MCOIMAPFolderStatus *) status; +@interface MCOIMAPFolderStatus : NSObject <NSCopying> /** The folder's IMAP UIDNEXT value. Used to determine the uid for the next received message. */ @property (nonatomic, assign) uint32_t uidNext; @@ -26,17 +23,16 @@ @property (nonatomic, assign) uint32_t uidValidity; /** Number of recent messages received in the folder */ -@property (nonatomic, assign) uint32_t totalRecent; +@property (nonatomic, assign) uint32_t recentCount; /** Number of unseen messages in the folder */ -@property (nonatomic, assign) uint32_t totalUnseen; - -// Number of messages in the folder -@property (nonatomic, assign) uint32_t totalMessages; - -// We need also the the folder path +@property (nonatomic, assign) uint32_t unseenCount; +/** Number of messages in the folder */ +@property (nonatomic, assign) uint32_t messageCount; +/** Highest modification sequence value for this folder. See CONDSTORE RFC 4551. */ +@property (nonatomic, assign) uint64_t setHighestModSeqValue; @end diff --git a/src/objc/imap/MCOIMAPFolderStatus.m b/src/objc/imap/MCOIMAPFolderStatus.m deleted file mode 100644 index ceab8a00..00000000 --- a/src/objc/imap/MCOIMAPFolderStatus.m +++ /dev/null @@ -1,35 +0,0 @@ -// -// MCOIMAPFolderStatus.m -// mailcore2 -// -// Created by Sebastian on 6/5/13. -// Copyright (c) 2013 MailCore. All rights reserved. -// - -#import "MCOIMAPFolderStatus.h" - - -@implementation MCOIMAPFolderStatus { - uint32_t total_unseen; - uint32_t total_messages; - uint32_t total_recent; - uint32_t _uidNext; - uint32_t _uidValidity; -} - -@synthesize uidNext = _uidNext; -@synthesize uidValidity = _uidValidity; -@synthesize totalMessages = total_messages; -@synthesize totalRecent = total_recent; -@synthesize totalUnseen = total_unseen; - - - -+ (MCOIMAPFolderStatus *) status -{ - return [[[MCOIMAPFolderStatus alloc] init] autorelease]; -} - - - -@end diff --git a/src/objc/imap/MCOIMAPFolderStatus.mm b/src/objc/imap/MCOIMAPFolderStatus.mm new file mode 100644 index 00000000..7cd1597d --- /dev/null +++ b/src/objc/imap/MCOIMAPFolderStatus.mm @@ -0,0 +1,72 @@ +// +// MCOIMAPFolderStatus.m +// mailcore2 +// +// Created by Sebastian on 6/5/13. +// Copyright (c) 2013 MailCore. All rights reserved. +// + +#import "MCOIMAPFolderStatus.h" +#import "NSObject+MCO.h" + +#include "MCIMAPFolderStatus.h" + +#define nativeType mailcore::IMAPFolderStatus + +@implementation MCOIMAPFolderStatus { + mailcore::IMAPFolderStatus * _nativeStatus; +} + ++ (void) load +{ + MCORegisterClass(self, &typeid(nativeType)); +} + +- (id) initWithMCFolderStatus:(mailcore::IMAPFolderStatus *)status +{ + self = [super init]; + + status->retain(); + _nativeStatus = status; + + return self; +} + +- (void) dealloc +{ + MC_SAFE_RELEASE(_nativeStatus); + [super dealloc]; +} + ++ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object +{ + mailcore::IMAPFolderStatus * status = (mailcore::IMAPFolderStatus *) object; + return [[[self alloc] initWithMCFolderStatus:status] autorelease]; +} + +- (mailcore::Object *) mco_mcObject +{ + return _nativeStatus; +} + +- (id) copyWithZone:(NSZone *)zone +{ + nativeType * nativeObject = (nativeType *) [self mco_mcObject]->copy(); + id result = [[self class] mco_objectWithMCObject:nativeObject]; + MC_SAFE_RELEASE(nativeObject); + return [result retain]; +} + +- (NSString *) description +{ + return MCO_OBJC_BRIDGE_GET(description); +} + +MCO_OBJC_SYNTHESIZE_SCALAR(uint32_t, uint32_t, setUnseenCount, unseenCount) +MCO_OBJC_SYNTHESIZE_SCALAR(uint32_t, uint32_t, setMessageCount, messageCount) +MCO_OBJC_SYNTHESIZE_SCALAR(uint32_t, uint32_t, setRecentCount, recentCount) +MCO_OBJC_SYNTHESIZE_SCALAR(uint32_t, uint32_t, setUidNext, uidNext) +MCO_OBJC_SYNTHESIZE_SCALAR(uint32_t, uint32_t, setUidValidity, uidValidity) +MCO_OBJC_SYNTHESIZE_SCALAR(uint64_t, uint64_t, setHighestModSeqValue, highestModSeqValue) + +@end diff --git a/src/objc/imap/MCOIMAPFolderStatusOperation.mm b/src/objc/imap/MCOIMAPFolderStatusOperation.mm index 21b937b9..c7f5370c 100644 --- a/src/objc/imap/MCOIMAPFolderStatusOperation.mm +++ b/src/objc/imap/MCOIMAPFolderStatusOperation.mm @@ -50,13 +50,7 @@ typedef void (^CompletionType)(NSError *error, MCOIMAPFolderStatus *status); nativeType *op = MCO_NATIVE_INSTANCE; if (op->error() == mailcore::ErrorNone) { - MCOIMAPFolderStatus * status = [MCOIMAPFolderStatus status]; - [status setUidNext:MCO_NATIVE_INSTANCE->uidNext()]; - [status setUidValidity:MCO_NATIVE_INSTANCE->uidValidity()]; - [status setTotalMessages:MCO_NATIVE_INSTANCE->messageCount()]; - [status setTotalRecent:MCO_NATIVE_INSTANCE->recentCount()]; - [status setTotalUnseen:MCO_NATIVE_INSTANCE->unseenCount()]; - + MCOIMAPFolderStatus * status = MCO_TO_OBJC(op->status()); _completionBlock(nil, status); } else { _completionBlock([NSError mco_errorWithErrorCode:op->error()], nil); diff --git a/src/objc/imap/MCOIMAPMessage.h b/src/objc/imap/MCOIMAPMessage.h index 81dfa9f7..c6d8595b 100644 --- a/src/objc/imap/MCOIMAPMessage.h +++ b/src/objc/imap/MCOIMAPMessage.h @@ -46,8 +46,8 @@ /** Main MIME part of the message */ @property (nonatomic, retain) MCOAbstractPart * mainPart; -/** Any Gmail labels of the message */ -@property (nonatomic, copy) NSArray * gmailLabels; +/** All Gmail labels of the message */ +@property (nonatomic, copy) NSArray * /* NSString */ gmailLabels; /** Returns the part with the given part identifier. diff --git a/src/objc/imap/MCOIMAPNamespace.h b/src/objc/imap/MCOIMAPNamespace.h index f3373c64..5fcda25b 100644 --- a/src/objc/imap/MCOIMAPNamespace.h +++ b/src/objc/imap/MCOIMAPNamespace.h @@ -30,7 +30,7 @@ - (char) mainDelimiter; /** Returns the list of prefixes of this namespace. */ -- (NSArray *) prefixes; +- (NSArray * /* NSString */) prefixes; /** Returns the folder path for the given list of path components in the context @@ -45,7 +45,7 @@ - (NSString *) pathForComponents:(NSArray *)components prefix:(NSString *)prefix; /** Returns the components given a folder path. */ -- (NSArray *) componentsFromPath:(NSString *)path; +- (NSArray * /* NSString */) componentsFromPath:(NSString *)path; /** Returns YES if the namespace contains the given folder path. */ - (BOOL) containsFolderPath:(NSString *)path; diff --git a/src/objc/imap/MCOIMAPNamespaceItem.h b/src/objc/imap/MCOIMAPNamespaceItem.h index b23d0dfc..3063919b 100644 --- a/src/objc/imap/MCOIMAPNamespaceItem.h +++ b/src/objc/imap/MCOIMAPNamespaceItem.h @@ -26,7 +26,7 @@ - (NSString *) pathForComponents:(NSArray *)components; /** Returns components for the given path in the context of this namespace */ -- (NSArray *) componentsForPath:(NSString *)path; +- (NSArray * /* NSString */) componentsForPath:(NSString *)path; /** Returns YES if the namespace contains this folder path */ - (BOOL) containsFolder:(NSString *)folder; diff --git a/src/objc/imap/MCOIMAPSearchExpression.mm b/src/objc/imap/MCOIMAPSearchExpression.mm index ecc44ba6..dc2e027a 100644 --- a/src/objc/imap/MCOIMAPSearchExpression.mm +++ b/src/objc/imap/MCOIMAPSearchExpression.mm @@ -84,23 +84,13 @@ + (MCOIMAPSearchExpression *) searchAnd:(MCOIMAPSearchExpression *)expression other:(MCOIMAPSearchExpression *)other { - mailcore::IMAPSearchExpression * copyExpr = (mailcore::IMAPSearchExpression *) expression->_nativeExpr->copy(); - mailcore::IMAPSearchExpression * copyOther = (mailcore::IMAPSearchExpression *) other->_nativeExpr->copy(); - mailcore::IMAPSearchExpression * result = mailcore::IMAPSearchExpression::searchAnd(copyExpr, copyOther); - copyExpr->release(); - copyOther->release(); - + mailcore::IMAPSearchExpression * result = mailcore::IMAPSearchExpression::searchOr(expression->_nativeExpr, other->_nativeExpr); return MCO_TO_OBJC(result); } + (MCOIMAPSearchExpression *) searchOr:(MCOIMAPSearchExpression *)expression other:(MCOIMAPSearchExpression *)other { - mailcore::IMAPSearchExpression * copyExpr = (mailcore::IMAPSearchExpression *) expression->_nativeExpr->copy(); - mailcore::IMAPSearchExpression * copyOther = (mailcore::IMAPSearchExpression *) other->_nativeExpr->copy(); - mailcore::IMAPSearchExpression * result = mailcore::IMAPSearchExpression::searchOr(copyExpr, copyOther); - copyExpr->release(); - copyOther->release(); - + mailcore::IMAPSearchExpression * result = mailcore::IMAPSearchExpression::searchOr(expression->_nativeExpr, other->_nativeExpr); return MCO_TO_OBJC(result); } diff --git a/src/objc/pop/MCOPOPSession.h b/src/objc/pop/MCOPOPSession.h index 52f5a9b7..6ecca042 100644 --- a/src/objc/pop/MCOPOPSession.h +++ b/src/objc/pop/MCOPOPSession.h @@ -102,6 +102,16 @@ See MCOConnectionType for more information.*/ - (MCOPOPOperation *) deleteMessagesOperationWithIndexes:(MCOIndexSet *)indexes; /** + Returns an operation that will disconnect the session. + + MCOPOPOperation * op = [session disconnectOperation]; + [op start:^(NSError * error) { + ... + }]; + */ +- (MCOPOPOperation *) disconnectOperation; + +/** Returns an operation that will check whether the POP account is valid. MCOPOPOperation * op = [session checkAccountOperation]; diff --git a/src/objc/pop/MCOPOPSession.mm b/src/objc/pop/MCOPOPSession.mm index cb060784..10806937 100644 --- a/src/objc/pop/MCOPOPSession.mm +++ b/src/objc/pop/MCOPOPSession.mm @@ -80,6 +80,12 @@ MCO_OBJC_SYNTHESIZE_BOOL(setCheckCertificateEnabled, isCheckCertificateEnabled) return [[[MCOPOPOperation alloc] initWithMCOperation:coreOp] autorelease]; } +- (MCOPOPOperation *) disconnectOperation +{ + mailcore::POPOperation * coreOp = MCO_NATIVE_INSTANCE->disconnectOperation(); + return [[[MCOPOPOperation alloc] initWithMCOperation:coreOp] autorelease]; +} + - (MCOPOPOperation *) checkAccountOperation { mailcore::POPOperation * coreOp = MCO_NATIVE_INSTANCE->checkAccountOperation(); diff --git a/src/objc/provider/MCOMailProvider.h b/src/objc/provider/MCOMailProvider.h index 53f09736..85a23a8d 100644 --- a/src/objc/provider/MCOMailProvider.h +++ b/src/objc/provider/MCOMailProvider.h @@ -22,19 +22,19 @@ A list of ways that you can connect to the IMAP server @return An array of MCONetService */ -- (NSArray *) imapServices; +- (NSArray * /* MCONetService */) imapServices; /** A list of ways that you can connect to the SMTP server @return An array of MCONetService */ -- (NSArray *) smtpServices; +- (NSArray * /* MCONetService */) smtpServices; /** A list of ways that you can connect to the POP3 server @return An array of MCONetService */ -- (NSArray *) popServices; +- (NSArray * /* MCONetService */) popServices; - (BOOL) matchEmail:(NSString *)email; - (BOOL) matchMX:(NSString *)hostname; diff --git a/src/objc/rfc822/MCOMessageBuilder.h b/src/objc/rfc822/MCOMessageBuilder.h index 4fa78691..217ec49c 100644 --- a/src/objc/rfc822/MCOMessageBuilder.h +++ b/src/objc/rfc822/MCOMessageBuilder.h @@ -41,10 +41,10 @@ @property (nonatomic, copy) NSString * textBody; /** List of file attachments.*/ -@property (nonatomic, copy) NSArray * attachments; +@property (nonatomic, copy) NSArray * /* MCOAttachment */ attachments; /** List of related file attachments (included as cid: link in the HTML part).*/ -@property (nonatomic, copy) NSArray * relatedAttachments; +@property (nonatomic, copy) NSArray * /* MCOAttachment */ relatedAttachments; /** Prefix for the boundary identifier. Default value is nil.*/ @property (nonatomic, copy) NSString * boundaryPrefix; |