aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar CodaFi <devteam.codafi@gmail.com>2013-08-29 20:54:50 -0600
committerGravatar CodaFi <devteam.codafi@gmail.com>2013-08-29 20:54:50 -0600
commit448cff1bedc2af11541b7dea640a7a9a6ee2a235 (patch)
treeee795f4ca4ead8af9f39b137cd73c646462e6848
parentd25b3eed0e9ffce2000cf648b396e236a067129d (diff)
parent47a10e080f8746f0aa447b95535011ea38c5341e (diff)
Merge remote-tracking branch 'upstream/master'
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt6
-rwxr-xr-x[-rw-r--r--]build-mac/mailcore2.xcodeproj/project.pbxproj68
-rw-r--r--build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/mailcore osx.xcscheme59
-rw-r--r--build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/static mailcore2 ios.xcscheme59
-rw-r--r--build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/static mailcore2 osx.xcscheme59
-rw-r--r--build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/test-ios.xcscheme86
-rw-r--r--build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/tests.xcscheme86
-rw-r--r--example/ios/iOS UI Test/iOS UI Test.xcodeproj/project.pbxproj4
-rw-r--r--example/mac/macExample/macExample/AppDelegate.m2
-rwxr-xr-xscripts/build-mailcore2-ios.sh9
-rwxr-xr-xscripts/prepare-ctemplate-ios.sh9
-rwxr-xr-xscripts/prepare-icu4c-ios.sh10
-rwxr-xr-xscripts/prepare-libetpan-ios.sh12
-rwxr-xr-xscripts/prepare-libetpan-macos.sh2
-rwxr-xr-xscripts/prepare-tidy-ios.sh9
-rwxr-xr-xscripts/travis/before-script.sh3
-rwxr-xr-xscripts/travis/script.sh18
-rwxr-xr-x[-rw-r--r--]src/async/imap/MCAsyncIMAP.h2
-rwxr-xr-x[-rw-r--r--]src/async/imap/MCIMAPAsyncConnection.cc72
-rwxr-xr-x[-rw-r--r--]src/async/imap/MCIMAPAsyncConnection.h20
-rwxr-xr-x[-rw-r--r--]src/async/imap/MCIMAPAsyncSession.cc93
-rwxr-xr-x[-rw-r--r--]src/async/imap/MCIMAPAsyncSession.h29
-rw-r--r--src/async/imap/MCIMAPCapabilityOperation.cc5
-rw-r--r--src/async/imap/MCIMAPFetchFoldersOperation.cc11
-rw-r--r--src/async/imap/MCIMAPFetchFoldersOperation.h1
-rw-r--r--src/async/imap/MCIMAPIdentityOperation.cc41
-rw-r--r--src/async/imap/MCIMAPIdentityOperation.h20
-rw-r--r--src/async/imap/MCIMAPOperation.cc13
-rw-r--r--src/async/imap/MCIMAPOperation.h3
-rw-r--r--src/async/imap/MCIMAPQuotaOperation.cc41
-rw-r--r--src/async/imap/MCIMAPQuotaOperation.h39
-rw-r--r--src/async/pop/MCPOPAsyncSession.cc4
-rw-r--r--src/async/smtp/MCSMTPAsyncSession.cc15
-rw-r--r--src/async/smtp/MCSMTPAsyncSession.h2
-rw-r--r--src/async/smtp/MCSMTPSendWithDataOperation.cc31
-rw-r--r--src/async/smtp/MCSMTPSendWithDataOperation.h8
-rw-r--r--src/cmake/async.cmake1
-rw-r--r--src/cmake/core.cmake8
-rw-r--r--src/cmake/objc.cmake32
-rw-r--r--src/cmake/public-headers.cmake4
-rw-r--r--src/core/abstract/MCAbstractPart.cc1
-rw-r--r--src/core/abstract/MCMessageConstants.h2
-rw-r--r--src/core/abstract/MCMessageHeader.cc1
-rw-r--r--src/core/basetypes/MCArray.cc2
-rw-r--r--src/core/basetypes/MCAutoreleasePool.cc8
-rw-r--r--src/core/basetypes/MCObject.cc8
-rw-r--r--src/core/basetypes/MCObject.h2
-rw-r--r--src/core/basetypes/MCOperation.cc8
-rw-r--r--src/core/basetypes/MCOperation.h8
-rw-r--r--src/core/basetypes/MCOperationQueue.cc17
-rw-r--r--src/core/basetypes/MCOperationQueue.h1
-rw-r--r--src/core/basetypes/MCOperationQueueCallback.h4
-rw-r--r--src/core/basetypes/MCRange.cc6
-rw-r--r--src/core/basetypes/MCString.cc16
-rw-r--r--src/core/basetypes/MCValue.cc1
-rw-r--r--src/core/imap/MCIMAP.h1
-rw-r--r--src/core/imap/MCIMAPIdentity.cc97
-rw-r--r--src/core/imap/MCIMAPIdentity.h54
-rw-r--r--src/core/imap/MCIMAPMessage.cc2
-rw-r--r--src/core/imap/MCIMAPMessage.h2
-rw-r--r--src/core/imap/MCIMAPPart.cc2
-rwxr-xr-x[-rw-r--r--]src/core/imap/MCIMAPSession.cc472
-rwxr-xr-x[-rw-r--r--]src/core/imap/MCIMAPSession.h35
-rw-r--r--src/core/pop/MCPOPSession.cc2
-rw-r--r--src/core/smtp/MCSMTPSession.cc169
-rw-r--r--src/core/smtp/MCSMTPSession.h5
-rw-r--r--src/objc/abstract/MCOConstants.h7
-rw-r--r--src/objc/abstract/MCOMessageHeader.mm8
-rwxr-xr-x[-rw-r--r--]src/objc/imap/MCOIMAP.h2
-rw-r--r--src/objc/imap/MCOIMAPIdentity.h42
-rw-r--r--src/objc/imap/MCOIMAPIdentity.mm96
-rw-r--r--src/objc/imap/MCOIMAPMessage.mm8
-rw-r--r--src/objc/imap/MCOIMAPQuotaOperation.h15
-rw-r--r--src/objc/imap/MCOIMAPQuotaOperation.mm69
-rwxr-xr-x[-rw-r--r--]src/objc/imap/MCOIMAPSession.h44
-rwxr-xr-x[-rw-r--r--]src/objc/imap/MCOIMAPSession.mm87
-rw-r--r--src/objc/provider/MCOMailProvidersManager.mm26
-rw-r--r--src/objc/smtp/MCOSMTPSession.h18
-rw-r--r--src/objc/smtp/MCOSMTPSession.mm13
-rwxr-xr-xsrc/ui/ios/MCOMessageView.mm2
-rw-r--r--tests/CMakeLists.txt14
-rw-r--r--tests/test-all.mm7
83 files changed, 2005 insertions, 376 deletions
diff --git a/.gitignore b/.gitignore
index 73cdfa35..e743557b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@ project.xcworkspace
example/ios/iOS UI Test/DerivedData
scripts/prebuilt.list
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a70ccf5d..bbdf85dd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,10 @@
cmake_minimum_required (VERSION 2.6)
project (mailcore2)
+IF(APPLE)
+ set(CMAKE_CXX__FLAGS "-std=c++11 -stdlib=libc++")
+ set(CMAKE_EXE_LINKER_FLAGS "-lc++ -stdlib=libc++")
+ENDIF()
+
add_subdirectory (src)
+add_subdirectory (tests)
diff --git a/build-mac/mailcore2.xcodeproj/project.pbxproj b/build-mac/mailcore2.xcodeproj/project.pbxproj
index 9a1c64c3..002d1128 100644..100755
--- a/build-mac/mailcore2.xcodeproj/project.pbxproj
+++ b/build-mac/mailcore2.xcodeproj/project.pbxproj
@@ -7,6 +7,14 @@
objects = {
/* Begin PBXBuildFile section */
+ 4B3C1BDE17ABF309008BBF4C /* MCOIMAPQuotaOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3C1BDD17ABF307008BBF4C /* MCOIMAPQuotaOperation.mm */; };
+ 4B3C1BE117ABF4BC008BBF4C /* MCIMAPQuotaOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4B3C1BDF17ABF4BB008BBF4C /* MCIMAPQuotaOperation.cc */; };
+ 4B3C1BE217ABFF7C008BBF4C /* MCOIMAPQuotaOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B3C1BDC17ABF306008BBF4C /* MCOIMAPQuotaOperation.h */; };
+ 4B3C1BE317ABFF91008BBF4C /* MCOIMAPQuotaOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B3C1BDD17ABF307008BBF4C /* MCOIMAPQuotaOperation.mm */; };
+ 4B3C1BE417AC0156008BBF4C /* MCIMAPQuotaOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B3C1BE017ABF4BC008BBF4C /* MCIMAPQuotaOperation.h */; };
+ 4B3C1BE517AC0176008BBF4C /* MCIMAPQuotaOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4B3C1BDF17ABF4BB008BBF4C /* MCIMAPQuotaOperation.cc */; };
+ 4BE4029117B548B900ECC5E4 /* MCOIMAPQuotaOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B3C1BDC17ABF306008BBF4C /* MCOIMAPQuotaOperation.h */; };
+ 4BE4029217B548D900ECC5E4 /* MCIMAPQuotaOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B3C1BE017ABF4BC008BBF4C /* MCIMAPQuotaOperation.h */; };
84AF9E7E172DBAF600E60AA3 /* providers.json in Resources */ = {isa = PBXBuildFile; fileRef = 84AF9E7D172DBAF600E60AA3 /* providers.json */; };
9E774D891767C7F60065EB9B /* MCIMAPFolderStatus.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9E774D881767C7F60065EB9B /* MCIMAPFolderStatus.cc */; };
9E774D8A1767C7F60065EB9B /* MCIMAPFolderStatus.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9E774D881767C7F60065EB9B /* MCIMAPFolderStatus.cc */; };
@@ -84,6 +92,14 @@
C63CD68D16BE1BCA00DB18F1 /* MCRenderer.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = C63CD68716BE1AB600DB18F1 /* MCRenderer.h */; };
C63CD68E16BE324100DB18F1 /* MCOIMAPFetchFoldersOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = F87F190816BB62690012652F /* MCOIMAPFetchFoldersOperation.h */; };
C63CD69116BE566E00DB18F1 /* MCHTMLCleaner.cc in Sources */ = {isa = PBXBuildFile; fileRef = C63CD68F16BE566D00DB18F1 /* MCHTMLCleaner.cc */; };
+ C63D315C17C9155C00A4D993 /* MCIMAPIdentity.cc in Sources */ = {isa = PBXBuildFile; fileRef = C63D315A17C9155C00A4D993 /* MCIMAPIdentity.cc */; };
+ C63D315D17C9155C00A4D993 /* MCIMAPIdentity.cc in Sources */ = {isa = PBXBuildFile; fileRef = C63D315A17C9155C00A4D993 /* MCIMAPIdentity.cc */; };
+ C63D315E17C9279700A4D993 /* MCIMAPIdentity.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = C63D315B17C9155C00A4D993 /* MCIMAPIdentity.h */; };
+ C63D315F17C9279D00A4D993 /* MCIMAPIdentity.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = C63D315B17C9155C00A4D993 /* MCIMAPIdentity.h */; };
+ C63D316217C92D8300A4D993 /* MCOIMAPIdentity.mm in Sources */ = {isa = PBXBuildFile; fileRef = C63D316117C92D8300A4D993 /* MCOIMAPIdentity.mm */; };
+ C63D316317C92D8300A4D993 /* MCOIMAPIdentity.mm in Sources */ = {isa = PBXBuildFile; fileRef = C63D316117C92D8300A4D993 /* MCOIMAPIdentity.mm */; };
+ C63D316617C997B400A4D993 /* MCOIMAPIdentity.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = C63D316017C92D8300A4D993 /* MCOIMAPIdentity.h */; };
+ C63D316717C997BA00A4D993 /* MCOIMAPIdentity.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = C63D316017C92D8300A4D993 /* MCOIMAPIdentity.h */; };
C64BB22116E34DCB000DB34C /* MCIMAPSyncResult.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64BB21F16E34DCA000DB34C /* MCIMAPSyncResult.cc */; };
C64BB22B16E5C0A4000DB34C /* MCIMAPCapabilityOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64BB22916E5C0A3000DB34C /* MCIMAPCapabilityOperation.cc */; };
C64BB22E16E5C1EE000DB34C /* MCIndexSet.cc in Sources */ = {isa = PBXBuildFile; fileRef = C64BB22C16E5C1EE000DB34C /* MCIndexSet.cc */; };
@@ -733,8 +749,12 @@
dstPath = include/MailCore;
dstSubfolderSpec = 16;
files = (
+ 4BE4029217B548D900ECC5E4 /* MCIMAPQuotaOperation.h in CopyFiles */,
+ 4BE4029117B548B900ECC5E4 /* MCOIMAPQuotaOperation.h in CopyFiles */,
C6E665001790963E0063F2CF /* MCIMAPMessageRenderingOperation.h in CopyFiles */,
DAE42E89178F7E1800E0DB8F /* MCOIMAPMessageRenderingOperation.h in CopyFiles */,
+ C63D316617C997B400A4D993 /* MCOIMAPIdentity.h in CopyFiles */,
+ C63D315E17C9279700A4D993 /* MCIMAPIdentity.h in CopyFiles */,
9E774D8C1767CD490065EB9B /* MCIMAPFolderStatus.h in CopyFiles */,
9EF9AB24175F409D0027FA3B /* MCIMAPFolderStatusOperation.h in CopyFiles */,
9EF9AB22175F406D0027FA3B /* MCOIMAPFolderStatus.h in CopyFiles */,
@@ -922,6 +942,9 @@
dstPath = include/MailCore;
dstSubfolderSpec = 16;
files = (
+ 4B3C1BE417AC0156008BBF4C /* MCIMAPQuotaOperation.h in CopyFiles */,
+ 4B3C1BE217ABFF7C008BBF4C /* MCOIMAPQuotaOperation.h in CopyFiles */,
+ C63D316717C997BA00A4D993 /* MCOIMAPIdentity.h in CopyFiles */,
DAE42E8A178F7E2200E0DB8F /* MCOIMAPMessageRenderingOperation.h in CopyFiles */,
C6E6652F1791B2530063F2CF /* MCIMAPMessageRenderingOperation.h in CopyFiles */,
9E774D8B1767CD3C0065EB9B /* MCIMAPFolderStatus.h in CopyFiles */,
@@ -930,6 +953,7 @@
9EF9AB21175F3FD10027FA3B /* MCOIMAPFolderStatusOperation.h in CopyFiles */,
C6CF62D5175325BB006398B9 /* MCOMailProvider.h in CopyFiles */,
C6CF62D6175325BD006398B9 /* MCOMailProvidersManager.h in CopyFiles */,
+ C63D315F17C9279D00A4D993 /* MCIMAPIdentity.h in CopyFiles */,
C6CF62D7175325BF006398B9 /* MCONetService.h in CopyFiles */,
C6CF62D8175325C5006398B9 /* MCOProvider.h in CopyFiles */,
C68B2AEF1778A869005E61EF /* MCConnectionLogger.h in CopyFiles */,
@@ -1099,6 +1123,10 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ 4B3C1BDC17ABF306008BBF4C /* MCOIMAPQuotaOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCOIMAPQuotaOperation.h; sourceTree = "<group>"; };
+ 4B3C1BDD17ABF307008BBF4C /* MCOIMAPQuotaOperation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCOIMAPQuotaOperation.mm; sourceTree = "<group>"; };
+ 4B3C1BDF17ABF4BB008BBF4C /* MCIMAPQuotaOperation.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCIMAPQuotaOperation.cc; sourceTree = "<group>"; };
+ 4B3C1BE017ABF4BC008BBF4C /* MCIMAPQuotaOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCIMAPQuotaOperation.h; sourceTree = "<group>"; };
84AF9E7D172DBAF600E60AA3 /* providers.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = providers.json; path = ../resources/providers.json; sourceTree = "<group>"; };
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>"; };
@@ -1160,6 +1188,10 @@
C63CD68716BE1AB600DB18F1 /* MCRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCRenderer.h; sourceTree = "<group>"; };
C63CD68F16BE566D00DB18F1 /* MCHTMLCleaner.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCHTMLCleaner.cc; sourceTree = "<group>"; };
C63CD69016BE566E00DB18F1 /* MCHTMLCleaner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCHTMLCleaner.h; sourceTree = "<group>"; };
+ C63D315A17C9155C00A4D993 /* MCIMAPIdentity.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCIMAPIdentity.cc; sourceTree = "<group>"; };
+ C63D315B17C9155C00A4D993 /* MCIMAPIdentity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCIMAPIdentity.h; sourceTree = "<group>"; };
+ C63D316017C92D8300A4D993 /* MCOIMAPIdentity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCOIMAPIdentity.h; sourceTree = "<group>"; };
+ C63D316117C92D8300A4D993 /* MCOIMAPIdentity.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCOIMAPIdentity.mm; sourceTree = "<group>"; };
C64BB21F16E34DCA000DB34C /* MCIMAPSyncResult.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCIMAPSyncResult.cc; sourceTree = "<group>"; };
C64BB22016E34DCB000DB34C /* MCIMAPSyncResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCIMAPSyncResult.h; sourceTree = "<group>"; };
C64BB22916E5C0A3000DB34C /* MCIMAPCapabilityOperation.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCIMAPCapabilityOperation.cc; sourceTree = "<group>"; };
@@ -1750,6 +1782,8 @@
C62C6ED716A398FA00737497 /* MCIMAPFolderInfoOperation.h */,
C64BB22916E5C0A3000DB34C /* MCIMAPCapabilityOperation.cc */,
C64BB22A16E5C0A3000DB34C /* MCIMAPCapabilityOperation.h */,
+ 4B3C1BDF17ABF4BB008BBF4C /* MCIMAPQuotaOperation.cc */,
+ 4B3C1BE017ABF4BC008BBF4C /* MCIMAPQuotaOperation.h */,
9EF9AB10175F319A0027FA3B /* MCIMAPFolderStatusOperation.cc */,
9EF9AB0E175F30C20027FA3B /* MCIMAPFolderStatusOperation.h */,
C6081679177635D2001F1018 /* MCIMAPDisconnectOperation.cc */,
@@ -1934,6 +1968,8 @@
C64BB22016E34DCB000DB34C /* MCIMAPSyncResult.h */,
9E774D871767C54E0065EB9B /* MCIMAPFolderStatus.h */,
9E774D881767C7F60065EB9B /* MCIMAPFolderStatus.cc */,
+ C63D315B17C9155C00A4D993 /* MCIMAPIdentity.h */,
+ C63D315A17C9155C00A4D993 /* MCIMAPIdentity.cc */,
);
path = imap;
sourceTree = "<group>";
@@ -2206,6 +2242,8 @@
C6F61F9217016B250073032E /* MCOIMAPIdentityOperation.mm */,
C6F61F9417016B310073032E /* MCOIMAPCapabilityOperation.h */,
C6F61F9517016B310073032E /* MCOIMAPCapabilityOperation.mm */,
+ 4B3C1BDC17ABF306008BBF4C /* MCOIMAPQuotaOperation.h */,
+ 4B3C1BDD17ABF307008BBF4C /* MCOIMAPQuotaOperation.mm */,
C6F61F9717016B460073032E /* MCOIMAPSearchExpression.h */,
C6F61F9817016B460073032E /* MCOIMAPSearchExpression.mm */,
9EF9AB06175F2EC60027FA3B /* MCOIMAPFolderStatus.h */,
@@ -2214,6 +2252,8 @@
9EF9AB18175F36600027FA3B /* MCOIMAPFolderStatusOperation.mm */,
DA89896B178A47D200F6D90A /* MCOIMAPMessageRenderingOperation.h */,
DA89896C178A47D200F6D90A /* MCOIMAPMessageRenderingOperation.mm */,
+ C63D316017C92D8300A4D993 /* MCOIMAPIdentity.h */,
+ C63D316117C92D8300A4D993 /* MCOIMAPIdentity.mm */,
);
path = imap;
sourceTree = "<group>";
@@ -2474,6 +2514,7 @@
C64EA7FC16A2959800778456 /* MCIMAPFetchFoldersOperation.cc in Sources */,
C64EA80216A295E400778456 /* MCIMAPRenameFolderOperation.cc in Sources */,
C64EA80516A2997E00778456 /* MCIMAPDeleteFolderOperation.cc in Sources */,
+ C63D315C17C9155C00A4D993 /* MCIMAPIdentity.cc in Sources */,
C64EA80816A2999A00778456 /* MCIMAPCreateFolderOperation.cc in Sources */,
C64EA80B16A299B700778456 /* MCIMAPSubscribeFolderOperation.cc in Sources */,
C64EA81116A299ED00778456 /* MCIMAPAppendMessageOperation.cc in Sources */,
@@ -2542,6 +2583,7 @@
C6F5B9F416FEAC6C00D9DABD /* MCOIndexSet.mm in Sources */,
C6F5B9FE16FED18600D9DABD /* MCOAbstractMessageRendererCallback.mm in Sources */,
C6CCC5C716FFE5190077A5FC /* MCORange.mm in Sources */,
+ C63D316217C92D8300A4D993 /* MCOIMAPIdentity.mm in Sources */,
C6F61F7B170169EE0073032E /* MCOIMAPFolderInfoOperation.mm in Sources */,
C6F61F7E170169FB0073032E /* MCOIMAPAppendMessageOperation.mm in Sources */,
C6F61F8117016A0D0073032E /* MCOIMAPCopyMessagesOperation.mm in Sources */,
@@ -2589,6 +2631,8 @@
BD63713B177DFF080094121B /* MCLibetpan.cc in Sources */,
DAACAD5117886807000B4517 /* MCHTMLRendererIMAPDataCallback.cc in Sources */,
DA89896D178A47D200F6D90A /* MCOIMAPMessageRenderingOperation.mm in Sources */,
+ 4B3C1BDE17ABF309008BBF4C /* MCOIMAPQuotaOperation.mm in Sources */,
+ 4B3C1BE117ABF4BC008BBF4C /* MCIMAPQuotaOperation.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2665,6 +2709,7 @@
C6BA2BC51705F4E6003F0E9E /* MCIMAPFetchFoldersOperation.cc in Sources */,
C6BA2BC61705F4E6003F0E9E /* MCIMAPRenameFolderOperation.cc in Sources */,
C6BA2BC71705F4E6003F0E9E /* MCIMAPDeleteFolderOperation.cc in Sources */,
+ C63D315D17C9155C00A4D993 /* MCIMAPIdentity.cc in Sources */,
C6BA2BC81705F4E6003F0E9E /* MCIMAPCreateFolderOperation.cc in Sources */,
C6BA2BC91705F4E6003F0E9E /* MCIMAPSubscribeFolderOperation.cc in Sources */,
C6BA2BCA1705F4E6003F0E9E /* MCIMAPAppendMessageOperation.cc in Sources */,
@@ -2733,6 +2778,7 @@
C6BA2C051705F4E6003F0E9E /* MCOIndexSet.mm in Sources */,
C6BA2C061705F4E6003F0E9E /* MCOAbstractMessageRendererCallback.mm in Sources */,
C6BA2C071705F4E6003F0E9E /* MCORange.mm in Sources */,
+ C63D316317C92D8300A4D993 /* MCOIMAPIdentity.mm in Sources */,
C6BA2C081705F4E6003F0E9E /* MCOIMAPFolderInfoOperation.mm in Sources */,
C6BA2C091705F4E6003F0E9E /* MCOIMAPAppendMessageOperation.mm in Sources */,
C6BA2C0A1705F4E6003F0E9E /* MCOIMAPCopyMessagesOperation.mm in Sources */,
@@ -2780,6 +2826,8 @@
BD63713C177DFF080094121B /* MCLibetpan.cc in Sources */,
DAACAD5217886807000B4517 /* MCHTMLRendererIMAPDataCallback.cc in Sources */,
DA89896E178A47D200F6D90A /* MCOIMAPMessageRenderingOperation.mm in Sources */,
+ 4B3C1BE317ABFF91008BBF4C /* MCOIMAPQuotaOperation.mm in Sources */,
+ 4B3C1BE517AC0176008BBF4C /* MCIMAPQuotaOperation.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2816,7 +2864,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = NO;
@@ -2862,7 +2909,6 @@
ONLY_ACTIVE_ARCH = YES;
OSX_HEADERS_SEARCH_PATHS = "\"$(SRCROOT)/../Externals/libetpan/include\" \"$(SRCROOT)/../Externals/icu4c/include\" \"$(SRCROOT)/../Externals/ctemplate/include\" /usr/include/tidy /usr/include/libxml2";
OSX_LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../Externals/libetpan/lib\" \"$(SRCROOT)/../Externals/icu4c/lib\" \"$(SRCROOT)/../Externals/ctemplate/lib\"";
- SDKROOT = macosx;
};
name = Debug;
};
@@ -2870,7 +2916,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = NO;
@@ -2911,45 +2956,50 @@
MACOSX_DEPLOYMENT_TARGET = 10.8;
OSX_HEADERS_SEARCH_PATHS = "\"$(SRCROOT)/../Externals/libetpan/include\" \"$(SRCROOT)/../Externals/icu4c/include\" \"$(SRCROOT)/../Externals/ctemplate/include\" /usr/include/tidy /usr/include/libxml2";
OSX_LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../Externals/libetpan/lib\" \"$(SRCROOT)/../Externals/icu4c/lib\" \"$(SRCROOT)/../Externals/ctemplate/lib\"";
- SDKROOT = macosx;
};
name = Release;
};
C64EA53C169E772200778456 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
COMBINE_HIDPI_IMAGES = YES;
EXECUTABLE_PREFIX = lib;
- GCC_WARN_INHIBIT_ALL_WARNINGS = YES;
PRODUCT_NAME = MailCore;
+ SDKROOT = macosx;
};
name = Debug;
};
C64EA53D169E772200778456 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
COMBINE_HIDPI_IMAGES = YES;
EXECUTABLE_PREFIX = lib;
- GCC_WARN_INHIBIT_ALL_WARNINGS = YES;
PRODUCT_NAME = MailCore;
+ SDKROOT = macosx;
};
name = Release;
};
C64EA799169F259300778456 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
PRODUCT_NAME = "$(TARGET_NAME)";
+ SDKROOT = macosx;
};
name = Debug;
};
C64EA79A169F259300778456 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
PRODUCT_NAME = "$(TARGET_NAME)";
+ SDKROOT = macosx;
};
name = Release;
};
@@ -2968,6 +3018,7 @@
);
INFOPLIST_FILE = "../tests-ios/tests-ios-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 6.1;
+ ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = (
"-lctemplate-ios",
"-letpan-ios",
@@ -3003,6 +3054,7 @@
);
INFOPLIST_FILE = "../tests-ios/tests-ios-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 6.1;
+ ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
OTHER_LDFLAGS = (
"-lctemplate-ios",
@@ -3061,6 +3113,7 @@
C6BD289E170BD71100A91AC1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
COMBINE_HIDPI_IMAGES = YES;
@@ -3085,6 +3138,7 @@
"-lz",
);
PRODUCT_NAME = MailCore;
+ SDKROOT = macosx;
WRAPPER_EXTENSION = framework;
};
name = Debug;
@@ -3092,6 +3146,7 @@
C6BD289F170BD71100A91AC1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
COMBINE_HIDPI_IMAGES = YES;
@@ -3116,6 +3171,7 @@
"-lz",
);
PRODUCT_NAME = MailCore;
+ SDKROOT = macosx;
WRAPPER_EXTENSION = framework;
};
name = Release;
diff --git a/build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/mailcore osx.xcscheme b/build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/mailcore osx.xcscheme
new file mode 100644
index 00000000..da69f296
--- /dev/null
+++ b/build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/mailcore osx.xcscheme
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "0500"
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C6BD288C170BD71100A91AC1"
+ BuildableName = "MailCore.framework"
+ BlueprintName = "mailcore osx"
+ ReferencedContainer = "container:mailcore2.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ </Testables>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ allowLocationSimulation = "YES">
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release"
+ debugDocumentVersioning = "YES">
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
diff --git a/build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/static mailcore2 ios.xcscheme b/build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/static mailcore2 ios.xcscheme
new file mode 100644
index 00000000..71bb1afe
--- /dev/null
+++ b/build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/static mailcore2 ios.xcscheme
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "0500"
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C6BA2B091705F4E6003F0E9E"
+ BuildableName = "libMailCore-ios.a"
+ BlueprintName = "static mailcore2 ios"
+ ReferencedContainer = "container:mailcore2.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ </Testables>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ allowLocationSimulation = "YES">
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release"
+ debugDocumentVersioning = "YES">
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
diff --git a/build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/static mailcore2 osx.xcscheme b/build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/static mailcore2 osx.xcscheme
new file mode 100644
index 00000000..414b66d8
--- /dev/null
+++ b/build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/static mailcore2 osx.xcscheme
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "0500"
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C64EA536169E772200778456"
+ BuildableName = "libMailCore.a"
+ BlueprintName = "static mailcore2 osx"
+ ReferencedContainer = "container:mailcore2.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ </Testables>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ allowLocationSimulation = "YES">
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release"
+ debugDocumentVersioning = "YES">
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
diff --git a/build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/test-ios.xcscheme b/build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/test-ios.xcscheme
new file mode 100644
index 00000000..100c2da6
--- /dev/null
+++ b/build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/test-ios.xcscheme
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "0500"
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C6A81B901706840C00882C15"
+ BuildableName = "test-ios.app"
+ BlueprintName = "test-ios"
+ ReferencedContainer = "container:mailcore2.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ </Testables>
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C6A81B901706840C00882C15"
+ BuildableName = "test-ios.app"
+ BlueprintName = "test-ios"
+ ReferencedContainer = "container:mailcore2.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ allowLocationSimulation = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C6A81B901706840C00882C15"
+ BuildableName = "test-ios.app"
+ BlueprintName = "test-ios"
+ ReferencedContainer = "container:mailcore2.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release"
+ debugDocumentVersioning = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C6A81B901706840C00882C15"
+ BuildableName = "test-ios.app"
+ BlueprintName = "test-ios"
+ ReferencedContainer = "container:mailcore2.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
diff --git a/build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/tests.xcscheme b/build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/tests.xcscheme
new file mode 100644
index 00000000..0cf7361a
--- /dev/null
+++ b/build-mac/mailcore2.xcodeproj/xcshareddata/xcschemes/tests.xcscheme
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "0500"
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C64EA78B169F259200778456"
+ BuildableName = "tests"
+ BlueprintName = "tests"
+ ReferencedContainer = "container:mailcore2.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ </Testables>
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C64EA78B169F259200778456"
+ BuildableName = "tests"
+ BlueprintName = "tests"
+ ReferencedContainer = "container:mailcore2.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ allowLocationSimulation = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C64EA78B169F259200778456"
+ BuildableName = "tests"
+ BlueprintName = "tests"
+ ReferencedContainer = "container:mailcore2.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release"
+ debugDocumentVersioning = "YES">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "C64EA78B169F259200778456"
+ BuildableName = "tests"
+ BlueprintName = "tests"
+ ReferencedContainer = "container:mailcore2.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
diff --git a/example/ios/iOS UI Test/iOS UI Test.xcodeproj/project.pbxproj b/example/ios/iOS UI Test/iOS UI Test.xcodeproj/project.pbxproj
index da41f157..e8555f85 100644
--- a/example/ios/iOS UI Test/iOS UI Test.xcodeproj/project.pbxproj
+++ b/example/ios/iOS UI Test/iOS UI Test.xcodeproj/project.pbxproj
@@ -493,7 +493,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.1;
- ONLY_ACTIVE_ARCH = YES;
+ ONLY_ACTIVE_ARCH = NO;
SDKROOT = iphoneos;
};
name = Debug;
@@ -517,6 +517,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 6.1;
+ ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
@@ -552,6 +553,7 @@
AB9EAE2A170368F000D750C7 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CLANG_CXX_LIBRARY = "libstdc++";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "iOS UI Test/iOS UI Test-Prefix.pch";
INFOPLIST_FILE = "iOS UI Test/iOS UI Test-Info.plist";
diff --git a/example/mac/macExample/macExample/AppDelegate.m b/example/mac/macExample/macExample/AppDelegate.m
index 5081f8a5..7be4bfc2 100644
--- a/example/mac/macExample/macExample/AppDelegate.m
+++ b/example/mac/macExample/macExample/AppDelegate.m
@@ -146,7 +146,7 @@ finishedRefreshWithFetcher:(GTMHTTPFetcher *)fetcher
self.checkOp = [self.session checkAccountOperation];
self.session.connectionLogger = ^(void * connectionID, MCOConnectionLogType type, NSData * data) {
if (type != MCOConnectionLogTypeSentPrivate) {
- NSLog(@"event logged:%p %i withData: %@", connectionID, type, [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
+ NSLog(@"event logged:%p %i withData: %@", connectionID, type, [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]);
}
};
diff --git a/scripts/build-mailcore2-ios.sh b/scripts/build-mailcore2-ios.sh
index 9e54dea6..a505fce0 100755
--- a/scripts/build-mailcore2-ios.sh
+++ b/scripts/build-mailcore2-ios.sh
@@ -1,6 +1,13 @@
#!/bin/sh
-sdkversion=6.1
+if xcodebuild -showsdks|grep iphoneos6.1 >/dev/null ; then
+ sdkversion=6.1
+elif xcodebuild -showsdks|grep iphoneos7.0 >/dev/null ; then
+ sdkversion=7.0
+else
+ echo SDK not found
+ exit 1
+fi
url="https://github.com/MailCore/mailcore2.git"
pushd `dirname $0` > /dev/null
diff --git a/scripts/prepare-ctemplate-ios.sh b/scripts/prepare-ctemplate-ios.sh
index 50521f57..5185cb98 100755
--- a/scripts/prepare-ctemplate-ios.sh
+++ b/scripts/prepare-ctemplate-ios.sh
@@ -2,7 +2,14 @@
url="https://github.com/dinhviethoa/ctemplate"
-sdkversion="6.1"
+if xcodebuild -showsdks|grep iphoneos6.1 >/dev/null ; then
+ sdkversion=6.1
+elif xcodebuild -showsdks|grep iphoneos7.0 >/dev/null ; then
+ sdkversion=7.0
+else
+ echo SDK not found
+ exit 1
+fi
pushd `dirname $0` > /dev/null
scriptpath=`pwd`
diff --git a/scripts/prepare-icu4c-ios.sh b/scripts/prepare-icu4c-ios.sh
index 854802f1..b09daff7 100755
--- a/scripts/prepare-icu4c-ios.sh
+++ b/scripts/prepare-icu4c-ios.sh
@@ -1,6 +1,14 @@
#!/bin/sh
-sdkversion=6.1
+if xcodebuild -showsdks|grep iphoneos6.1 >/dev/null ; then
+ sdkversion=6.1
+elif xcodebuild -showsdks|grep iphoneos7.0 >/dev/null ; then
+ sdkversion=7.0
+else
+ echo SDK not found
+ exit 1
+fi
+
versionfolder='51.1'
version='51_1'
build_version="$version~1"
diff --git a/scripts/prepare-libetpan-ios.sh b/scripts/prepare-libetpan-ios.sh
index fad34498..e8b9494c 100755
--- a/scripts/prepare-libetpan-ios.sh
+++ b/scripts/prepare-libetpan-ios.sh
@@ -1,8 +1,16 @@
#!/bin/sh
-sdkversion=6.1
+if xcodebuild -showsdks|grep iphoneos6.1 >/dev/null ; then
+ sdkversion=6.1
+elif xcodebuild -showsdks|grep iphoneos7.0 >/dev/null ; then
+ sdkversion=7.0
+else
+ echo SDK not found
+ exit 1
+fi
+
url="https://github.com/dinhviethoa/libetpan.git"
-rev=4b8e42fc53509a6933451e326a1a258f403162fa
+rev=df052805726c7825ea7dce127b5df501cbf62238
pushd `dirname $0` > /dev/null
scriptpath=`pwd`
diff --git a/scripts/prepare-libetpan-macos.sh b/scripts/prepare-libetpan-macos.sh
index 4283e232..071b8fef 100755
--- a/scripts/prepare-libetpan-macos.sh
+++ b/scripts/prepare-libetpan-macos.sh
@@ -1,7 +1,7 @@
#!/bin/sh
url="https://github.com/dinhviethoa/libetpan.git"
-rev=4b8e42fc53509a6933451e326a1a258f403162fa
+rev=df052805726c7825ea7dce127b5df501cbf62238
pushd `dirname $0` > /dev/null
scriptpath=`pwd`
diff --git a/scripts/prepare-tidy-ios.sh b/scripts/prepare-tidy-ios.sh
index 53989950..f48f9726 100755
--- a/scripts/prepare-tidy-ios.sh
+++ b/scripts/prepare-tidy-ios.sh
@@ -1,6 +1,13 @@
#!/bin/sh
-sdkversion=6.1
+if xcodebuild -showsdks|grep iphoneos6.1 >/dev/null ; then
+ sdkversion=6.1
+elif xcodebuild -showsdks|grep iphoneos7.0 >/dev/null ; then
+ sdkversion=7.0
+else
+ echo SDK not found
+ exit 1
+fi
url="https://github.com/dinhviethoa/tidy-html5.git"
pushd `dirname $0` > /dev/null
diff --git a/scripts/travis/before-script.sh b/scripts/travis/before-script.sh
index 45b429fa..b8753159 100755
--- a/scripts/travis/before-script.sh
+++ b/scripts/travis/before-script.sh
@@ -2,4 +2,5 @@
set -e
brew update
-brew install xctool
+#brew install xctool
+brew install cmake
diff --git a/scripts/travis/script.sh b/scripts/travis/script.sh
index d9dfa28b..5d0813ea 100755
--- a/scripts/travis/script.sh
+++ b/scripts/travis/script.sh
@@ -2,17 +2,23 @@
set -e
echo Building library for iPhoneOS
-xcodebuild -project build-mac/mailcore2.xcodeproj -sdk iphoneos6.1 -target "static mailcore2 ios" build > /dev/null
+xctool -project build-mac/mailcore2.xcodeproj -sdk iphoneos6.1 -scheme "static mailcore2 ios" build
echo Building library for iPhoneSimulator
-xcodebuild -project build-mac/mailcore2.xcodeproj -sdk iphonesimulator6.1 -target "static mailcore2 ios" build > /dev/null
+xctool -project build-mac/mailcore2.xcodeproj -sdk iphonesimulator6.1 -scheme "static mailcore2 ios" build
#echo Link test for iPhoneOS
#xcodebuild -project build-mac/mailcore2.xcodeproj -sdk iphoneos6.1 -target "test-ios" CODE_SIGN_IDENTITY="" build
echo Link test for iPhoneSimulator
-xcodebuild -project build-mac/mailcore2.xcodeproj -sdk iphonesimulator6.1 -target "test-ios" build > /dev/null
+xctool -project build-mac/mailcore2.xcodeproj -sdk iphonesimulator6.1 -scheme "test-ios" build
echo Building library for Mac
-xcodebuild -project build-mac/mailcore2.xcodeproj -sdk macosx10.8 -target "static mailcore2 osx" build > /dev/null
+xctool -project build-mac/mailcore2.xcodeproj -sdk macosx10.8 -scheme "static mailcore2 osx" build
echo Building framework for Mac
-xcodebuild -project build-mac/mailcore2.xcodeproj -sdk macosx10.8 -target "mailcore osx" build > /dev/null
+xctool -project build-mac/mailcore2.xcodeproj -sdk macosx10.8 -scheme "mailcore osx" build
echo Link test for Mac
-xcodebuild -project build-mac/mailcore2.xcodeproj -sdk macosx10.8 -target "tests" build > /dev/null
+xctool -project build-mac/mailcore2.xcodeproj -sdk macosx10.8 -scheme "tests" build
+
+echo Testing CMake build
+mkdir -p build-cmake
+cd build-cmake
+cmake ..
+make
diff --git a/src/async/imap/MCAsyncIMAP.h b/src/async/imap/MCAsyncIMAP.h
index a6bf40d0..b1184fe7 100644..100755
--- a/src/async/imap/MCAsyncIMAP.h
+++ b/src/async/imap/MCAsyncIMAP.h
@@ -22,11 +22,13 @@
#include <MailCore/MCIMAPFolderStatusOperation.h>
#include <MailCore/MCIMAPSession.h>
#include <MailCore/MCIMAPNamespace.h>
+#include <MailCore/MCIMAPIdentity.h>
#include <MailCore/MCIMAPSearchOperation.h>
#include <MailCore/MCIMAPSearchExpression.h>
#include <MailCore/MCIMAPFetchNamespaceOperation.h>
#include <MailCore/MCIMAPIdentityOperation.h>
#include <MailCore/MCIMAPCapabilityOperation.h>
+#include <MailCore/MCIMAPQuotaOperation.h>
#include <MailCore/MCIMAPOperationCallback.h>
#include <MailCore/MCIMAPMessageRenderingOperation.h>
diff --git a/src/async/imap/MCIMAPAsyncConnection.cc b/src/async/imap/MCIMAPAsyncConnection.cc
index 85c411a8..d1322687 100644..100755
--- a/src/async/imap/MCIMAPAsyncConnection.cc
+++ b/src/async/imap/MCIMAPAsyncConnection.cc
@@ -30,11 +30,13 @@
#include "MCIMAPIdleOperation.h"
#include "MCIMAPIdentityOperation.h"
#include "MCIMAPCapabilityOperation.h"
+#include "MCIMAPQuotaOperation.h"
#include "MCOperationQueueCallback.h"
#include "MCIMAPDisconnectOperation.h"
#include "MCIMAPAsyncSession.h"
#include "MCConnectionLogger.h"
#include "MCIMAPMessageRenderingOperation.h"
+#include "MCIMAPIdentity.h"
using namespace mailcore;
@@ -48,12 +50,16 @@ namespace mailcore {
virtual ~IMAPOperationQueueCallback() {
}
- virtual void queueStartRunning(OperationQueue * queue) {
+ virtual void queueStartRunning() {
+ mConnection->setQueueRunning(true);
+ mConnection->owner()->operationRunningStateChanged();
mConnection->queueStartRunning();
}
- virtual void queueStoppedRunning(OperationQueue * queue) {
+ virtual void queueStoppedRunning() {
+ mConnection->setQueueRunning(false);
mConnection->tryAutomaticDisconnect();
+ mConnection->owner()->operationRunningStateChanged();
mConnection->queueStoppedRunning();
}
@@ -85,7 +91,7 @@ IMAPAsyncConnection::IMAPAsyncConnection()
mSession = new IMAPSession();
mQueue = new OperationQueue();
mDefaultNamespace = NULL;
- mDelimiter = 0;
+ mClientIdentity = new IMAPIdentity();
mLastFolder = NULL;
mQueueCallback = new IMAPOperationQueueCallback(this);
mQueue->setCallback(mQueueCallback);
@@ -93,6 +99,8 @@ IMAPAsyncConnection::IMAPAsyncConnection()
mConnectionLogger = NULL;
pthread_mutex_init(&mConnectionLoggerLock, NULL);
mInternalLogger = new IMAPConnectionLogger(this);
+ mAutomaticConfigurationEnabled = true;
+ mQueueRunning = false;
}
IMAPAsyncConnection::~IMAPAsyncConnection()
@@ -102,6 +110,7 @@ IMAPAsyncConnection::~IMAPAsyncConnection()
MC_SAFE_RELEASE(mInternalLogger);
MC_SAFE_RELEASE(mQueueCallback);
MC_SAFE_RELEASE(mLastFolder);
+ MC_SAFE_RELEASE(mClientIdentity);
MC_SAFE_RELEASE(mDefaultNamespace);
MC_SAFE_RELEASE(mQueue);
MC_SAFE_RELEASE(mSession);
@@ -207,26 +216,28 @@ bool IMAPAsyncConnection::isVoIPEnabled()
return mSession->isVoIPEnabled();
}
-void IMAPAsyncConnection::setDelimiter(char delimiter)
+void IMAPAsyncConnection::setDefaultNamespace(IMAPNamespace * ns)
{
- mSession->setDelimiter(delimiter);
- mDelimiter = delimiter;
+ mSession->setDefaultNamespace(ns);
+ MC_SAFE_REPLACE_RETAIN(IMAPNamespace, mDefaultNamespace, ns);
}
-char IMAPAsyncConnection::delimiter()
+IMAPNamespace * IMAPAsyncConnection::defaultNamespace()
{
- return mDelimiter;
+ return mDefaultNamespace;
}
-void IMAPAsyncConnection::setDefaultNamespace(IMAPNamespace * ns)
+void IMAPAsyncConnection::setClientIdentity(IMAPIdentity * identity)
{
- mSession->setDefaultNamespace(ns);
- MC_SAFE_REPLACE_RETAIN(IMAPNamespace, mDefaultNamespace, ns);
+ MC_SAFE_REPLACE_COPY(IMAPIdentity, mClientIdentity, identity);
+ mc_foreacharray(String, key, identity->allInfoKeys()) {
+ mSession->clientIdentity()->setInfoForKey(key, identity->infoForKey(key));
+ }
}
-IMAPNamespace * IMAPAsyncConnection::defaultNamespace()
+IMAPIdentity * IMAPAsyncConnection::clientIdentity()
{
- return mDefaultNamespace;
+ return mClientIdentity;
}
IMAPFolderInfoOperation * IMAPAsyncConnection::folderInfoOperation(String * folder)
@@ -467,13 +478,11 @@ IMAPFetchNamespaceOperation * IMAPAsyncConnection::fetchNamespaceOperation()
return op;
}
-IMAPIdentityOperation * IMAPAsyncConnection::identityOperation(String * vendor, String * name, String * version)
+IMAPIdentityOperation * IMAPAsyncConnection::identityOperation(IMAPIdentity * identity)
{
IMAPIdentityOperation * op = new IMAPIdentityOperation();
op->setSession(this);
- op->setVendor(vendor);
- op->setName(name);
- op->setVersion(version);
+ op->setClientIdentity(identity);
op->autorelease();
return op;
}
@@ -494,6 +503,14 @@ IMAPCapabilityOperation * IMAPAsyncConnection::capabilityOperation()
return op;
}
+IMAPQuotaOperation * IMAPAsyncConnection::quotaOperation()
+{
+ IMAPQuotaOperation * op = new IMAPQuotaOperation();
+ op->setSession(this);
+ op->autorelease();
+ return op;
+}
+
IMAPSession * IMAPAsyncConnection::session()
{
return mSession;
@@ -630,3 +647,24 @@ IMAPMessageRenderingOperation * IMAPAsyncConnection::plainTextBodyRenderingOpera
{
return renderingOperation(message, folder, IMAPMessageRenderingTypePlainTextBody);
}
+
+void IMAPAsyncConnection::setAutomaticConfigurationEnabled(bool enabled)
+{
+ mAutomaticConfigurationEnabled = enabled;
+ mSession->setAutomaticConfigurationEnabled(enabled);
+}
+
+bool IMAPAsyncConnection::isAutomaticConfigurationEnabled()
+{
+ return mAutomaticConfigurationEnabled;
+}
+
+bool IMAPAsyncConnection::isQueueRunning()
+{
+ return mQueueRunning;
+}
+
+void IMAPAsyncConnection::setQueueRunning(bool running)
+{
+ mQueueRunning = running;
+}
diff --git a/src/async/imap/MCIMAPAsyncConnection.h b/src/async/imap/MCIMAPAsyncConnection.h
index 45acb707..9f1b9d47 100644..100755
--- a/src/async/imap/MCIMAPAsyncConnection.h
+++ b/src/async/imap/MCIMAPAsyncConnection.h
@@ -25,11 +25,13 @@ namespace mailcore {
class IMAPFetchNamespaceOperation;
class IMAPIdentityOperation;
class IMAPCapabilityOperation;
+ class IMAPQuotaOperation;
class IMAPOperationQueueCallback;
class IMAPAsyncSession;
class IMAPConnectionLogger;
class IMAPMessageRenderingOperation;
class IMAPMessage;
+ class IMAPIdentity;
class IMAPAsyncConnection : public Object {
public:
@@ -66,12 +68,16 @@ namespace mailcore {
virtual void setVoIPEnabled(bool enabled);
virtual bool isVoIPEnabled();
- virtual void setDelimiter(char delimiter);
- virtual char delimiter();
+ virtual void setAutomaticConfigurationEnabled(bool enabled);
+ virtual bool isAutomaticConfigurationEnabled();
+ // Needs to be run before starting a connection.
virtual void setDefaultNamespace(IMAPNamespace * ns);
virtual IMAPNamespace * defaultNamespace();
+ virtual void setClientIdentity(IMAPIdentity * identity);
+ virtual IMAPIdentity * clientIdentity();
+
virtual void setConnectionLogger(ConnectionLogger * logger);
virtual ConnectionLogger * connectionLogger();
@@ -115,11 +121,12 @@ namespace mailcore {
virtual IMAPFetchNamespaceOperation * fetchNamespaceOperation();
- virtual IMAPIdentityOperation * identityOperation(String * vendor, String * name, String * version);
+ virtual IMAPIdentityOperation * identityOperation(IMAPIdentity * identity);
virtual IMAPOperation * checkAccountOperation();
virtual IMAPCapabilityOperation * capabilityOperation();
+ virtual IMAPQuotaOperation * quotaOperation();
virtual IMAPMessageRenderingOperation * htmlRenderingOperation(IMAPMessage * message, String * folder);
virtual IMAPMessageRenderingOperation * htmlBodyRenderingOperation(IMAPMessage * message, String * folder);
@@ -130,14 +137,16 @@ namespace mailcore {
private:
IMAPSession * mSession;
OperationQueue * mQueue;
- char mDelimiter;
IMAPNamespace * mDefaultNamespace;
+ IMAPIdentity * mClientIdentity;
String * mLastFolder;
IMAPOperationQueueCallback * mQueueCallback;
IMAPAsyncSession * mOwner;
ConnectionLogger * mConnectionLogger;
IMAPConnectionLogger * mInternalLogger;
pthread_mutex_t mConnectionLoggerLock;
+ bool mAutomaticConfigurationEnabled;
+ bool mQueueRunning;
virtual void tryAutomaticDisconnectAfterDelay(void * context);
virtual IMAPMessageRenderingOperation * renderingOperation(IMAPMessage * message,
@@ -161,6 +170,9 @@ namespace mailcore {
virtual IMAPAsyncSession * owner();
virtual void logConnection(ConnectionLogType logType, Data * buffer);
+
+ virtual bool isQueueRunning();
+ virtual void setQueueRunning(bool running);
};
}
diff --git a/src/async/imap/MCIMAPAsyncSession.cc b/src/async/imap/MCIMAPAsyncSession.cc
index 7aa37d83..5fe9a61b 100644..100755
--- a/src/async/imap/MCIMAPAsyncSession.cc
+++ b/src/async/imap/MCIMAPAsyncSession.cc
@@ -12,6 +12,8 @@
#include "MCIMAPNamespace.h"
#include "MCOperationQueueCallback.h"
#include "MCConnectionLogger.h"
+#include "MCIMAPSession.h"
+#include "MCIMAPIdentity.h"
#define DEFAULT_MAX_CONNECTIONS 3
@@ -32,14 +34,19 @@ IMAPAsyncSession::IMAPAsyncSession()
mConnectionType = ConnectionTypeClear;
mCheckCertificateEnabled = true;
mVoIPEnabled = true;
- mDelimiter = 0;
mDefaultNamespace = NULL;
mTimeout = 30.;
mConnectionLogger = NULL;
+ mAutomaticConfigurationDone = false;
+ mServerIdentity = new IMAPIdentity();
+ mClientIdentity = new IMAPIdentity();
+ mOperationQueueCallback = NULL;
}
IMAPAsyncSession::~IMAPAsyncSession()
{
+ MC_SAFE_RELEASE(mServerIdentity);
+ MC_SAFE_RELEASE(mClientIdentity);
MC_SAFE_RELEASE(mSessions);
MC_SAFE_RELEASE(mHostname);
MC_SAFE_RELEASE(mUsername);
@@ -148,17 +155,6 @@ bool IMAPAsyncSession::isVoIPEnabled()
return mVoIPEnabled;
}
-
-void IMAPAsyncSession::setDelimiter(char delimiter)
-{
- mDelimiter = delimiter;
-}
-
-char IMAPAsyncSession::delimiter()
-{
- return mDelimiter;
-}
-
IMAPNamespace * IMAPAsyncSession::defaultNamespace()
{
return mDefaultNamespace;
@@ -189,6 +185,16 @@ unsigned int IMAPAsyncSession::maximumConnections()
return mMaximumConnections;
}
+IMAPIdentity * IMAPAsyncSession::serverIdentity()
+{
+ return mServerIdentity;
+}
+
+IMAPIdentity * IMAPAsyncSession::clientIdentity()
+{
+ return mClientIdentity;
+}
+
IMAPAsyncConnection * IMAPAsyncSession::session()
{
IMAPAsyncConnection * session = new IMAPAsyncConnection();
@@ -206,8 +212,13 @@ IMAPAsyncConnection * IMAPAsyncSession::session()
session->setTimeout(mTimeout);
session->setCheckCertificateEnabled(mCheckCertificateEnabled);
session->setVoIPEnabled(mVoIPEnabled);
- session->setDelimiter(mDelimiter);
session->setDefaultNamespace(mDefaultNamespace);
+ session->setClientIdentity(mClientIdentity);
+#if 0 // should be implemented properly
+ if (mAutomaticConfigurationDone) {
+ session->setAutomaticConfigurationEnabled(false);
+ }
+#endif
return session;
}
@@ -431,10 +442,10 @@ IMAPFetchNamespaceOperation * IMAPAsyncSession::fetchNamespaceOperation()
return session->fetchNamespaceOperation();
}
-IMAPIdentityOperation * IMAPAsyncSession::identityOperation(String * vendor, String * name, String * version)
+IMAPIdentityOperation * IMAPAsyncSession::identityOperation(IMAPIdentity * identity)
{
IMAPAsyncConnection * session = sessionForFolder(MCSTR("INBOX"));
- return session->identityOperation(vendor, name, version);
+ return session->identityOperation(identity);
}
IMAPOperation * IMAPAsyncSession::checkAccountOperation()
@@ -449,6 +460,12 @@ IMAPCapabilityOperation * IMAPAsyncSession::capabilityOperation()
return session->capabilityOperation();
}
+IMAPQuotaOperation * IMAPAsyncSession::quotaOperation()
+{
+ IMAPAsyncConnection * session = sessionForFolder(MCSTR("INBOX"));
+ return session->quotaOperation();
+}
+
void IMAPAsyncSession::setConnectionLogger(ConnectionLogger * logger)
{
mConnectionLogger = logger;
@@ -489,4 +506,50 @@ IMAPMessageRenderingOperation * IMAPAsyncSession::plainTextBodyRenderingOperatio
{
IMAPAsyncConnection * session = sessionForFolder(folder);
return session->plainTextBodyRenderingOperation(message, folder);
+}
+
+void IMAPAsyncSession::automaticConfigurationDone(IMAPSession * session)
+{
+ MC_SAFE_REPLACE_COPY(IMAPIdentity, mServerIdentity, session->serverIdentity());
+ setDefaultNamespace(session->defaultNamespace());
+ mAutomaticConfigurationDone = true;
+}
+
+void IMAPAsyncSession::setOperationQueueCallback(OperationQueueCallback * callback)
+{
+ mOperationQueueCallback = callback;
+}
+
+OperationQueueCallback * IMAPAsyncSession::operationQueueCallback()
+{
+ return mOperationQueueCallback;
+}
+
+bool IMAPAsyncSession::isOperationQueueRunning()
+{
+ return mQueueRunning;
+}
+
+void IMAPAsyncSession::operationRunningStateChanged()
+{
+ bool isRunning = false;
+ for(unsigned int i = 0 ; i < mSessions->count() ; i ++) {
+ IMAPAsyncConnection * currentSession = (IMAPAsyncConnection *) mSessions->objectAtIndex(i);
+ if (currentSession->isQueueRunning()){
+ isRunning = true;
+ break;
+ }
+ }
+ if (mQueueRunning == isRunning) {
+ return;
+ }
+ mQueueRunning = isRunning;
+ if (mOperationQueueCallback != NULL) {
+ if (isRunning) {
+ mOperationQueueCallback->queueStartRunning();
+ }
+ else {
+ mOperationQueueCallback->queueStoppedRunning();
+ }
+ }
} \ No newline at end of file
diff --git a/src/async/imap/MCIMAPAsyncSession.h b/src/async/imap/MCIMAPAsyncSession.h
index 68e8899a..10af928d 100644..100755
--- a/src/async/imap/MCIMAPAsyncSession.h
+++ b/src/async/imap/MCIMAPAsyncSession.h
@@ -33,8 +33,12 @@ namespace mailcore {
class IMAPIdentityOperation;
class IMAPAsyncConnection;
class IMAPCapabilityOperation;
+ class IMAPQuotaOperation;
class IMAPMessageRenderingOperation;
class IMAPMessage;
+ class IMAPSession;
+ class IMAPIdentity;
+ class OperationQueueCallback;
class IMAPAsyncSession : public Object {
public:
@@ -73,9 +77,6 @@ namespace mailcore {
virtual void setVoIPEnabled(bool enabled);
virtual bool isVoIPEnabled();
- virtual void setDelimiter(char delimiter);
- virtual char delimiter();
-
virtual void setDefaultNamespace(IMAPNamespace * ns);
virtual IMAPNamespace * defaultNamespace();
@@ -88,6 +89,13 @@ namespace mailcore {
virtual void setConnectionLogger(ConnectionLogger * logger);
virtual ConnectionLogger * connectionLogger();
+ virtual void setOperationQueueCallback(OperationQueueCallback * callback);
+ virtual OperationQueueCallback * operationQueueCallback();
+ virtual bool isOperationQueueRunning();
+
+ virtual IMAPIdentity * serverIdentity();
+ virtual IMAPIdentity * clientIdentity();
+
virtual IMAPFolderInfoOperation * folderInfoOperation(String * folder);
virtual IMAPFolderStatusOperation * folderStatusOperation(String * folder);
@@ -128,17 +136,22 @@ namespace mailcore {
virtual IMAPFetchNamespaceOperation * fetchNamespaceOperation();
- virtual IMAPIdentityOperation * identityOperation(String * vendor, String * name, String * version);
+ virtual IMAPIdentityOperation * identityOperation(IMAPIdentity * identity);
virtual IMAPOperation * checkAccountOperation();
virtual IMAPCapabilityOperation * capabilityOperation();
+ virtual IMAPQuotaOperation * quotaOperation();
virtual IMAPMessageRenderingOperation * htmlRenderingOperation(IMAPMessage * message, String * folder);
virtual IMAPMessageRenderingOperation * htmlBodyRenderingOperation(IMAPMessage * message, String * folder);
virtual IMAPMessageRenderingOperation * plainTextRenderingOperation(IMAPMessage * message, String * folder);
virtual IMAPMessageRenderingOperation * plainTextBodyRenderingOperation(IMAPMessage * message, String * folder);
-
+
+ public: // private
+ virtual void automaticConfigurationDone(IMAPSession * session);
+ virtual void operationRunningStateChanged();
+
private:
Array * mSessions;
@@ -151,12 +164,16 @@ namespace mailcore {
ConnectionType mConnectionType;
bool mCheckCertificateEnabled;
bool mVoIPEnabled;
- char mDelimiter;
IMAPNamespace * mDefaultNamespace;
time_t mTimeout;
bool mAllowsFolderConcurrentAccessEnabled;
unsigned int mMaximumConnections;
ConnectionLogger * mConnectionLogger;
+ bool mAutomaticConfigurationDone;
+ IMAPIdentity * mServerIdentity;
+ IMAPIdentity * mClientIdentity;
+ bool mQueueRunning;
+ OperationQueueCallback * mOperationQueueCallback;
virtual IMAPAsyncConnection * sessionForFolder(String * folder, bool urgent = false);
virtual IMAPAsyncConnection * session();
diff --git a/src/async/imap/MCIMAPCapabilityOperation.cc b/src/async/imap/MCIMAPCapabilityOperation.cc
index 30bf1e3c..9edb9b1c 100644
--- a/src/async/imap/MCIMAPCapabilityOperation.cc
+++ b/src/async/imap/MCIMAPCapabilityOperation.cc
@@ -31,6 +31,11 @@ IndexSet * IMAPCapabilityOperation::capabilities()
void IMAPCapabilityOperation::main()
{
ErrorCode error;
+ session()->session()->loginIfNeeded(&error);
+ if (error != ErrorNone) {
+ setError(error);
+ return;
+ }
mCapabilities = session()->session()->capability(&error);
MC_SAFE_RETAIN(mCapabilities);
setError(error);
diff --git a/src/async/imap/MCIMAPFetchFoldersOperation.cc b/src/async/imap/MCIMAPFetchFoldersOperation.cc
index 41a95572..e1f121e8 100644
--- a/src/async/imap/MCIMAPFetchFoldersOperation.cc
+++ b/src/async/imap/MCIMAPFetchFoldersOperation.cc
@@ -52,15 +52,4 @@ void IMAPFetchFoldersOperation::main()
}
MC_SAFE_RETAIN(mFolders);
setError(error);
-
- char * delimiterData = (char *) malloc(1);
- * delimiterData = session()->session()->delimiter();
- performMethodOnMainThread((Object::Method) &IMAPFetchFoldersOperation::setDelimiterDataOnMainThread,
- delimiterData, true);
-}
-
-void IMAPFetchFoldersOperation::setDelimiterDataOnMainThread(char * delimiterData)
-{
- session()->setDelimiter(* delimiterData);
- free(delimiterData);
}
diff --git a/src/async/imap/MCIMAPFetchFoldersOperation.h b/src/async/imap/MCIMAPFetchFoldersOperation.h
index c59bf85a..057df493 100644
--- a/src/async/imap/MCIMAPFetchFoldersOperation.h
+++ b/src/async/imap/MCIMAPFetchFoldersOperation.h
@@ -35,7 +35,6 @@ namespace mailcore {
String * /* IMAPFolder */ mFolder;
bool mFetchSubscribedEnabled;
Array * mFolders;
- void setDelimiterDataOnMainThread(char * delimiterData);
};
}
diff --git a/src/async/imap/MCIMAPIdentityOperation.cc b/src/async/imap/MCIMAPIdentityOperation.cc
index 469163d7..0dc035e5 100644
--- a/src/async/imap/MCIMAPIdentityOperation.cc
+++ b/src/async/imap/MCIMAPIdentityOperation.cc
@@ -10,56 +10,33 @@
#include "MCIMAPSession.h"
#include "MCIMAPAsyncConnection.h"
+#include "MCIMAPIdentity.h"
using namespace mailcore;
IMAPIdentityOperation::IMAPIdentityOperation()
{
- mVendor = NULL;
- mName = NULL;
- mVersion = NULL;
+ mClientIdentity = NULL;
mServerIdentity = NULL;
}
IMAPIdentityOperation::~IMAPIdentityOperation()
{
- MC_SAFE_RELEASE(mVendor);
- MC_SAFE_RELEASE(mName);
- MC_SAFE_RELEASE(mVersion);
+ MC_SAFE_RELEASE(mClientIdentity);
MC_SAFE_RELEASE(mServerIdentity);
}
-void IMAPIdentityOperation::setVendor(String * vendor)
+void IMAPIdentityOperation::setClientIdentity(IMAPIdentity * identity)
{
- MC_SAFE_REPLACE_COPY(String, mVendor, vendor);
+ MC_SAFE_REPLACE_COPY(IMAPIdentity, mClientIdentity, identity);
}
-String * IMAPIdentityOperation::vendor()
+IMAPIdentity * IMAPIdentityOperation::clientIdentity()
{
- return mVendor;
+ return mClientIdentity;
}
-void IMAPIdentityOperation::setName(String * name)
-{
- MC_SAFE_REPLACE_COPY(String, mName, name);
-}
-
-String * IMAPIdentityOperation::name()
-{
- return mName;
-}
-
-void IMAPIdentityOperation::setVersion(String * version)
-{
- MC_SAFE_REPLACE_COPY(String, mVersion, version);
-}
-
-String * IMAPIdentityOperation::version()
-{
- return mVersion;
-}
-
-HashMap * IMAPIdentityOperation::serverIdentity()
+IMAPIdentity * IMAPIdentityOperation::serverIdentity()
{
return mServerIdentity;
}
@@ -67,7 +44,7 @@ HashMap * IMAPIdentityOperation::serverIdentity()
void IMAPIdentityOperation::main()
{
ErrorCode error;
- mServerIdentity = session()->session()->identity(mVendor, mName, mVersion, &error);
+ mServerIdentity = session()->session()->identity(mClientIdentity, &error);
MC_SAFE_RETAIN(mServerIdentity);
setError(error);
}
diff --git a/src/async/imap/MCIMAPIdentityOperation.h b/src/async/imap/MCIMAPIdentityOperation.h
index 069918cf..16f592a5 100644
--- a/src/async/imap/MCIMAPIdentityOperation.h
+++ b/src/async/imap/MCIMAPIdentityOperation.h
@@ -16,31 +16,25 @@
namespace mailcore {
+ class IMAPIdentity;
+
class IMAPIdentityOperation : public IMAPOperation {
public:
IMAPIdentityOperation();
virtual ~IMAPIdentityOperation();
- virtual void setVendor(String * vendor);
- virtual String * vendor();
-
- virtual void setName(String * name);
- virtual String * name();
-
- virtual void setVersion(String * version);
- virtual String * version();
+ virtual void setClientIdentity(IMAPIdentity * identity);
+ virtual IMAPIdentity * clientIdentity();
// Result.
- virtual HashMap * serverIdentity();
+ virtual IMAPIdentity * serverIdentity();
public: // subclass behavior
virtual void main();
private:
- String * mVendor;
- String * mName;
- String * mVersion;
- HashMap * mServerIdentity;
+ IMAPIdentity * mClientIdentity;
+ IMAPIdentity * mServerIdentity;
};
}
diff --git a/src/async/imap/MCIMAPOperation.cc b/src/async/imap/MCIMAPOperation.cc
index 35eedd6c..1211a73b 100644
--- a/src/async/imap/MCIMAPOperation.cc
+++ b/src/async/imap/MCIMAPOperation.cc
@@ -10,6 +10,7 @@
#include <stdlib.h>
+#include "MCIMAPAsyncSession.h"
#include "MCIMAPSession.h"
#include "MCIMAPAsyncConnection.h"
#include "MCIMAPOperationCallback.h"
@@ -133,3 +134,15 @@ void IMAPOperation::itemsProgressOnMainThread(void * ctx)
free(context);
release();
}
+
+void IMAPOperation::beforeMain()
+{
+}
+
+void IMAPOperation::afterMain()
+{
+ if (mSession->session()->isAutomaticConfigurationDone()) {
+ mSession->owner()->automaticConfigurationDone(mSession->session());
+ mSession->session()->resetAutomaticConfigurationDone();
+ }
+}
diff --git a/src/async/imap/MCIMAPOperation.h b/src/async/imap/MCIMAPOperation.h
index f7e937db..e7dcb9a5 100644
--- a/src/async/imap/MCIMAPOperation.h
+++ b/src/async/imap/MCIMAPOperation.h
@@ -34,6 +34,9 @@ namespace mailcore {
virtual void setImapCallback(IMAPOperationCallback * callback);
virtual IMAPOperationCallback * imapCallback();
+ virtual void beforeMain();
+ virtual void afterMain();
+
virtual void start();
// Result.
diff --git a/src/async/imap/MCIMAPQuotaOperation.cc b/src/async/imap/MCIMAPQuotaOperation.cc
new file mode 100644
index 00000000..6744ac4b
--- /dev/null
+++ b/src/async/imap/MCIMAPQuotaOperation.cc
@@ -0,0 +1,41 @@
+//
+// MCIMAPQuotaOperation.cc
+// mailcore2
+//
+// Created by Petro Korenev on 8/2/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#include "MCIMAPQuotaOperation.h"
+
+#include "MCIMAPSession.h"
+#include "MCIMAPAsyncConnection.h"
+
+using namespace mailcore;
+
+IMAPQuotaOperation::IMAPQuotaOperation()
+{
+ mLimit = 0;
+ mUsage = 0;
+}
+
+IMAPQuotaOperation::~IMAPQuotaOperation()
+{
+}
+
+uint32_t IMAPQuotaOperation::limit()
+{
+ return mLimit;
+}
+
+uint32_t IMAPQuotaOperation::usage()
+{
+ return mUsage;
+}
+
+void IMAPQuotaOperation::main()
+{
+ ErrorCode error;
+ session()->session()->getQuota(&mUsage, &mLimit, &error);
+ setError(error);
+}
diff --git a/src/async/imap/MCIMAPQuotaOperation.h b/src/async/imap/MCIMAPQuotaOperation.h
new file mode 100644
index 00000000..5cef943c
--- /dev/null
+++ b/src/async/imap/MCIMAPQuotaOperation.h
@@ -0,0 +1,39 @@
+//
+// MCIMAPQuotaOperation.h
+// mailcore2
+//
+// Created by Petro Korenev on 8/2/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#ifndef __MAILCORE_MCIMAPQuotaOperation_H_
+
+#define __MAILCORE_MCIMAPQuotaOperation_H_
+
+#include "MCIMAPOperation.h"
+
+#ifdef __cplusplus
+
+namespace mailcore {
+
+ class IMAPQuotaOperation : public IMAPOperation {
+ public:
+ IMAPQuotaOperation();
+ virtual ~IMAPQuotaOperation();
+
+ // Result.
+ virtual uint32_t limit();
+ virtual uint32_t usage();
+
+ public: // subclass behavior
+ virtual void main();
+
+ private:
+ uint32_t mLimit;
+ uint32_t mUsage;
+ };
+}
+
+#endif
+
+#endif
diff --git a/src/async/pop/MCPOPAsyncSession.cc b/src/async/pop/MCPOPAsyncSession.cc
index bfabc847..f5334542 100644
--- a/src/async/pop/MCPOPAsyncSession.cc
+++ b/src/async/pop/MCPOPAsyncSession.cc
@@ -29,11 +29,11 @@ namespace mailcore {
virtual ~POPOperationQueueCallback() {
}
- virtual void queueStartRunning(OperationQueue * queue) {
+ virtual void queueStartRunning() {
mSession->retain();
}
- virtual void queueStoppedRunning(OperationQueue * queue) {
+ virtual void queueStoppedRunning() {
mSession->release();
}
diff --git a/src/async/smtp/MCSMTPAsyncSession.cc b/src/async/smtp/MCSMTPAsyncSession.cc
index f670894a..605f267a 100644
--- a/src/async/smtp/MCSMTPAsyncSession.cc
+++ b/src/async/smtp/MCSMTPAsyncSession.cc
@@ -19,11 +19,11 @@ namespace mailcore {
virtual ~SMTPOperationQueueCallback() {
}
- virtual void queueStartRunning(OperationQueue * queue) {
+ virtual void queueStartRunning() {
mSession->retain();
}
- virtual void queueStoppedRunning(OperationQueue * queue) {
+ virtual void queueStoppedRunning() {
mSession->tryAutomaticDisconnect();
mSession->release();
}
@@ -211,6 +211,17 @@ SMTPOperation * SMTPAsyncSession::sendMessageOperation(Data * messageData)
return (SMTPOperation *) op->autorelease();
}
+SMTPOperation * SMTPAsyncSession::sendMessageOperation(Address * from, Array * recipients,
+ Data * messageData)
+{
+ SMTPSendWithDataOperation * op = new SMTPSendWithDataOperation();
+ op->setSession(this);
+ op->setMessageData(messageData);
+ op->setFrom(from);
+ op->setRecipients(recipients);
+ return (SMTPOperation *) op->autorelease();
+}
+
SMTPOperation * SMTPAsyncSession::checkAccountOperation(Address * from)
{
SMTPCheckAccountOperation * op = new SMTPCheckAccountOperation();
diff --git a/src/async/smtp/MCSMTPAsyncSession.h b/src/async/smtp/MCSMTPAsyncSession.h
index bbb81737..f013dc26 100644
--- a/src/async/smtp/MCSMTPAsyncSession.h
+++ b/src/async/smtp/MCSMTPAsyncSession.h
@@ -55,6 +55,8 @@ namespace mailcore {
virtual ConnectionLogger * connectionLogger();
virtual SMTPOperation * sendMessageOperation(Data * messageData);
+ virtual SMTPOperation * sendMessageOperation(Address * from, Array * recipients,
+ Data * messageData);
virtual SMTPOperation * checkAccountOperation(Address * from);
public: // private
diff --git a/src/async/smtp/MCSMTPSendWithDataOperation.cc b/src/async/smtp/MCSMTPSendWithDataOperation.cc
index bb2c5ea9..03f6a530 100644
--- a/src/async/smtp/MCSMTPSendWithDataOperation.cc
+++ b/src/async/smtp/MCSMTPSendWithDataOperation.cc
@@ -16,10 +16,14 @@ using namespace mailcore;
SMTPSendWithDataOperation::SMTPSendWithDataOperation()
{
mMessageData = NULL;
+ mFrom = NULL;
+ mRecipients = NULL;
}
SMTPSendWithDataOperation::~SMTPSendWithDataOperation()
{
+ MC_SAFE_RELEASE(mFrom);
+ MC_SAFE_RELEASE(mRecipients);
MC_SAFE_RELEASE(mMessageData);
}
@@ -33,9 +37,34 @@ Data * SMTPSendWithDataOperation::messageData()
return mMessageData;
}
+void SMTPSendWithDataOperation::setFrom(Address * from)
+{
+ MC_SAFE_REPLACE_COPY(Address, mFrom, from);
+}
+
+Address * SMTPSendWithDataOperation::from()
+{
+ return mFrom;
+}
+
+void SMTPSendWithDataOperation::setRecipients(Array * recipients)
+{
+ MC_SAFE_REPLACE_COPY(Array, mRecipients, recipients);
+}
+
+Array * SMTPSendWithDataOperation::recipients()
+{
+ return mRecipients;
+}
+
void SMTPSendWithDataOperation::main()
{
ErrorCode error;
- session()->session()->sendMessage(mMessageData, this, &error);
+ if ((mFrom != NULL) && (mRecipients != NULL)) {
+ session()->session()->sendMessage(mFrom, mRecipients, mMessageData, this, &error);
+ }
+ else {
+ session()->session()->sendMessage(mMessageData, this, &error);
+ }
setError(error);
}
diff --git a/src/async/smtp/MCSMTPSendWithDataOperation.h b/src/async/smtp/MCSMTPSendWithDataOperation.h
index afa1a5e0..6c407bb3 100644
--- a/src/async/smtp/MCSMTPSendWithDataOperation.h
+++ b/src/async/smtp/MCSMTPSendWithDataOperation.h
@@ -23,6 +23,12 @@ namespace mailcore {
SMTPSendWithDataOperation();
virtual ~SMTPSendWithDataOperation();
+ virtual void setFrom(Address * from);
+ virtual Address * from();
+
+ virtual void setRecipients(Array * recipients);
+ virtual Array * recipients();
+
virtual void setMessageData(Data * data);
virtual Data * messageData();
@@ -31,6 +37,8 @@ namespace mailcore {
private:
Data * mMessageData;
+ Array * mRecipients;
+ Address * mFrom;
};
}
diff --git a/src/cmake/async.cmake b/src/cmake/async.cmake
index 8b4857ea..a002d7c5 100644
--- a/src/cmake/async.cmake
+++ b/src/cmake/async.cmake
@@ -21,6 +21,7 @@ set(async_imap_files
async/imap/MCIMAPIdleOperation.cc
async/imap/MCIMAPMessageRenderingOperation.cc
async/imap/MCIMAPOperation.cc
+ async/imap/MCIMAPQuotaOperation.cc
async/imap/MCIMAPRenameFolderOperation.cc
async/imap/MCIMAPSearchOperation.cc
async/imap/MCIMAPStoreFlagsOperation.cc
diff --git a/src/cmake/core.cmake b/src/cmake/core.cmake
index f2678ad1..a7ba18c9 100644
--- a/src/cmake/core.cmake
+++ b/src/cmake/core.cmake
@@ -21,6 +21,7 @@ set(basetypes_files
core/basetypes/MCArray.cc
core/basetypes/MCAssert.c
core/basetypes/MCAutoreleasePool.cc
+ core/basetypes/MCBase64.c
core/basetypes/MCConnectionLoggerUtils.cc
core/basetypes/MCData.cc
core/basetypes/MCHash.cc
@@ -46,6 +47,7 @@ set(basetypes_files
set(imap_files
core/imap/MCIMAPFolder.cc
core/imap/MCIMAPFolderStatus.cc
+ core/imap/MCIMAPIdentity.cc
core/imap/MCIMAPMessage.cc
core/imap/MCIMAPMessagePart.cc
core/imap/MCIMAPMultipart.cc
@@ -99,6 +101,10 @@ set(zip_files
core/zip/MiniZip/zip.c
)
+set(security_files
+ core/security/MCCertificateUtils.cc
+)
+
set(core_files
${basetypes_files}
${abstract_files}
@@ -106,6 +112,7 @@ set(core_files
${pop_files}
${renderer_files}
${rfc822_files}
+ ${security_files}
${smtp_files}
${zip_files}
)
@@ -121,6 +128,7 @@ set(core_includes
${CMAKE_CURRENT_SOURCE_DIR}/core/provider
${CMAKE_CURRENT_SOURCE_DIR}/core/renderer
${CMAKE_CURRENT_SOURCE_DIR}/core/rfc822
+ ${CMAKE_CURRENT_SOURCE_DIR}/core/security
${CMAKE_CURRENT_SOURCE_DIR}/core/smtp
${CMAKE_CURRENT_SOURCE_DIR}/core/zip
${CMAKE_CURRENT_SOURCE_DIR}/core/zip/MiniZip
diff --git a/src/cmake/objc.cmake b/src/cmake/objc.cmake
index 57a8c317..e3e461c9 100644
--- a/src/cmake/objc.cmake
+++ b/src/cmake/objc.cmake
@@ -1,6 +1,6 @@
# Files to build
-set(async_objc_abstract
+set(objc_abstract_files
objc/abstract/MCOAbstractMessage.mm
objc/abstract/MCOAbstractMessagePart.mm
objc/abstract/MCOAbstractMessageRendererCallback.mm
@@ -10,7 +10,7 @@ set(async_objc_abstract
objc/abstract/MCOMessageHeader.mm
)
-set(async_objc_imap
+set(objc_imap_files
objc/imap/MCOIMAPAppendMessageOperation.mm
objc/imap/MCOIMAPBaseOperation.mm
objc/imap/MCOIMAPCapabilityOperation.mm
@@ -22,8 +22,9 @@ set(async_objc_imap
objc/imap/MCOIMAPFolder.mm
objc/imap/MCOIMAPFolderInfo.m
objc/imap/MCOIMAPFolderInfoOperation.mm
- objc/imap/MCOIMAPFolderStatus.m
+ objc/imap/MCOIMAPFolderStatus.mm
objc/imap/MCOIMAPFolderStatusOperation.mm
+ objc/imap/MCOIMAPIdentity.mm
objc/imap/MCOIMAPIdentityOperation.mm
objc/imap/MCOIMAPIdleOperation.mm
objc/imap/MCOIMAPMessage.mm
@@ -34,12 +35,13 @@ set(async_objc_imap
objc/imap/MCOIMAPNamespaceItem.mm
objc/imap/MCOIMAPOperation.mm
objc/imap/MCOIMAPPart.mm
+ objc/imap/MCOIMAPQuotaOperation.mm
objc/imap/MCOIMAPSearchExpression.mm
objc/imap/MCOIMAPSearchOperation.mm
objc/imap/MCOIMAPSession.mm
)
-set(async_objc_pop
+set(objc_pop_files
objc/pop/MCOPOPFetchHeaderOperation.mm
objc/pop/MCOPOPFetchMessageOperation.mm
objc/pop/MCOPOPFetchMessagesOperation.mm
@@ -48,13 +50,13 @@ set(async_objc_pop
objc/pop/MCOPOPSession.mm
)
-set(async_objc_provider
+set(objc_provider_files
objc/provider/MCOMailProvider.mm
objc/provider/MCOMailProvidersManager.mm
objc/provider/MCONetService.mm
)
-set(async_objc_rfc822
+set(objc_rfc822_files
objc/rfc822/MCOAttachment.mm
objc/rfc822/MCOMessageBuilder.mm
objc/rfc822/MCOMessageParser.mm
@@ -62,13 +64,13 @@ set(async_objc_rfc822
objc/rfc822/MCOMultipart.mm
)
-set(async_objc_smtp
+set(objc_smtp_files
objc/smtp/MCOSMTPOperation.mm
objc/smtp/MCOSMTPSendOperation.mm
objc/smtp/MCOSMTPSession.mm
)
-set(async_objc_utils
+set(objc_utils_files
objc/utils/MCOIndexSet.mm
objc/utils/MCOObjectWrapper.mm
objc/utils/MCOOperation.mm
@@ -83,13 +85,13 @@ set(async_objc_utils
)
IF(APPLE)
-set(async_objc
- ${async_objc_abstract}
- ${async_objc_imap}
- ${async_objc_pop}
- ${async_objc_rfc822}
- ${async_objc_smtp}
- ${async_objc_utils}
+set(objc_files
+ ${objc_abstract_files}
+ ${objc_imap_files}
+ ${objc_pop_files}
+ ${objc_rfc822_files}
+ ${objc_smtp_files}
+ ${objc_utils_files}
)
ENDIF()
diff --git a/src/cmake/public-headers.cmake b/src/cmake/public-headers.cmake
index 41409f59..8395072a 100644
--- a/src/cmake/public-headers.cmake
+++ b/src/cmake/public-headers.cmake
@@ -47,6 +47,7 @@ core/imap/MCIMAPSearchExpression.h
core/imap/MCIMAPSession.h
core/imap/MCIMAPSyncResult.h
core/imap/MCIMAPFolderStatus.h
+core/imap/MCIMAPIdentity.h
core/pop/MCPOP.h
core/pop/MCPOPMessageInfo.h
core/pop/MCPOPProgressCallback.h
@@ -88,6 +89,7 @@ async/imap/MCIMAPSearchOperation.h
async/imap/MCIMAPFetchNamespaceOperation.h
async/imap/MCIMAPIdentityOperation.h
async/imap/MCIMAPCapabilityOperation.h
+async/imap/MCIMAPQuotaOperation.h
async/imap/MCIMAPOperationCallback.h
async/imap/MCIMAPMessageRenderingOperation.h
async/pop/MCAsyncPOP.h
@@ -131,6 +133,7 @@ objc/imap/MCOIMAPMessagePart.h
objc/imap/MCOIMAPMultipart.h
objc/imap/MCOIMAPNamespace.h
objc/imap/MCOIMAPNamespaceItem.h
+objc/imap/MCOIMAPIdentity.h
objc/imap/MCOIMAPPart.h
objc/imap/MCOIMAPFolderInfoOperation.h
objc/imap/MCOIMAPFolderInfo.h
@@ -145,6 +148,7 @@ objc/imap/MCOIMAPIdleOperation.h
objc/imap/MCOIMAPFetchNamespaceOperation.h
objc/imap/MCOIMAPIdentityOperation.h
objc/imap/MCOIMAPCapabilityOperation.h
+objc/imap/MCOIMAPQuotaOperation.h
objc/imap/MCOIMAPSearchExpression.h
objc/imap/MCOIMAPMessageRenderingOperation.h
objc/rfc822/MCORFC822.h
diff --git a/src/core/abstract/MCAbstractPart.cc b/src/core/abstract/MCAbstractPart.cc
index d7b57544..c2646d36 100644
--- a/src/core/abstract/MCAbstractPart.cc
+++ b/src/core/abstract/MCAbstractPart.cc
@@ -364,5 +364,4 @@ void AbstractPart::importSerializable(HashMap * serializable)
setPartType(PartTypeMultipartAlternative);
}
}
- PartType mPartType;
}
diff --git a/src/core/abstract/MCMessageConstants.h b/src/core/abstract/MCMessageConstants.h
index a245eac3..30ce0efc 100644
--- a/src/core/abstract/MCMessageConstants.h
+++ b/src/core/abstract/MCMessageConstants.h
@@ -123,6 +123,7 @@ namespace mailcore {
IMAPCapabilityAuthSKey,
IMAPCapabilityAuthSRP,
IMAPCapabilityXOAuth2,
+ IMAPCapabilityGmail,
};
enum POPCapability {
@@ -207,6 +208,7 @@ namespace mailcore {
ErrorDeleteMessage,
ErrorInvalidAccount,
ErrorFile,
+ ErrorCompression,
};
enum PartType {
diff --git a/src/core/abstract/MCMessageHeader.cc b/src/core/abstract/MCMessageHeader.cc
index 6dd1cdd1..34aba8f5 100644
--- a/src/core/abstract/MCMessageHeader.cc
+++ b/src/core/abstract/MCMessageHeader.cc
@@ -1,6 +1,7 @@
#include "MCMessageHeader.h"
#include "MCAddress.h"
+#include "MCIterator.h"
#include <string.h>
#include <unistd.h>
diff --git a/src/core/basetypes/MCArray.cc b/src/core/basetypes/MCArray.cc
index a59e3648..c4c0fee1 100644
--- a/src/core/basetypes/MCArray.cc
+++ b/src/core/basetypes/MCArray.cc
@@ -229,7 +229,7 @@ String * Array::componentsJoinedByString(String * delimiter)
String * result = String::string();
for(unsigned int i = 0 ; i < count() ; i ++) {
Object * obj = objectAtIndex(i);
- if (result != 0) {
+ if (i != 0) {
result->appendString(delimiter);
}
result->appendString(obj->description());
diff --git a/src/core/basetypes/MCAutoreleasePool.cc b/src/core/basetypes/MCAutoreleasePool.cc
index 8c351bdf..67e58a78 100644
--- a/src/core/basetypes/MCAutoreleasePool.cc
+++ b/src/core/basetypes/MCAutoreleasePool.cc
@@ -60,13 +60,9 @@ carray * AutoreleasePool::createAutoreleasePoolStackIfNeeded()
return stack;
}
-void AutoreleasePool::destroyAutoreleasePoolStack(void *)
+void AutoreleasePool::destroyAutoreleasePoolStack(void * value)
{
- init();
- carray * stack = (carray *) pthread_getspecific(autoreleasePoolStackKey);
- if (stack == NULL)
- return;
-
+ carray * stack = (carray *) value;
if (carray_count(stack) != 0) {
MCLog("some autoreleasepool have not been released\n");
}
diff --git a/src/core/basetypes/MCObject.cc b/src/core/basetypes/MCObject.cc
index fff2055d..e792a1fd 100644
--- a/src/core/basetypes/MCObject.cc
+++ b/src/core/basetypes/MCObject.cc
@@ -272,15 +272,15 @@ void Object::initObjectConstructors()
constructors = chash_new(CHASH_DEFAULTSIZE, CHASH_COPYKEY);
}
-void Object::registerObjectConstructor(char * className, void * (* objectConstructor)(void))
+void Object::registerObjectConstructor(const char * className, void * (* objectConstructor)(void))
{
static pthread_once_t once = PTHREAD_ONCE_INIT;
pthread_once(&once, initObjectConstructors);
chashdatum key;
chashdatum value;
- key.data = className;
- key.len = strlen(className);
+ key.data = (void *) className;
+ key.len = (unsigned int) strlen(className);
value.data = (void *) objectConstructor;
value.len = 0;
chash_set(constructors, &key, &value, NULL);
@@ -297,7 +297,7 @@ Object * Object::objectWithSerializable(HashMap * serializable)
chashdatum value;
const char * className = ((String *) serializable->objectForKey(MCSTR("class")))->UTF8Characters();
key.data = (void *) className;
- key.len = strlen(className);
+ key.len = (unsigned int) strlen(className);
int r = chash_get(constructors, &key, &value);
if (r < 0)
return NULL;
diff --git a/src/core/basetypes/MCObject.h b/src/core/basetypes/MCObject.h
index 6bde74e5..77f7e06e 100644
--- a/src/core/basetypes/MCObject.h
+++ b/src/core/basetypes/MCObject.h
@@ -44,7 +44,7 @@ namespace mailcore {
virtual void cancelDelayedPerformMethod(Method method, void * context);
// serialization utils
- static void registerObjectConstructor(char * className, void * (* objectConstructor)(void));
+ static void registerObjectConstructor(const char * className, void * (* objectConstructor)(void));
static Object * objectWithSerializable(HashMap * serializable);
public: // private
diff --git a/src/core/basetypes/MCOperation.cc b/src/core/basetypes/MCOperation.cc
index d42a0598..73a8d7cd 100644
--- a/src/core/basetypes/MCOperation.cc
+++ b/src/core/basetypes/MCOperation.cc
@@ -40,10 +40,18 @@ bool Operation::isCancelled()
return value;
}
+void Operation::beforeMain()
+{
+}
+
void Operation::main()
{
}
+void Operation::afterMain()
+{
+}
+
void Operation::start()
{
}
diff --git a/src/core/basetypes/MCOperation.h b/src/core/basetypes/MCOperation.h
index 71d0b465..bb77dbb1 100644
--- a/src/core/basetypes/MCOperation.h
+++ b/src/core/basetypes/MCOperation.h
@@ -18,11 +18,17 @@ namespace mailcore {
virtual void setCallback(OperationCallback * callback);
virtual OperationCallback * callback();
-
+
virtual void cancel();
virtual bool isCancelled();
+ // Will be called on main thread.
+ virtual void beforeMain();
+
virtual void main();
+
+ // Will be called on main thread.
+ virtual void afterMain();
virtual void start();
diff --git a/src/core/basetypes/MCOperationQueue.cc b/src/core/basetypes/MCOperationQueue.cc
index 9c30ad22..2c00f930 100644
--- a/src/core/basetypes/MCOperationQueue.cc
+++ b/src/core/basetypes/MCOperationQueue.cc
@@ -84,6 +84,8 @@ void OperationQueue::runOperations()
break;
}
+ performMethodOnMainThread((Object::Method) &OperationQueue::beforeMain, op, true);
+
op->main();
op->retain()->autorelease();
@@ -99,9 +101,7 @@ void OperationQueue::runOperations()
pthread_mutex_unlock(&mLock);
if (!op->isCancelled()) {
- if (op->callback() != NULL) {
- performMethodOnMainThread((Object::Method) &OperationQueue::callbackOnMainThread, op, true);
- }
+ performMethodOnMainThread((Object::Method) &OperationQueue::callbackOnMainThread, op, true);
}
if (needsCheckRunning) {
@@ -115,8 +115,15 @@ void OperationQueue::runOperations()
MCLog("cleanup thread %p", this);
}
+void OperationQueue::beforeMain(Operation * op)
+{
+ op->beforeMain();
+}
+
void OperationQueue::callbackOnMainThread(Operation * op)
{
+ op->afterMain();
+
if (op->isCancelled())
return;
@@ -159,7 +166,7 @@ void OperationQueue::stoppedOnMainThread(void * context)
mStarted = false;
if (mCallback) {
- mCallback->queueStoppedRunning(this);
+ mCallback->queueStoppedRunning();
}
release(); // (2)
@@ -173,7 +180,7 @@ void OperationQueue::startThread()
return;
if (mCallback) {
- mCallback->queueStartRunning(this);
+ mCallback->queueStartRunning();
}
retain(); // (3)
diff --git a/src/core/basetypes/MCOperationQueue.h b/src/core/basetypes/MCOperationQueue.h
index ddfe9de2..0518d62f 100644
--- a/src/core/basetypes/MCOperationQueue.h
+++ b/src/core/basetypes/MCOperationQueue.h
@@ -43,6 +43,7 @@ namespace mailcore {
void startThread();
static void runOperationsOnThread(OperationQueue * queue);
void runOperations();
+ void beforeMain(Operation * op);
void callbackOnMainThread(Operation * op);
void checkRunningOnMainThread(void * context);
void checkRunningAfterDelay(void * context);
diff --git a/src/core/basetypes/MCOperationQueueCallback.h b/src/core/basetypes/MCOperationQueueCallback.h
index 605de030..367888bb 100644
--- a/src/core/basetypes/MCOperationQueueCallback.h
+++ b/src/core/basetypes/MCOperationQueueCallback.h
@@ -15,8 +15,8 @@ namespace mailcore {
class OperationQueueCallback {
public:
- virtual void queueStartRunning(OperationQueue * queue) {}
- virtual void queueStoppedRunning(OperationQueue * queue) {}
+ virtual void queueStartRunning() {}
+ virtual void queueStoppedRunning() {}
};
}
diff --git a/src/core/basetypes/MCRange.cc b/src/core/basetypes/MCRange.cc
index 7b7e9f41..6a5bba7d 100644
--- a/src/core/basetypes/MCRange.cc
+++ b/src/core/basetypes/MCRange.cc
@@ -4,6 +4,7 @@
#include "MCHashMap.h"
#include "MCString.h"
#include "MCUtils.h"
+#include "MCArray.h"
#include <sys/param.h>
@@ -149,4 +150,9 @@ String * mailcore::RangeToString(Range range)
Range mailcore::RangeFromString(String * rangeString)
{
Array * components = rangeString->componentsSeparatedByString(MCSTR("-"));
+ if (components->count() != 2)
+ return RangeEmpty;
+ String * locationString = (String *) components->objectAtIndex(0);
+ String * lengthString = (String *) components->objectAtIndex(1);
+ return RangeMake(locationString->unsignedLongLongValue(), lengthString->unsignedLongLongValue());
}
diff --git a/src/core/basetypes/MCString.cc b/src/core/basetypes/MCString.cc
index 2f8ab316..cc3b6e91 100644
--- a/src/core/basetypes/MCString.cc
+++ b/src/core/basetypes/MCString.cc
@@ -1850,8 +1850,15 @@ Data * String::dataUsingEncoding(const char * charset)
Data * data;
data = NULL;
- CFStringRef encodingName = CFStringCreateWithCString(NULL, charset, kCFStringEncodingUTF8);
- CFStringEncoding encoding = CFStringConvertIANACharSetNameToEncoding(encodingName);
+ CFStringEncoding encoding;
+ if (strcasecmp(charset, "mutf-7") == 0) {
+ encoding = kCFStringEncodingUTF7_IMAP;
+ }
+ else {
+ CFStringRef encodingName = CFStringCreateWithCString(NULL, charset, kCFStringEncodingUTF8);
+ encoding = CFStringConvertIANACharSetNameToEncoding(encodingName);
+ CFRelease(encodingName);
+ }
CFStringRef cfStr = CFStringCreateWithBytes(NULL, (const UInt8 *) mUnicodeChars,
(CFIndex) mLength * sizeof(* mUnicodeChars), kCFStringEncodingUTF16LE, false);
if (cfStr != NULL) {
@@ -1863,7 +1870,6 @@ Data * String::dataUsingEncoding(const char * charset)
}
CFRelease(cfStr);
}
- CFRelease(encodingName);
return data;
#else
@@ -2125,8 +2131,8 @@ bool String::isEqualCaseInsensitive(String * otherString)
Data * String::decodedBase64Data()
{
const char * utf8 = UTF8Characters();
- char * decoded = MCDecodeBase64(utf8, strlen(utf8));
- Data * result = Data::dataWithBytes(decoded, strlen(decoded));
+ char * decoded = MCDecodeBase64(utf8, (unsigned int) strlen(utf8));
+ Data * result = Data::dataWithBytes(decoded, (unsigned int) strlen(decoded));
free(decoded);
return result;
}
diff --git a/src/core/basetypes/MCValue.cc b/src/core/basetypes/MCValue.cc
index 11dbc79f..db9e96eb 100644
--- a/src/core/basetypes/MCValue.cc
+++ b/src/core/basetypes/MCValue.cc
@@ -76,6 +76,7 @@ String * Value::description()
return String::stringWithUTF8Format("<Value:%p:data>", this);
default:
MCAssert(0);
+ return NULL;
}
}
diff --git a/src/core/imap/MCIMAP.h b/src/core/imap/MCIMAP.h
index 0248882a..3faddea1 100644
--- a/src/core/imap/MCIMAP.h
+++ b/src/core/imap/MCIMAP.h
@@ -14,5 +14,6 @@
#include <MailCore/MCIMAPSession.h>
#include <MailCore/MCIMAPSyncResult.h>
#include <MailCore/MCIMAPFolderStatus.h>
+#include <MailCore/MCIMAPIdentity.h>
#endif
diff --git a/src/core/imap/MCIMAPIdentity.cc b/src/core/imap/MCIMAPIdentity.cc
new file mode 100644
index 00000000..2e22d539
--- /dev/null
+++ b/src/core/imap/MCIMAPIdentity.cc
@@ -0,0 +1,97 @@
+//
+// MCIMAPIdentity.cpp
+// mailcore2
+//
+// Created by Hoa V. DINH on 8/24/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#include "MCIMAPIdentity.h"
+
+using namespace mailcore;
+
+IMAPIdentity::IMAPIdentity()
+{
+ init();
+}
+
+IMAPIdentity::IMAPIdentity(IMAPIdentity * identity)
+{
+ init();
+ mc_foreachhashmapKeyAndValue(String, key, String, value, identity->mValues) {
+ mValues->setObjectForKey(key, value);
+ }
+}
+
+void IMAPIdentity::init()
+{
+ mValues = new HashMap();
+}
+
+IMAPIdentity::~IMAPIdentity()
+{
+ MC_SAFE_RELEASE(mValues);
+}
+
+void IMAPIdentity::setVendor(String * vendor)
+{
+ setInfoForKey(MCSTR("vendor"), vendor);
+}
+
+String * IMAPIdentity::vendor()
+{
+ return infoForKey(MCSTR("vendor"));
+}
+
+void IMAPIdentity::setName(String * name)
+{
+ setInfoForKey(MCSTR("name"), name);
+}
+
+String * IMAPIdentity::name()
+{
+ return infoForKey(MCSTR("name"));
+}
+
+void IMAPIdentity::setVersion(String * version)
+{
+ setInfoForKey(MCSTR("version"), version);
+}
+
+String * IMAPIdentity::version()
+{
+ return infoForKey(MCSTR("version"));
+}
+
+Array * IMAPIdentity::allInfoKeys()
+{
+ return mValues->allKeys();
+}
+
+String * IMAPIdentity::infoForKey(String * key)
+{
+ return (String *) mValues->objectForKey(key);
+}
+
+void IMAPIdentity::setInfoForKey(String * key, String * value)
+{
+ if (value != NULL) {
+ mValues->setObjectForKey(key, value->copy()->autorelease());
+ }
+ else {
+ mValues->removeObjectForKey(key);
+ }
+}
+
+Object * IMAPIdentity::copy()
+{
+ return new IMAPIdentity(this);
+}
+
+String * IMAPIdentity::description()
+{
+ return String::stringWithUTF8Format("<%s:%p %s>", className()->UTF8Characters(), this, MCUTF8DESC(mValues));
+}
+
+
+
diff --git a/src/core/imap/MCIMAPIdentity.h b/src/core/imap/MCIMAPIdentity.h
new file mode 100644
index 00000000..c2565955
--- /dev/null
+++ b/src/core/imap/MCIMAPIdentity.h
@@ -0,0 +1,54 @@
+//
+// MCIMAPIdentity.h
+// mailcore2
+//
+// Created by Hoa V. DINH on 8/24/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#ifndef __MAILCORE_MCIMAPIDENTITY_H
+
+#define __MAILCORE_MCIMAPIDENTITY_H
+
+#include <MailCore/MCBaseTypes.h>
+
+#ifdef __cplusplus
+
+namespace mailcore {
+
+ class IMAPIdentity : public Object {
+ public:
+
+ IMAPIdentity();
+ virtual ~IMAPIdentity();
+
+ virtual void setVendor(String * vendor);
+ virtual String * vendor();
+
+ virtual void setName(String * name);
+ virtual String * name();
+
+ virtual void setVersion(String * version);
+ virtual String * version();
+
+ virtual Array * allInfoKeys();
+ virtual String * infoForKey(String * key);
+ virtual void setInfoForKey(String * key, String * value);
+
+ public: // subclass behavior
+ IMAPIdentity(IMAPIdentity * identity);
+ virtual Object * copy();
+ virtual String * description();
+
+ private:
+ HashMap * mValues;
+
+ void init();
+ };
+
+}
+
+#endif
+
+#endif
+
diff --git a/src/core/imap/MCIMAPMessage.cc b/src/core/imap/MCIMAPMessage.cc
index d8a0d943..74b3459b 100644
--- a/src/core/imap/MCIMAPMessage.cc
+++ b/src/core/imap/MCIMAPMessage.cc
@@ -237,7 +237,7 @@ void IMAPMessage::importSerializable(HashMap * serializable)
}
String * uid = (String *) serializable->objectForKey(MCSTR("uid"));
if (uid != NULL) {
- setUid(uid->unsignedLongValue());
+ setUid((uint32_t) uid->unsignedLongValue());
}
String * flags = (String *) serializable->objectForKey(MCSTR("flags"));
if (flags != NULL) {
diff --git a/src/core/imap/MCIMAPMessage.h b/src/core/imap/MCIMAPMessage.h
index 2f72cd7b..435334c7 100644
--- a/src/core/imap/MCIMAPMessage.h
+++ b/src/core/imap/MCIMAPMessage.h
@@ -18,7 +18,7 @@ namespace mailcore {
class IMAPMessage : public AbstractMessage {
public:
IMAPMessage();
- ~IMAPMessage();
+ virtual ~IMAPMessage();
virtual uint32_t uid();
virtual void setUid(uint32_t uid);
diff --git a/src/core/imap/MCIMAPPart.cc b/src/core/imap/MCIMAPPart.cc
index 76e59021..5fc39fc9 100644
--- a/src/core/imap/MCIMAPPart.cc
+++ b/src/core/imap/MCIMAPPart.cc
@@ -221,7 +221,7 @@ IMAPPart * IMAPPart::attachmentWithIMAPBody1PartBasic(struct mailimap_body_type_
mimeType = String::stringWithUTF8Format("video/%s", basic->bd_media_basic->med_subtype);
break;
case MAILIMAP_MEDIA_BASIC_OTHER:
- mimeType = String::stringWithUTF8Format("other/%s", basic->bd_media_basic->med_subtype);
+ mimeType = String::stringWithUTF8Format("%s/%s", basic->bd_media_basic->med_basic_type, basic->bd_media_basic->med_subtype);
break;
}
attachment->setMimeType(mimeType);
diff --git a/src/core/imap/MCIMAPSession.cc b/src/core/imap/MCIMAPSession.cc
index 7ebe4354..f08ff91a 100644..100755
--- a/src/core/imap/MCIMAPSession.cc
+++ b/src/core/imap/MCIMAPSession.cc
@@ -22,6 +22,7 @@
#include "MCHTMLRendererIMAPDataCallback.h"
#include "MCHTMLBodyRendererTemplateCallback.h"
#include "MCCertificateUtils.h"
+#include "MCIMAPIdentity.h"
using namespace mailcore;
@@ -36,6 +37,8 @@ String * mailcore::IMAPNamespacePersonal = NULL;
String * mailcore::IMAPNamespaceOther = NULL;
String * mailcore::IMAPNamespaceShared = NULL;
+static Array * resultsWithError(int r, clist * list, ErrorCode * pError);
+
__attribute__((constructor))
static void initialize()
{
@@ -333,15 +336,20 @@ void IMAPSession::init()
mQResyncEnabled = false;
mCondstoreEnabled = false;
mIdentityEnabled = false;
+ mNamespaceEnabled = false;
+ mCompressionEnabled = false;
mWelcomeString = NULL;
mNeedsMboxMailWorkaround = false;
mDefaultNamespace = NULL;
+ mServerIdentity = new IMAPIdentity();
+ mClientIdentity = new IMAPIdentity();
mTimeout = 30;
mUIDValidity = 0;
mUIDNext = 0;
mModSequenceValue = 0;
mFolderMsgCount = 0;
mFirstUnseenUid = 0;
+ mYahooServer = false;
mLastFetchedSequenceNumber = 0;
mCurrentFolder = NULL;
pthread_mutex_init(&mIdleLock, NULL);
@@ -351,6 +359,9 @@ void IMAPSession::init()
mProgressCallback = NULL;
mProgressItemsCount = 0;
mConnectionLogger = NULL;
+ mAutomaticConfigurationEnabled = true;
+ mAutomaticConfigurationDone = false;
+ mShouldDisconnect = false;
}
IMAPSession::IMAPSession()
@@ -360,6 +371,7 @@ IMAPSession::IMAPSession()
IMAPSession::~IMAPSession()
{
+ MC_SAFE_RELEASE(mServerIdentity);
MC_SAFE_RELEASE(mHostname);
MC_SAFE_RELEASE(mUsername);
MC_SAFE_RELEASE(mPassword);
@@ -470,16 +482,6 @@ bool IMAPSession::isVoIPEnabled()
return mVoIPEnabled;
}
-void IMAPSession::setDelimiter(char delimiter)
-{
- mDelimiter = delimiter;
-}
-
-char IMAPSession::delimiter()
-{
- return mDelimiter;
-}
-
static bool hasError(int errorCode)
{
return ((errorCode != MAILIMAP_NO_ERROR) && (errorCode != MAILIMAP_NO_ERROR_AUTHENTICATED) &&
@@ -488,6 +490,8 @@ static bool hasError(int errorCode)
bool IMAPSession::checkCertificate()
{
+ if (!isCheckCertificateEnabled())
+ return true;
return mailcore::checkCertificate(mImap->imap_stream, hostname());
}
@@ -576,17 +580,15 @@ void IMAPSession::connect(ErrorCode * pError)
MCLog("STARTTLS connect");
r = mailimap_socket_connect_voip(mImap, MCUTF8(mHostname), mPort, isVoIPEnabled());
if (hasError(r)) {
- unsetup();
* pError = ErrorConnection;
- return;
+ goto close;
}
r = mailimap_socket_starttls(mImap);
if (hasError(r)) {
- unsetup();
MCLog("no TLS %i", r);
* pError = ErrorTLSNotAvailable;
- return;
+ goto close;
}
break;
@@ -594,16 +596,14 @@ void IMAPSession::connect(ErrorCode * pError)
r = mailimap_ssl_connect_voip(mImap, MCUTF8(mHostname), mPort, isVoIPEnabled());
MCLog("ssl connect %s %u %u", MCUTF8(mHostname), mPort, r);
if (hasError(r)) {
- unsetup();
MCLog("connect error %i", r);
* pError = ErrorConnection;
- return;
+ goto close;
}
if (!checkCertificate()) {
- unsetup();
MCLog("ssl connect certificate ERROR %d", r);
* pError = ErrorCertificate;
- return;
+ goto close;
}
break;
@@ -613,10 +613,9 @@ void IMAPSession::connect(ErrorCode * pError)
r = mailimap_socket_connect_voip(mImap, MCUTF8(mHostname), mPort, isVoIPEnabled());
MCLog("socket connect %i", r);
if (hasError(r)) {
- unsetup();
MCLog("connect error %i", r);
* pError = ErrorConnection;
- return;
+ goto close;
}
break;
}
@@ -632,18 +631,40 @@ void IMAPSession::connect(ErrorCode * pError)
if (mImap->imap_response != NULL) {
MC_SAFE_REPLACE_RETAIN(String, mWelcomeString, String::stringWithUTF8Characters(mImap->imap_response));
+ mYahooServer = (mWelcomeString->locationOfString(MCSTR("yahoo.com")) != -1);
}
- * pError = ErrorNone;
mState = STATE_CONNECTED;
+
+ if (isAutomaticConfigurationEnabled()) {
+ if ((mImap->imap_connection_info != NULL) && (mImap->imap_connection_info->imap_capability != NULL)) {
+ // Don't keep result. It will be kept in session state.
+ capabilitySetWithSessionState(IndexSet::indexSet());
+ }
+ else {
+ capability(pError);
+ if (* pError != ErrorNone) {
+ MCLog("capabilities failed");
+ goto close;
+ }
+ }
+ }
+
+ * pError = ErrorNone;
MCLog("connect ok");
- LOCK();
- mCanIdle = true;
- UNLOCK();
+ return;
+
+close:
+ unsetup();
}
void IMAPSession::connectIfNeeded(ErrorCode * pError)
{
+ if (mShouldDisconnect) {
+ disconnect();
+ mShouldDisconnect = false;
+ }
+
if (mState == STATE_DISCONNECTED) {
connect(pError);
}
@@ -674,6 +695,13 @@ void IMAPSession::login(ErrorCode * pError)
MCAssert(mState == STATE_CONNECTED);
+ if (mImap->imap_connection_info != NULL) {
+ if (mImap->imap_connection_info->imap_capability != NULL) {
+ mailimap_capability_data_free(mImap->imap_connection_info->imap_capability);
+ mImap->imap_connection_info->imap_capability = NULL;
+ }
+ }
+
const char * utf8username;
const char * utf8password;
utf8username = MCUTF8(mUsername);
@@ -769,6 +797,7 @@ void IMAPSession::login(ErrorCode * pError)
break;
}
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return;
}
@@ -807,8 +836,79 @@ void IMAPSession::login(ErrorCode * pError)
return;
}
- * pError = ErrorNone;
mState = STATE_LOGGEDIN;
+
+ if (isAutomaticConfigurationEnabled()) {
+ if ((mImap->imap_connection_info != NULL) && (mImap->imap_connection_info->imap_capability != NULL)) {
+ // Don't keep result. It will be kept in session state.
+ capabilitySetWithSessionState(IndexSet::indexSet());
+ }
+ else {
+ capability(pError);
+ if (* pError != ErrorNone) {
+ MCLog("capabilities failed");
+ return;
+ }
+ }
+ }
+ else {
+ // TODO: capabilities should be shared with other sessions for non automatic capabilities sessions.
+ }
+ enableFeatures();
+
+ if (isAutomaticConfigurationEnabled()) {
+ if (isNamespaceEnabled()) {
+ HashMap * result = fetchNamespace(pError);
+ if (* pError != ErrorNone) {
+ MCLog("fetch namespace failed");
+ return;
+ }
+ IMAPNamespace * personalNamespace = (IMAPNamespace *) result->objectForKey(IMAPNamespacePersonal);
+ setDefaultNamespace(personalNamespace);
+ mDelimiter = defaultNamespace()->mainDelimiter();
+ }
+ else {
+ clist * imap_folders;
+ IMAPFolder * folder;
+ Array * folders;
+
+ r = mailimap_list(mImap, "", "", &imap_folders);
+ folders = resultsWithError(r, imap_folders, pError);
+ if (* pError != ErrorNone)
+ return;
+
+ if (folders->count() > 0) {
+ folder = (IMAPFolder *) folders->objectAtIndex(0);
+ }
+ else {
+ folder = NULL;
+ }
+ if (folder == NULL) {
+ * pError = ErrorNonExistantFolder;
+ return;
+ }
+
+ mDelimiter = folder->delimiter();
+ IMAPNamespace * defaultNamespace = IMAPNamespace::namespaceWithPrefix(folder->path(), folder->delimiter());
+ setDefaultNamespace(defaultNamespace);
+ }
+
+ if (isIdentityEnabled()) {
+ IMAPIdentity * serverIdentity = identity(clientIdentity(), pError);
+ if (* pError != ErrorNone) {
+ MCLog("fetch identity failed");
+ return;
+ }
+ MC_SAFE_REPLACE_RETAIN(IMAPIdentity, mServerIdentity, serverIdentity);
+ }
+ }
+ else {
+ // TODO: namespace should be shared with other sessions for non automatic namespace.
+ }
+
+ mAutomaticConfigurationDone = true;
+
+ * pError = ErrorNone;
MCLog("login ok");
}
@@ -874,6 +974,7 @@ void IMAPSession::select(String * folder, ErrorCode * pError)
r = mailimap_select(mImap, MCUTF8(folder));
MCLog("select error : %i", r);
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
MCLog("select error : %s %i", MCUTF8DESC(this), * pError);
return;
@@ -884,6 +985,7 @@ void IMAPSession::select(String * folder, ErrorCode * pError)
}
else if (hasError(r)) {
* pError = ErrorNonExistantFolder;
+ mState = STATE_LOGGEDIN;
MC_SAFE_RELEASE(mCurrentFolder);
return;
}
@@ -947,6 +1049,7 @@ IMAPFolderStatus * IMAPSession::folderStatus(String * folder, ErrorCode * pError
MCLog("status error : %i", r);
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
MCLog("status error : %s %i", MCUTF8DESC(this), * pError);
return fs;
@@ -1124,6 +1227,7 @@ static Array * resultsWithError(int r, clist * list, ErrorCode * pError)
return result;
}
+// Deprecated
char IMAPSession::fetchDelimiterIfNeeded(char defaultDelimiter, ErrorCode * pError)
{
int r;
@@ -1136,6 +1240,8 @@ char IMAPSession::fetchDelimiterIfNeeded(char defaultDelimiter, ErrorCode * pErr
r = mailimap_list(mImap, "", "", &imap_folders);
folders = resultsWithError(r, imap_folders, pError);
+ if (* pError == ErrorConnection)
+ mShouldDisconnect = true;
if (* pError != ErrorNone)
return 0;
@@ -1156,18 +1262,22 @@ Array * /* IMAPFolder */ IMAPSession::fetchSubscribedFolders(ErrorCode * pError)
{
int r;
clist * imap_folders;
- char delimiter;
MCLog("fetch subscribed");
loginIfNeeded(pError);
if (* pError != ErrorNone)
return NULL;
- delimiter = fetchDelimiterIfNeeded(mDelimiter, pError);
- if (* pError != ErrorNone)
- return NULL;
-
- setDelimiter(delimiter);
+ if (mDelimiter == 0) {
+ char delimiter;
+
+ delimiter = fetchDelimiterIfNeeded(mDelimiter, pError);
+ if (* pError != ErrorNone)
+ return NULL;
+
+ //setDelimiter(delimiter);
+ mDelimiter = delimiter;
+ }
String * prefix;
prefix = defaultNamespace()->mainPrefix();
@@ -1175,31 +1285,38 @@ Array * /* IMAPFolder */ IMAPSession::fetchSubscribedFolders(ErrorCode * pError)
prefix = MCSTR("");
}
if (prefix->length() > 0) {
- if (!prefix->hasSuffix(String::stringWithUTF8Format("%c", delimiter))) {
- prefix = prefix->stringByAppendingUTF8Format("%c", delimiter);
+ if (!prefix->hasSuffix(String::stringWithUTF8Format("%c", mDelimiter))) {
+ prefix = prefix->stringByAppendingUTF8Format("%c", mDelimiter);
}
}
r = mailimap_lsub(mImap, MCUTF8(prefix), "*", &imap_folders);
MCLog("fetch subscribed %u", r);
- return resultsWithError(r, imap_folders, pError);
+ Array * result = resultsWithError(r, imap_folders, pError);
+ if (* pError == ErrorConnection)
+ mShouldDisconnect = true;
+ return result;
}
Array * /* IMAPFolder */ IMAPSession::fetchAllFolders(ErrorCode * pError)
{
int r;
clist * imap_folders;
- char delimiter;
loginIfNeeded(pError);
if (* pError != ErrorNone)
return NULL;
- delimiter = fetchDelimiterIfNeeded(mDelimiter, pError);
- if (* pError != ErrorNone)
- return NULL;
-
- setDelimiter(delimiter);
+ if (mDelimiter == 0) {
+ char delimiter;
+
+ delimiter = fetchDelimiterIfNeeded(mDelimiter, pError);
+ if (* pError != ErrorNone)
+ return NULL;
+
+ //setDelimiter(delimiter);
+ mDelimiter = delimiter;
+ }
String * prefix = NULL;
if (defaultNamespace()) {
@@ -1209,8 +1326,8 @@ Array * /* IMAPFolder */ IMAPSession::fetchAllFolders(ErrorCode * pError)
prefix = MCSTR("");
}
if (prefix->length() > 0) {
- if (!prefix->hasSuffix(String::stringWithUTF8Format("%c", delimiter))) {
- prefix = prefix->stringByAppendingUTF8Format("%c", delimiter);
+ if (!prefix->hasSuffix(String::stringWithUTF8Format("%c", mDelimiter))) {
+ prefix = prefix->stringByAppendingUTF8Format("%c", mDelimiter);
}
}
@@ -1220,7 +1337,10 @@ Array * /* IMAPFolder */ IMAPSession::fetchAllFolders(ErrorCode * pError)
else {
r = mailimap_list(mImap, MCUTF8(prefix), "*", &imap_folders);
}
- return resultsWithError(r, imap_folders, pError);
+ Array * result = resultsWithError(r, imap_folders, pError);
+ if (* pError == ErrorConnection)
+ mShouldDisconnect = true;
+ return result;
}
void IMAPSession::renameFolder(String * folder, String * otherName, ErrorCode * pError)
@@ -1233,6 +1353,7 @@ void IMAPSession::renameFolder(String * folder, String * otherName, ErrorCode *
r = mailimap_rename(mImap, MCUTF8(folder), MCUTF8(otherName));
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return;
}
@@ -1257,6 +1378,7 @@ void IMAPSession::deleteFolder(String * folder, ErrorCode * pError)
r = mailimap_delete(mImap, MCUTF8(folder));
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return;
}
@@ -1281,6 +1403,7 @@ void IMAPSession::createFolder(String * folder, ErrorCode * pError)
r = mailimap_create(mImap, MCUTF8(folder));
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return;
}
@@ -1307,6 +1430,7 @@ void IMAPSession::subscribeFolder(String * folder, ErrorCode * pError)
r = mailimap_subscribe(mImap, MCUTF8(folder));
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return;
}
@@ -1331,6 +1455,7 @@ void IMAPSession::unsubscribeFolder(String * folder, ErrorCode * pError)
r = mailimap_unsubscribe(mImap, MCUTF8(folder));
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return;
}
@@ -1370,6 +1495,7 @@ void IMAPSession::appendMessage(String * folder, Data * messageData, MessageFlag
mProgressCallback = NULL;
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return;
}
@@ -1417,6 +1543,7 @@ void IMAPSession::copyMessages(String * folder, IndexSet * uidSet, String * dest
r = mailimap_uidplus_uid_copy(mImap, current_set, MCUTF8(destFolder),
&uidvalidity, &src_uid, &dest_uid);
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
goto release;
}
@@ -1463,6 +1590,7 @@ void IMAPSession::expunge(String * folder, ErrorCode * pError)
r = mailimap_expunge(mImap);
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return;
}
@@ -1568,6 +1696,7 @@ HashMap * IMAPSession::fetchMessageNumberUIDMapping(String * folder, uint32_t fr
if (r == MAILIMAP_ERROR_STREAM) {
MCLog("error stream");
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return NULL;
}
@@ -2082,6 +2211,7 @@ IMAPSyncResult * IMAPSession::fetchMessages(String * folder, IMAPMessagesRequest
if (r == MAILIMAP_ERROR_STREAM) {
MCLog("error stream");
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return NULL;
}
@@ -2264,6 +2394,7 @@ Data * IMAPSession::fetchMessageByUID(String * folder, uint32_t uid,
mProgressCallback = NULL;
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return NULL;
}
@@ -2334,6 +2465,7 @@ Data * IMAPSession::fetchMessageAttachmentByUID(String * folder, uint32_t uid, S
MCLog("had error : %i", r);
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return NULL;
}
@@ -2445,10 +2577,15 @@ IndexSet * IMAPSession::search(String * folder, IMAPSearchExpression * expressio
clist * result_list = NULL;
- int r = mailimap_uid_search(mImap, "utf-8", key, &result_list);
+ const char * charset = "utf-8";
+ if (mYahooServer) {
+ charset = NULL;
+ }
+ int r = mailimap_uid_search(mImap, charset, key, &result_list);
mailimap_search_key_free(key);
MCLog("had error : %i", r);
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return NULL;
}
@@ -2471,6 +2608,37 @@ IndexSet * IMAPSession::search(String * folder, IMAPSearchExpression * expressio
return result;
}
+void IMAPSession::getQuota(uint32_t *usage, uint32_t *limit, ErrorCode * pError)
+{
+ mailimap_quota_complete_data *quota_data;
+
+ int r = mailimap_quota_getquotaroot(mImap, "INBOX", &quota_data);
+ if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
+ * pError = ErrorConnection;
+ return;
+ }
+ else if (r == MAILIMAP_ERROR_PARSE) {
+ * pError = ErrorParse;
+ return;
+ }
+ else if (hasError(r)) {
+ * pError = ErrorFetch;
+ return;
+ }
+ for(clistiter * cur = clist_begin(quota_data->quota_list); cur != NULL; cur = clist_next(cur)) {
+ mailimap_quota_quota_data *quota = (mailimap_quota_quota_data*)clist_content(cur);
+ for (clistiter *cur2 = clist_begin(quota->quota_list); cur2 != NULL; cur2 = clist_next(cur2)) {
+ mailimap_quota_quota_resource *res = (mailimap_quota_quota_resource*)clist_content(cur2);
+ if (!strcasecmp("STORAGE", res->resource_name)) {
+ *usage = res->usage;
+ *limit = res->limit;
+ }
+ }
+ }
+ mailimap_quota_complete_data_free(quota_data);
+}
+
bool IMAPSession::setupIdle()
{
// main thread
@@ -2512,6 +2680,7 @@ void IMAPSession::idle(String * folder, uint32_t lastKnownUID, ErrorCode * pErro
r = mailimap_idle(mImap);
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return;
}
@@ -2531,6 +2700,7 @@ void IMAPSession::idle(String * folder, uint32_t lastKnownUID, ErrorCode * pErro
case MAILSTREAM_IDLE_ERROR:
case MAILSTREAM_IDLE_CANCELLED:
{
+ mShouldDisconnect = true;
* pError = ErrorConnection;
MCLog("error or cancelled");
return;
@@ -2552,6 +2722,7 @@ void IMAPSession::idle(String * folder, uint32_t lastKnownUID, ErrorCode * pErro
r = mailimap_idle_done(mImap);
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return;
}
@@ -2591,31 +2762,22 @@ void IMAPSession::disconnect()
unsetup();
}
-HashMap * IMAPSession::identity(String * vendor, String * name, String * version, ErrorCode * pError)
+IMAPIdentity * IMAPSession::identity(IMAPIdentity * clientIdentity, ErrorCode * pError)
{
connectIfNeeded(pError);
if (* pError != ErrorNone)
return NULL;
struct mailimap_id_params_list * client_identification;
- char * dup_name;
- char * dup_value;
client_identification = mailimap_id_params_list_new_empty();
- if (name != NULL) {
- dup_name = strdup("name");
- dup_value = strdup(name->UTF8Characters());
- mailimap_id_params_list_add_name_value(client_identification, dup_name, dup_value);
- }
- if (version != NULL) {
- dup_name = strdup("version");
- dup_value = strdup(version->UTF8Characters());
- mailimap_id_params_list_add_name_value(client_identification, dup_name, dup_value);
- }
- if (vendor != NULL) {
- dup_name = strdup("vendor");
- dup_value = strdup(vendor->UTF8Characters());
+ mc_foreacharray(String, key, clientIdentity->allInfoKeys()) {
+ char * dup_name;
+ char * dup_value;
+
+ dup_name = strdup(key->UTF8Characters());
+ dup_value = strdup(clientIdentity->name()->UTF8Characters());
mailimap_id_params_list_add_name_value(client_identification, dup_name, dup_value);
}
@@ -2624,6 +2786,7 @@ HashMap * IMAPSession::identity(String * vendor, String * name, String * version
r = mailimap_id(mImap, client_identification, &server_identification);
mailimap_id_params_list_free(client_identification);
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return NULL;
}
@@ -2636,7 +2799,7 @@ HashMap * IMAPSession::identity(String * vendor, String * name, String * version
return NULL;
}
- HashMap * result = HashMap::hashMap();
+ IMAPIdentity * result = new IMAPIdentity();
clistiter * cur;
for(cur = clist_begin(server_identification->idpa_list) ; cur != NULL ; cur = clist_next(cur)) {
@@ -2648,12 +2811,13 @@ HashMap * IMAPSession::identity(String * vendor, String * name, String * version
String * responseValue;
responseKey = String::stringWithUTF8Characters(param->idpa_name);
responseValue = String::stringWithUTF8Characters(param->idpa_value);
- result->setObjectForKey(responseKey, responseValue);
+ result->setInfoForKey(responseKey, responseValue);
}
mailimap_id_params_list_free(server_identification);
* pError = ErrorNone;
+ result->autorelease();
return result;
}
@@ -2685,6 +2849,16 @@ void IMAPSession::setDefaultNamespace(IMAPNamespace * ns)
MC_SAFE_REPLACE_RETAIN(IMAPNamespace, mDefaultNamespace, ns);
}
+IMAPIdentity * IMAPSession::serverIdentity()
+{
+ return mServerIdentity;
+}
+
+IMAPIdentity * IMAPSession::clientIdentity()
+{
+ return mClientIdentity;
+}
+
HashMap * IMAPSession::fetchNamespace(ErrorCode * pError)
{
HashMap * result;
@@ -2698,6 +2872,7 @@ HashMap * IMAPSession::fetchNamespace(ErrorCode * pError)
result = HashMap::hashMap();
r = mailimap_namespace(mImap, &namespace_data);
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return NULL;
}
@@ -2834,6 +3009,7 @@ void IMAPSession::storeFlags(String * folder, IndexSet * uids, IMAPStoreFlagsReq
r = mailimap_uid_store(mImap, current_set, store_att_flags);
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
goto release;
}
@@ -2903,6 +3079,7 @@ void IMAPSession::storeLabels(String * folder, IndexSet * uids, IMAPStoreFlagsRe
}
r = mailimap_uid_store_xgmlabels(mImap, current_set, fl_sign, 1, xgmlabels);
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
goto release;
}
@@ -2981,12 +3158,13 @@ IndexSet * IMAPSession::capability(ErrorCode * pError)
int r;
struct mailimap_capability_data * cap;
- loginIfNeeded(pError);
+ connectIfNeeded(pError);
if (* pError != ErrorNone)
return NULL;
r = mailimap_capability(mImap, &cap);
if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
* pError = ErrorConnection;
return NULL;
}
@@ -3002,39 +3180,81 @@ IndexSet * IMAPSession::capability(ErrorCode * pError)
mailimap_capability_data_free(cap);
IndexSet * result = new IndexSet();
+ capabilitySetWithSessionState(result);
+
+ * pError = ErrorNone;
+ result->autorelease();
+ return result;
+}
+
+void IMAPSession::capabilitySetWithSessionState(IndexSet * capabilities)
+{
+ if (mailimap_has_idle(mImap)) {
+ LOCK();
+ mCanIdle = true;
+ UNLOCK();
+ }
if (mailimap_has_id(mImap)) {
- result->addIndex(IMAPCapabilityId);
- mIdentityEnabled = true;
+ capabilities->addIndex(IMAPCapabilityId);
}
if (mailimap_has_xlist(mImap)) {
- result->addIndex(IMAPCapabilityXList);
- mXListEnabled = true;
+ capabilities->addIndex(IMAPCapabilityXList);
}
if (mailimap_has_extension(mImap, (char *) "X-GM-EXT-1")) {
// Disable use of XLIST if this is the Gmail IMAP server because it implements
// RFC 6154.
- mXListEnabled = false;
+ capabilities->addIndex(IMAPCapabilityGmail);
}
if (mailimap_has_idle(mImap)) {
- result->addIndex(IMAPCapabilityIdle);
- mIdleEnabled = true;
+ capabilities->addIndex(IMAPCapabilityIdle);
}
if (mailimap_has_condstore(mImap)) {
- result->addIndex(IMAPCapabilityCondstore);
+ capabilities->addIndex(IMAPCapabilityCondstore);
+ }
+ if (mailimap_has_qresync(mImap)) {
+ capabilities->addIndex(IMAPCapabilityQResync);
+ }
+ if (mailimap_has_xoauth2(mImap)) {
+ capabilities->addIndex(IMAPCapabilityXOAuth2);
+ }
+ if (mailimap_has_namespace(mImap)) {
+ capabilities->addIndex(IMAPCapabilityNamespace);
+ }
+ if (mailimap_has_compress_deflate(mImap)) {
+ capabilities->addIndex(IMAPCapabilityCompressDeflate);
+ }
+ applyCapabilities(capabilities);
+}
+
+void IMAPSession::applyCapabilities(IndexSet * capabilities)
+{
+ if (capabilities->containsIndex(IMAPCapabilityId)) {
+ mIdentityEnabled = true;
+ }
+ if (capabilities->containsIndex(IMAPCapabilityXList)) {
+ mXListEnabled = true;
+ }
+ if (capabilities->containsIndex(IMAPCapabilityGmail)) {
+ mXListEnabled = false;
+ }
+ if (capabilities->containsIndex(IMAPCapabilityIdle)) {
+ mIdleEnabled = true;
+ }
+ if (capabilities->containsIndex(IMAPCapabilityCondstore)) {
mCondstoreEnabled = true;
}
- if (mailimap_has_condstore(mImap)) {
- result->addIndex(IMAPCapabilityQResync);
+ if (capabilities->containsIndex(IMAPCapabilityQResync)) {
mQResyncEnabled = true;
}
- if (mailimap_has_xoauth2(mImap)) {
- result->addIndex(IMAPCapabilityXOAuth2);
+ if (capabilities->containsIndex(IMAPCapabilityXOAuth2)) {
mXOauth2Enabled = true;
}
-
- * pError = ErrorNone;
- result->autorelease();
- return result;
+ if (capabilities->containsIndex(IMAPCapabilityNamespace)) {
+ mNamespaceEnabled = true;
+ }
+ if (capabilities->containsIndex(IMAPCapabilityCompressDeflate)) {
+ mCompressionEnabled = true;
+ }
}
bool IMAPSession::isIdleEnabled()
@@ -3062,10 +3282,21 @@ bool IMAPSession::isIdentityEnabled()
return mIdentityEnabled;
}
-bool IMAPSession::isXOAuthEnabled() {
+bool IMAPSession::isXOAuthEnabled()
+{
return mXOauth2Enabled;
}
+bool IMAPSession::isNamespaceEnabled()
+{
+ return mNamespaceEnabled;
+}
+
+bool IMAPSession::isCompressionEnabled()
+{
+ return mCompressionEnabled;
+}
+
bool IMAPSession::isDisconnected()
{
return mState == STATE_DISCONNECTED;
@@ -3153,3 +3384,84 @@ String * IMAPSession::plainTextBodyRendering(IMAPMessage * message, String * fol
return plainTextBodyString;
}
+
+void IMAPSession::setAutomaticConfigurationEnabled(bool enabled)
+{
+ mAutomaticConfigurationEnabled = enabled;
+}
+
+bool IMAPSession::isAutomaticConfigurationEnabled()
+{
+ return mAutomaticConfigurationEnabled;
+}
+
+bool IMAPSession::enableFeature(String * feature)
+{
+ struct mailimap_capability_data * caps;
+ clist * cap_list;
+ struct mailimap_capability * cap;
+ int r;
+
+ cap_list = clist_new();
+ cap = mailimap_capability_new(MAILIMAP_CAPABILITY_NAME, NULL, strdup(MCUTF8(feature)));
+ clist_append(cap_list, cap);
+ caps = mailimap_capability_data_new(cap_list);
+
+ struct mailimap_capability_data * result;
+ r = mailimap_enable(mImap, caps, &result);
+ if (r != MAILIMAP_NO_ERROR)
+ return false;
+
+ mailimap_capability_data_free(result);
+
+ return true;
+}
+
+void IMAPSession::enableFeatures()
+{
+ if (isCompressionEnabled()) {
+ ErrorCode error;
+ enableCompression(&error);
+ if (error != ErrorNone) {
+ MCLog("could not enable compression");
+ }
+ }
+
+ if (isQResyncEnabled()) {
+ enableFeature(MCSTR("QRESYNC"));
+ }
+ else if (isCondstoreEnabled()) {
+ enableFeature(MCSTR("CONDSTORE"));
+ }
+}
+
+void IMAPSession::enableCompression(ErrorCode * pError)
+{
+ int r;
+ r = mailimap_compress(mImap);
+ if (r == MAILIMAP_ERROR_STREAM) {
+ mShouldDisconnect = true;
+ * pError = ErrorConnection;
+ return;
+ }
+ else if (r == MAILIMAP_ERROR_PARSE) {
+ * pError = ErrorParse;
+ return;
+ }
+ else if (hasError(r)) {
+ * pError = ErrorCompression;
+ return;
+ }
+
+ * pError = ErrorNone;
+}
+
+bool IMAPSession::isAutomaticConfigurationDone()
+{
+ return mAutomaticConfigurationDone;
+}
+
+void IMAPSession::resetAutomaticConfigurationDone()
+{
+ mAutomaticConfigurationDone = false;
+}
diff --git a/src/core/imap/MCIMAPSession.h b/src/core/imap/MCIMAPSession.h
index 4128b516..f4f83e72 100644..100755
--- a/src/core/imap/MCIMAPSession.h
+++ b/src/core/imap/MCIMAPSession.h
@@ -20,6 +20,7 @@ namespace mailcore {
class IMAPProgressCallback;
class IMAPSyncResult;
class IMAPFolderStatus;
+ class IMAPIdentity;
class IMAPSession : public Object {
public:
@@ -59,13 +60,12 @@ namespace mailcore {
virtual bool isVoIPEnabled();
// Needed for fetchSubscribedFolders() and fetchAllFolders().
- virtual void setDelimiter(char delimiter);
- virtual char delimiter();
-
- // Needed for fetchSubscribedFolders() and fetchAllFolders().
virtual void setDefaultNamespace(IMAPNamespace * ns);
virtual IMAPNamespace * defaultNamespace();
+ virtual IMAPIdentity * serverIdentity();
+ virtual IMAPIdentity * clientIdentity();
+
virtual void select(String * folder, ErrorCode * pError);
virtual IMAPFolderStatus * folderStatus(String * folder, ErrorCode * pError);
@@ -126,6 +126,7 @@ namespace mailcore {
virtual IndexSet * search(String * folder, IMAPSearchKind kind, String * searchString, ErrorCode * pError);
virtual IndexSet * search(String * folder, IMAPSearchExpression * expression, ErrorCode * pError);
+ virtual void getQuota(uint32_t *usage, uint32_t *limit, ErrorCode * pError);
virtual bool setupIdle();
virtual void idle(String * folder, uint32_t lastKnownUID, ErrorCode * pError);
@@ -139,10 +140,12 @@ namespace mailcore {
virtual void login(ErrorCode * pError);
- virtual HashMap * identity(String * vendor, String * name, String * version, ErrorCode * pError);
+ IMAPIdentity * identity(IMAPIdentity * clientIdentity, ErrorCode * pError);
virtual IndexSet * capability(ErrorCode * pError);
+ virtual void enableCompression(ErrorCode * pError);
+
virtual uint32_t uidValidity();
virtual uint32_t uidNext();
virtual uint64_t modSequenceValue();
@@ -155,6 +158,8 @@ namespace mailcore {
virtual bool isQResyncEnabled();
virtual bool isIdentityEnabled();
virtual bool isXOAuthEnabled();
+ virtual bool isNamespaceEnabled();
+ virtual bool isCompressionEnabled();
virtual void setConnectionLogger(ConnectionLogger * logger);
virtual ConnectionLogger * connectionLogger();
@@ -172,10 +177,19 @@ namespace mailcore {
This method can be used to generate the summary of the message.*/
virtual String * plainTextBodyRendering(IMAPMessage * message, String * folder, ErrorCode * pError);
+ /** Enable automatic query of the capabilities of the IMAP server when set to true. */
+ virtual void setAutomaticConfigurationEnabled(bool enabled);
+
+ /** Check if the automatic query of the capabilities of the IMAP server is enabled. */
+ virtual bool isAutomaticConfigurationEnabled();
+
public: // private
virtual void loginIfNeeded(ErrorCode * pError);
virtual void connectIfNeeded(ErrorCode * pError);
virtual bool isDisconnected();
+ virtual bool isAutomaticConfigurationDone();
+ virtual void resetAutomaticConfigurationDone();
+ virtual void applyCapabilities(IndexSet * capabilities);
private:
String * mHostname;
@@ -189,6 +203,8 @@ namespace mailcore {
bool mVoIPEnabled;
char mDelimiter;
IMAPNamespace * mDefaultNamespace;
+ IMAPIdentity * mServerIdentity;
+ IMAPIdentity * mClientIdentity;
time_t mTimeout;
bool mBodyProgressEnabled;
@@ -198,6 +214,8 @@ namespace mailcore {
bool mQResyncEnabled;
bool mIdentityEnabled;
bool mXOauth2Enabled;
+ bool mNamespaceEnabled;
+ bool mCompressionEnabled;
String * mWelcomeString;
bool mNeedsMboxMailWorkaround;
uint32_t mUIDValidity;
@@ -205,6 +223,7 @@ namespace mailcore {
uint64_t mModSequenceValue;
unsigned int mFolderMsgCount;
uint32_t mFirstUnseenUid;
+ bool mYahooServer;
unsigned int mLastFetchedSequenceNumber;
String * mCurrentFolder;
@@ -215,6 +234,9 @@ namespace mailcore {
IMAPProgressCallback * mProgressCallback;
unsigned int mProgressItemsCount;
ConnectionLogger * mConnectionLogger;
+ bool mAutomaticConfigurationEnabled;
+ bool mAutomaticConfigurationDone;
+ bool mShouldDisconnect;
void init();
void bodyProgress(unsigned int current, unsigned int maximum);
@@ -230,6 +252,9 @@ namespace mailcore {
bool fetchByUID, struct mailimap_set * imapset, uint64_t modseq,
HashMap * mapping, uint32_t startUid, IMAPProgressCallback * progressCallback,
Array * extraHeaders, ErrorCode * pError);
+ void capabilitySetWithSessionState(IndexSet * capabilities);
+ bool enableFeature(String * feature);
+ void enableFeatures();
};
}
diff --git a/src/core/pop/MCPOPSession.cc b/src/core/pop/MCPOPSession.cc
index 393ec516..86a4a0d3 100644
--- a/src/core/pop/MCPOPSession.cc
+++ b/src/core/pop/MCPOPSession.cc
@@ -130,6 +130,8 @@ bool POPSession::isCheckCertificateEnabled()
bool POPSession::checkCertificate()
{
+ if (!isCheckCertificateEnabled())
+ return true;
return mailcore::checkCertificate(mPop->pop3_stream, hostname());
}
diff --git a/src/core/smtp/MCSMTPSession.cc b/src/core/smtp/MCSMTPSession.cc
index 4677e2d6..78eb4113 100644
--- a/src/core/smtp/MCSMTPSession.cc
+++ b/src/core/smtp/MCSMTPSession.cc
@@ -14,9 +14,9 @@
using namespace mailcore;
enum {
- STATE_DISCONNECTED,
- STATE_CONNECTED,
- STATE_LOGGEDIN,
+ STATE_DISCONNECTED,
+ STATE_CONNECTED,
+ STATE_LOGGEDIN,
};
void SMTPSession::init()
@@ -31,6 +31,7 @@ void SMTPSession::init()
mTimeout = 30;
mCheckCertificateEnabled = true;
mUseHeloIPEnabled = false;
+ mShouldDisconnect = false;
mSmtp = NULL;
mProgressCallback = NULL;
@@ -147,6 +148,8 @@ bool SMTPSession::isCheckCertificateEnabled()
bool SMTPSession::checkCertificate()
{
+ if (!isCheckCertificateEnabled())
+ return true;
return mailcore::checkCertificate(mSmtp->stream, hostname());
}
@@ -212,6 +215,17 @@ void SMTPSession::unsetup()
void SMTPSession::connectIfNeeded(ErrorCode * pError)
{
+ if (mSmtp != NULL) {
+ // In case pipelining is available, libetpan will disconnect the session.
+ if (mSmtp->stream == NULL) {
+ mShouldDisconnect = true;
+ }
+ }
+ if (mShouldDisconnect) {
+ disconnect();
+ mShouldDisconnect = false;
+ }
+
if (mState == STATE_DISCONNECTED) {
connect(pError);
}
@@ -222,114 +236,114 @@ void SMTPSession::connectIfNeeded(ErrorCode * pError)
void SMTPSession::connect(ErrorCode * pError)
{
- int r;
-
+ int r;
+
setup();
switch (mConnectionType) {
- case ConnectionTypeStartTLS:
- MCLog("connect %s %u", MCUTF8(hostname()), (unsigned int) port());
- r = mailsmtp_socket_connect(mSmtp, MCUTF8(hostname()), port());
- if (r != MAILSMTP_NO_ERROR) {
+ case ConnectionTypeStartTLS:
+ MCLog("connect %s %u", MCUTF8(hostname()), (unsigned int) port());
+ r = mailsmtp_socket_connect(mSmtp, MCUTF8(hostname()), port());
+ if (r != MAILSMTP_NO_ERROR) {
* pError = ErrorConnection;
- return;
- }
-
- MCLog("init");
+ goto close;
+ }
+
+ MCLog("init");
if (useHeloIPEnabled()) {
r = mailsmtp_init_with_ip(mSmtp, 1);
} else {
r = mailsmtp_init(mSmtp);
}
- if (r == MAILSMTP_ERROR_STREAM) {
+ if (r == MAILSMTP_ERROR_STREAM) {
* pError = ErrorConnection;
- return;
- }
- else if (r != MAILSMTP_NO_ERROR) {
+ goto close;
+ }
+ else if (r != MAILSMTP_NO_ERROR) {
* pError = ErrorConnection;
- return;
- }
-
- MCLog("start TLS");
- r = mailsmtp_socket_starttls(mSmtp);
- if (r != MAILSMTP_NO_ERROR) {
+ goto close;
+ }
+
+ MCLog("start TLS");
+ r = mailsmtp_socket_starttls(mSmtp);
+ if (r != MAILSMTP_NO_ERROR) {
* pError = ErrorStartTLSNotAvailable;
- return;
- }
- MCLog("done");
- if (!checkCertificate()) {
+ goto close;
+ }
+ MCLog("done");
+ if (!checkCertificate()) {
* pError = ErrorCertificate;
- return;
+ goto close;
}
-
- MCLog("init after starttls");
+
+ MCLog("init after starttls");
if (useHeloIPEnabled()) {
r = mailsmtp_init_with_ip(mSmtp, 1);
} else {
r = mailsmtp_init(mSmtp);
}
- if (r == MAILSMTP_ERROR_STREAM) {
+ if (r == MAILSMTP_ERROR_STREAM) {
* pError = ErrorConnection;
- return;
- }
- else if (r != MAILSMTP_NO_ERROR) {
+ goto close;
+ }
+ else if (r != MAILSMTP_NO_ERROR) {
* pError = ErrorConnection;
- return;
- }
+ goto close;
+ }
+
+ break;
- break;
-
- case ConnectionTypeTLS:
- r = mailsmtp_ssl_connect(mSmtp, MCUTF8(mHostname), port());
- if (r != MAILSMTP_NO_ERROR) {
+ case ConnectionTypeTLS:
+ r = mailsmtp_ssl_connect(mSmtp, MCUTF8(mHostname), port());
+ if (r != MAILSMTP_NO_ERROR) {
* pError = ErrorConnection;
- return;
- }
- if (!checkCertificate()) {
+ goto close;
+ }
+ if (!checkCertificate()) {
* pError = ErrorCertificate;
- return;
+ goto close;
}
-
- MCLog("init");
+
+ MCLog("init");
if (useHeloIPEnabled()) {
r = mailsmtp_init_with_ip(mSmtp, 1);
} else {
r = mailsmtp_init(mSmtp);
}
- if (r == MAILSMTP_ERROR_STREAM) {
+ if (r == MAILSMTP_ERROR_STREAM) {
* pError = ErrorConnection;
- return;
- }
- else if (r != MAILSMTP_NO_ERROR) {
+ goto close;
+ }
+ else if (r != MAILSMTP_NO_ERROR) {
* pError = ErrorConnection;
- return;
- }
-
- break;
-
- default:
- r = mailsmtp_socket_connect(mSmtp, MCUTF8(hostname()), port());
- if (r != MAILIMAP_NO_ERROR) {
+ goto close;
+ }
+
+ break;
+
+ default:
+ r = mailsmtp_socket_connect(mSmtp, MCUTF8(hostname()), port());
+ if (r != MAILIMAP_NO_ERROR) {
* pError = ErrorConnection;
- return;
- }
-
- MCLog("init");
+ goto close;
+ }
+
+ MCLog("init");
if (useHeloIPEnabled()) {
r = mailsmtp_init_with_ip(mSmtp, 1);
} else {
r = mailsmtp_init(mSmtp);
}
- if (r == MAILSMTP_ERROR_STREAM) {
+ if (r == MAILSMTP_ERROR_STREAM) {
* pError = ErrorConnection;
- return;
- }
- else if (r != MAILSMTP_NO_ERROR) {
+ goto close;
+ }
+ else if (r != MAILSMTP_NO_ERROR) {
* pError = ErrorConnection;
- return;
- }
-
- break;
+ goto close;
+ }
+
+ break;
}
mailstream_low * low;
@@ -348,6 +362,10 @@ void SMTPSession::connect(ErrorCode * pError)
mState = STATE_CONNECTED;
* pError = ErrorNone;
+ return;
+
+close:
+ unsetup();
}
void SMTPSession::disconnect()
@@ -355,7 +373,9 @@ void SMTPSession::disconnect()
if (mSmtp == NULL)
return;
- mailsmtp_quit(mSmtp);
+ if (mSmtp->stream != NULL) {
+ mailsmtp_quit(mSmtp);
+ }
unsetup();
@@ -508,6 +528,7 @@ void SMTPSession::login(ErrorCode * pError)
}
if (r == MAILSMTP_ERROR_STREAM) {
* pError = ErrorConnection;
+ mShouldDisconnect = true;
return;
}
else if (r != MAILSMTP_NO_ERROR) {
@@ -530,6 +551,7 @@ void SMTPSession::checkAccount(Address * from, ErrorCode * pError)
r = mailsmtp_mail(mSmtp, MCUTF8(from->mailbox()));
if (r == MAILSMTP_ERROR_STREAM) {
* pError = ErrorConnection;
+ mShouldDisconnect = true;
return;
}
else if (r != MAILSMTP_NO_ERROR) {
@@ -540,6 +562,7 @@ void SMTPSession::checkAccount(Address * from, ErrorCode * pError)
r = mailsmtp_rcpt(mSmtp, "email@invalid.com");
if (r == MAILSMTP_ERROR_STREAM) {
* pError = ErrorConnection;
+ mShouldDisconnect = true;
return;
}
else if (r != MAILSMTP_NO_ERROR) {
@@ -587,6 +610,7 @@ void SMTPSession::sendMessage(Address * from, Array * recipients, Data * message
r = mailesmtp_send(mSmtp, MCUTF8(from->mailbox()), 0, NULL,
address_list,
messageData->bytes(), messageData->length());
+ mailsmtp_quit(mSmtp);
}
esmtp_address_list_free(address_list);
@@ -601,6 +625,7 @@ void SMTPSession::sendMessage(Address * from, Array * recipients, Data * message
if ((r == MAILSMTP_ERROR_STREAM) || (r == MAILSMTP_ERROR_CONNECTION_REFUSED)) {
* pError = ErrorConnection;
+ mShouldDisconnect = true;
goto err;
}
else if (r == MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION) {
diff --git a/src/core/smtp/MCSMTPSession.h b/src/core/smtp/MCSMTPSession.h
index 3d066a6c..28f94ada 100644
--- a/src/core/smtp/MCSMTPSession.h
+++ b/src/core/smtp/MCSMTPSession.h
@@ -58,6 +58,8 @@ namespace mailcore {
virtual void checkAccount(Address * from, ErrorCode * pError);
virtual void sendMessage(Data * messageData, SMTPProgressCallback * callback, ErrorCode * pError);
+ virtual void sendMessage(Address * from, Array * /* Address */ recipients, Data * messageData,
+ SMTPProgressCallback * callback, ErrorCode * pError);
virtual void setConnectionLogger(ConnectionLogger * logger);
virtual ConnectionLogger * connectionLogger();
@@ -73,6 +75,7 @@ namespace mailcore {
time_t mTimeout;
bool mCheckCertificateEnabled;
bool mUseHeloIPEnabled;
+ bool mShouldDisconnect;
mailsmtp * mSmtp;
SMTPProgressCallback * mProgressCallback;
@@ -93,8 +96,6 @@ namespace mailcore {
void loginIfNeeded(ErrorCode * pError);
bool checkCertificate();
- void sendMessage(Address * from, Array * /* Address */ recipients, Data * messageData,
- SMTPProgressCallback * callback, ErrorCode * pError);
void sendMessage(MessageBuilder * msg, SMTPProgressCallback * callback, ErrorCode * pError);
public: // private
diff --git a/src/objc/abstract/MCOConstants.h b/src/objc/abstract/MCOConstants.h
index 427e787a..0e13f986 100644
--- a/src/objc/abstract/MCOConstants.h
+++ b/src/objc/abstract/MCOConstants.h
@@ -328,6 +328,8 @@ typedef enum {
MCOErrorDeleteMessage,
/** SMTP: Error while checking account.*/
MCOErrorInvalidAccount,
+ /** IMAP: Error when trying to enable compression.*/
+ MCOErrorCompression,
/** The count of all errors */
MCOErrorCodeCount,
} MCOErrorCode;
@@ -356,4 +358,9 @@ typedef enum {
*/
typedef void (^MCOConnectionLogger)(void * connectionID, MCOConnectionLogType type, NSData * data);
+/**
+ It's called when asynchronous operations stop/start running.
+ */
+typedef void (^MCOOperationQueueRunningChangeBlock)(void);
+
#endif
diff --git a/src/objc/abstract/MCOMessageHeader.mm b/src/objc/abstract/MCOMessageHeader.mm
index 241dab88..7dee244f 100644
--- a/src/objc/abstract/MCOMessageHeader.mm
+++ b/src/objc/abstract/MCOMessageHeader.mm
@@ -102,18 +102,18 @@ MCO_OBJC_SYNTHESIZE_ARRAY(setReplyTo, replyTo)
MCO_OBJC_SYNTHESIZE_STRING(setSubject, subject)
MCO_OBJC_SYNTHESIZE_STRING(setUserAgent, userAgent)
-- (void)addExtraHeaderValue:(NSString *)value forName:(NSString *)name {
+- (void)addHeaderValue:(NSString *)value forName:(NSString *)name {
_nativeHeader->setExtraHeader(MCO_FROM_OBJC(mailcore::String, name), MCO_FROM_OBJC(mailcore::String, value));
}
-- (NSString *)extraHeaderValueForName:(NSString *)name {
+- (NSString *)headerValueForName:(NSString *)name {
return MCO_TO_OBJC(_nativeHeader->extraHeaderValueForName((MCO_FROM_OBJC(mailcore::String, name))));
}
-- (void)removeExtraHeaderForName:(NSString *)name {
+- (void)removeHeaderForName:(NSString *)name {
_nativeHeader->removeExtraHeader(MCO_FROM_OBJC(mailcore::String, name));
}
-- (NSArray * /* NSString */)allExtraHeadersNames {
+- (NSArray * /* NSString */)allHeadersNames {
return MCO_TO_OBJC(_nativeHeader->allExtraHeadersNames());
}
diff --git a/src/objc/imap/MCOIMAP.h b/src/objc/imap/MCOIMAP.h
index f0994042..538c3492 100644..100755
--- a/src/objc/imap/MCOIMAP.h
+++ b/src/objc/imap/MCOIMAP.h
@@ -19,6 +19,7 @@
#import <MailCore/MCOIMAPMultipart.h>
#import <MailCore/MCOIMAPNamespace.h>
#import <MailCore/MCOIMAPNamespaceItem.h>
+#import <MailCore/MCOIMAPIdentity.h>
#import <MailCore/MCOIMAPPart.h>
#import <MailCore/MCOIMAPFolderInfoOperation.h>
#import <MailCore/MCOIMAPFolderInfo.h>
@@ -36,6 +37,7 @@
#import <MailCore/MCOIMAPFetchNamespaceOperation.h>
#import <MailCore/MCOIMAPIdentityOperation.h>
#import <MailCore/MCOIMAPCapabilityOperation.h>
+#import <MailCore/MCOIMAPQuotaOperation.h>
#import <MailCore/MCOIMAPSearchExpression.h>
#import <MailCore/MCOIMAPMessageRenderingOperation.h>
diff --git a/src/objc/imap/MCOIMAPIdentity.h b/src/objc/imap/MCOIMAPIdentity.h
new file mode 100644
index 00000000..32ce8b5c
--- /dev/null
+++ b/src/objc/imap/MCOIMAPIdentity.h
@@ -0,0 +1,42 @@
+//
+// MCOIMAPIdentity.h
+// mailcore2
+//
+// Created by Hoa V. DINH on 8/24/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#ifndef __MAILCORE_MCOIMAPIDENTITY_H_
+
+#define __MAILCORE_MCOIMAPIDENTITY_H_
+
+#import <Foundation/Foundation.h>
+
+@interface MCOIMAPIdentity : NSObject <NSCopying>
+
+/** Returns a simple identity */
++ (MCOIMAPIdentity *) identityWithVendor:(NSString *)vendor
+ name:(NSString *)name
+ version:(NSString *)version;
+
+/** Vendor of the IMAP client */
+@property (nonatomic, copy) NSString * vendor;
+
+/** Name of the IMAP client */
+@property (nonatomic, copy) NSString * name;
+
+/** Version of the IMAP client */
+@property (nonatomic, copy) NSString * version;
+
+/** All fields names of the identity of the client */
+- (NSArray *) allInfoKeys;
+
+/** Set a custom field in the identity */
+- (NSString *) infoForKey:(NSString *)key;
+
+/** Retrieve a custom field in the identity */
+- (void) setInfo:(NSString *)value forKey:(NSString *)key;
+
+@end
+
+#endif
diff --git a/src/objc/imap/MCOIMAPIdentity.mm b/src/objc/imap/MCOIMAPIdentity.mm
new file mode 100644
index 00000000..0beb092b
--- /dev/null
+++ b/src/objc/imap/MCOIMAPIdentity.mm
@@ -0,0 +1,96 @@
+//
+// MCOIMAPIdentity.m
+// mailcore2
+//
+// Created by Hoa V. DINH on 8/24/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#import "MCOIMAPIdentity.h"
+#import "NSObject+MCO.h"
+#import "NSString+MCO.h"
+
+#include "MCIMAPIdentity.h"
+
+#define nativeType mailcore::IMAPIdentity
+
+@implementation MCOIMAPIdentity {
+ mailcore::IMAPIdentity * _nativeIdentity;
+}
+
++ (void) load
+{
+ MCORegisterClass(self, &typeid(nativeType));
+}
+
+- (id) initWithMCIdentity:(mailcore::IMAPIdentity *)identity
+{
+ self = [super init];
+
+ identity->retain();
+ _nativeIdentity = identity;
+
+ return self;
+}
+
+- (void) dealloc
+{
+ MC_SAFE_RELEASE(_nativeIdentity);
+ [super dealloc];
+}
+
++ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object
+{
+ mailcore::IMAPIdentity * identity = (mailcore::IMAPIdentity *) object;
+ return [[[self alloc] initWithMCIdentity:identity] autorelease];
+}
+
+- (mailcore::Object *) mco_mcObject
+{
+ return _nativeIdentity;
+}
+
+- (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_STRING(setVendor, vendor)
+MCO_OBJC_SYNTHESIZE_STRING(setName, name)
+MCO_OBJC_SYNTHESIZE_STRING(setVersion, version)
+
+- (NSArray *) allInfoKeys
+{
+ return MCO_OBJC_BRIDGE_GET(allInfoKeys);
+}
+
+- (NSString *) infoForKey:(NSString *)key
+{
+ return MCO_TO_OBJC(MCO_NATIVE_INSTANCE->infoForKey([key mco_mcString]));
+}
+
+- (void) setInfo:(NSString *)value forKey:(NSString *)key
+{
+ MCO_NATIVE_INSTANCE->setInfoForKey([key mco_mcString], [value mco_mcString]);
+}
+
++ (MCOIMAPIdentity *) identityWithVendor:(NSString *)vendor
+ name:(NSString *)name
+ version:(NSString *)version
+{
+ MCOIMAPIdentity * identity = [[[MCOIMAPIdentity alloc] init] autorelease];
+ [identity setVendor:vendor];
+ [identity setName:name];
+ [identity setVersion:version];
+ return identity;
+}
+
+@end
diff --git a/src/objc/imap/MCOIMAPMessage.mm b/src/objc/imap/MCOIMAPMessage.mm
index 325f2b09..99c45505 100644
--- a/src/objc/imap/MCOIMAPMessage.mm
+++ b/src/objc/imap/MCOIMAPMessage.mm
@@ -25,6 +25,14 @@
MCORegisterClass(self, &typeid(nativeType));
}
+- (id) init
+{
+ mailcore::IMAPMessage * msg = new mailcore::IMAPMessage();
+ self = [self initWithMCMessage:msg];
+ msg->release();
+ return self;
+}
+
+ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object
{
mailcore::IMAPMessage * msg = (mailcore::IMAPMessage *) object;
diff --git a/src/objc/imap/MCOIMAPQuotaOperation.h b/src/objc/imap/MCOIMAPQuotaOperation.h
new file mode 100644
index 00000000..c0463bb0
--- /dev/null
+++ b/src/objc/imap/MCOIMAPQuotaOperation.h
@@ -0,0 +1,15 @@
+//
+// MCOIMAPQuotaOperation.h
+// mailcore2
+//
+// Created by Petro Korenev on 8/2/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#import "MCOIMAPBaseOperation.h"
+
+@interface MCOIMAPQuotaOperation : MCOIMAPBaseOperation
+
+- (void) start:(void (^)(NSError * error, NSUInteger usage, NSUInteger limit))completionBlock;
+
+@end
diff --git a/src/objc/imap/MCOIMAPQuotaOperation.mm b/src/objc/imap/MCOIMAPQuotaOperation.mm
new file mode 100644
index 00000000..5be2571f
--- /dev/null
+++ b/src/objc/imap/MCOIMAPQuotaOperation.mm
@@ -0,0 +1,69 @@
+//
+// MCOIMAPQuotaOperation.m
+// mailcore2
+//
+// Created by Petro Korenev on 8/2/13.
+// Copyright (c) 2013 MailCore. All rights reserved.
+//
+
+#import "MCOIMAPQuotaOperation.h"
+
+#include "MCAsyncIMAP.h"
+
+#import "MCOOperation+Private.h"
+#import "MCOUtils.h"
+
+typedef void (^CompletionType)(NSError *error, NSUInteger usage, NSUInteger limit);
+
+@implementation MCOIMAPQuotaOperation {
+ CompletionType _completionBlock;
+}
+
+#define nativeType mailcore::IMAPQuotaOperation
+
++ (void) load
+{
+ MCORegisterClass(self, &typeid(nativeType));
+}
+
++ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object
+{
+ nativeType * op = (nativeType *) object;
+ return [[[self alloc] initWithMCOperation:op] autorelease];
+}
+
+- (void) dealloc
+{
+ [_completionBlock release];
+ [super dealloc];
+}
+
+- (void) start:(void (^)(NSError *error, NSUInteger usage, NSUInteger limit))completionBlock
+{
+ _completionBlock = [completionBlock copy];
+ [self start];
+}
+
+- (void) cancel
+{
+ [_completionBlock release];
+ _completionBlock = nil;
+ [super cancel];
+}
+
+- (void) operationCompleted
+{
+ if (_completionBlock == NULL)
+ return;
+
+ nativeType *op = MCO_NATIVE_INSTANCE;
+ if (op->error() == mailcore::ErrorNone) {
+ _completionBlock(nil, op->usage(), op->limit());
+ } else {
+ _completionBlock([NSError mco_errorWithErrorCode:op->error()], 0, 0);
+ }
+ [_completionBlock release];
+ _completionBlock = nil;
+}
+
+@end
diff --git a/src/objc/imap/MCOIMAPSession.h b/src/objc/imap/MCOIMAPSession.h
index 5db608f7..e63e1745 100644..100755
--- a/src/objc/imap/MCOIMAPSession.h
+++ b/src/objc/imap/MCOIMAPSession.h
@@ -29,8 +29,10 @@
@class MCOIMAPSearchExpression;
@class MCOIMAPIdentityOperation;
@class MCOIMAPCapabilityOperation;
+@class MCOIMAPQuotaOperation;
@class MCOIMAPMessageRenderingOperation;
@class MCOIMAPMessage;
+@class MCOIMAPIdentity;
/**
This is the main IMAP class from which all operations are created
@@ -78,12 +80,15 @@
/** When set to YES, VoIP capability will be enabled on the IMAP connection on iOS */
@property (nonatomic, assign, getter=isVoIPEnabled) BOOL voIPEnabled;
-/** The default delimiter for the folder paths */
-@property (nonatomic, assign) char delimiter;
-
/** The default namespace. */
@property (nonatomic, strong) MCOIMAPNamespace * defaultNamespace;
+/** The identity of the IMAP client. */
+@property (nonatomic, strong, readonly) MCOIMAPIdentity * clientIdentity;
+
+/** The identity of the IMAP server. */
+@property (nonatomic, strong, readonly) MCOIMAPIdentity * serverIdentity;
+
/**
When set to YES, the session is allowed open to open several connections to the same folder.
@warning Some older IMAP servers don't like this
@@ -104,6 +109,25 @@
*/
@property (nonatomic, copy) MCOConnectionLogger connectionLogger;
+/**
+ The value will be YES when asynchronous operations are running, else it will return NO.
+*/
+@property (nonatomic, assign, readonly, getter=isOperationQueueRunning) BOOL operationQueueRunning;
+
+/**
+ Sets operation running callback. It will be called when operations start or stop running.
+
+ [session setOperationQueueRunningChangeBlock:^{
+ if ([session isOperationQueueRunning]) {
+ ...
+ }
+ else {
+ ...
+ }
+ }];
+*/
+@property (nonatomic, copy) MCOOperationQueueRunningChangeBlock operationQueueRunningChangeBlock;
+
/** @name Folder Operations */
/**
@@ -471,17 +495,13 @@
/**
Returns an operation to send the client or get the server identity.
- MCOIMAPIdentityOperation * op = [session identityOperationWithVendor:@"Mozilla"
- name:@"Thunderbird"
- version:@"17.0.5"];
- [op start:^(NSError * error, NSDictionary * serverIdentity) {
+ MCOIMAPIdentity * identity = [MCOIMAPIdentity identityWithVendor:@"Mozilla" name:@"Thunderbird" version:@"17.0.5"];
+ MCOIMAPIdentityOperation * op = [session identityOperationWithClientIdentity:identity];
+ [op start:^(NSError * error, MCOIMAPIdentity * serverIdentity) {
...
}];
*/
-- (MCOIMAPIdentityOperation *) identityOperationWithVendor:(NSString *)vendor
- name:(NSString *)name
- version:(NSString *)version;
-
+- (MCOIMAPIdentityOperation *) identityOperationWithClientIdentity:(MCOIMAPIdentity *)identity;
/**
Returns an operation that will check whether the IMAP account is valid.
@@ -507,6 +527,8 @@
*/
- (MCOIMAPCapabilityOperation *) capabilityOperation;
+- (MCOIMAPQuotaOperation *) quotaOperation;
+
/** @name Search Operations */
/**
diff --git a/src/objc/imap/MCOIMAPSession.mm b/src/objc/imap/MCOIMAPSession.mm
index 2546e612..8b4bb363 100644..100755
--- a/src/objc/imap/MCOIMAPSession.mm
+++ b/src/objc/imap/MCOIMAPSession.mm
@@ -15,25 +15,27 @@
#import "MCOIMAPFetchFoldersOperation.h"
#import "MCOIMAPBaseOperation+Private.h"
#import "MCOIMAPMessageRenderingOperation.h"
+#import "MCOIMAPIdentity.h"
#import "MCOUtils.h"
#import <MailCore/MCAsync.h>
#include "MCIMAPMessageRenderingOperation.h"
-
+#include "MCOperationQueueCallback.h"
using namespace mailcore;
@interface MCOIMAPSession ()
- (void) _logWithSender:(void *)sender connectionType:(MCOConnectionLogType)logType data:(NSData *)data;
+- (void) _queueRunningChanged;
@end
-class MCOIMAPConnectionLoggerBridge : public Object, public ConnectionLogger {
+class MCOIMAPCallbackBridge : public Object, public ConnectionLogger, public OperationQueueCallback {
public:
- MCOIMAPConnectionLoggerBridge(MCOIMAPSession * session)
+ MCOIMAPCallbackBridge(MCOIMAPSession * session)
{
mSession = session;
}
@@ -43,6 +45,16 @@ public:
[mSession _logWithSender:sender connectionType:(MCOConnectionLogType)logType data:MCO_TO_OBJC(data)];
}
+ virtual void queueStartRunning()
+ {
+ [mSession _queueRunningChanged];
+ }
+
+ virtual void queueStoppedRunning()
+ {
+ [mSession _queueRunningChanged];
+ }
+
private:
MCOIMAPSession * mSession;
};
@@ -50,7 +62,8 @@ private:
@implementation MCOIMAPSession {
IMAPAsyncSession * _session;
MCOConnectionLogger _connectionLogger;
- MCOIMAPConnectionLoggerBridge * _loggerBridge;
+ MCOIMAPCallbackBridge * _callbackBridge;
+ MCOOperationQueueRunningChangeBlock _operationQueueRunningChangeBlock;
}
#define nativeType mailcore::IMAPAsyncSession
@@ -64,13 +77,17 @@ private:
self = [super init];
_session = new IMAPAsyncSession();
- _loggerBridge = new MCOIMAPConnectionLoggerBridge(self);
+ _callbackBridge = new MCOIMAPCallbackBridge(self);
+ _session->setOperationQueueCallback(_callbackBridge);
return self;
}
- (void)dealloc {
- MC_SAFE_RELEASE(_loggerBridge);
+ _session->setConnectionLogger(NULL);
+ _session->setOperationQueueCallback(NULL);
+ MC_SAFE_RELEASE(_callbackBridge);
+ [_operationQueueRunningChangeBlock release];
[_connectionLogger release];
_session->release();
[super dealloc];
@@ -86,7 +103,6 @@ MCO_OBJC_SYNTHESIZE_SCALAR(MCOConnectionType, mailcore::ConnectionType, setConne
MCO_OBJC_SYNTHESIZE_SCALAR(NSTimeInterval, time_t, setTimeout, timeout)
MCO_OBJC_SYNTHESIZE_BOOL(setCheckCertificateEnabled, isCheckCertificateEnabled)
MCO_OBJC_SYNTHESIZE_BOOL(setVoIPEnabled, isVoIPEnabled)
-MCO_OBJC_SYNTHESIZE_SCALAR(char, char, setDelimiter, delimiter)
MCO_OBJC_SYNTHESIZE_SCALAR(BOOL, BOOL, setAllowsFolderConcurrentAccessEnabled, allowsFolderConcurrentAccessEnabled)
MCO_OBJC_SYNTHESIZE_SCALAR(unsigned int, unsigned int, setMaximumConnections, maximumConnections)
@@ -100,13 +116,23 @@ MCO_OBJC_SYNTHESIZE_SCALAR(unsigned int, unsigned int, setMaximumConnections, ma
return MCO_TO_OBJC(_session->defaultNamespace());
}
+- (MCOIMAPIdentity *) clientIdentity
+{
+ return MCO_OBJC_BRIDGE_GET(clientIdentity);
+}
+
+- (MCOIMAPIdentity *) serverIdentity
+{
+ return MCO_OBJC_BRIDGE_GET(serverIdentity);
+}
+
- (void) setConnectionLogger:(MCOConnectionLogger)connectionLogger
{
[_connectionLogger release];
_connectionLogger = [connectionLogger copy];
if (_connectionLogger != nil) {
- _session->setConnectionLogger(_loggerBridge);
+ _session->setConnectionLogger(_callbackBridge);
}
else {
_session->setConnectionLogger(NULL);
@@ -118,6 +144,24 @@ MCO_OBJC_SYNTHESIZE_SCALAR(unsigned int, unsigned int, setMaximumConnections, ma
return _connectionLogger;
}
+- (void) setOperationQueueRunningChangeBlock:(MCOOperationQueueRunningChangeBlock)operationQueueRunningChangeBlock
+{
+ [_operationQueueRunningChangeBlock release];
+ _operationQueueRunningChangeBlock = [operationQueueRunningChangeBlock copy];
+
+ if (_operationQueueRunningChangeBlock != nil) {
+ _session->setOperationQueueCallback(_callbackBridge);
+ }
+ else {
+ _session->setOperationQueueCallback(NULL);
+ }
+}
+
+- (MCOOperationQueueRunningChangeBlock) operationQueueRunningChangeBlock
+{
+ return _operationQueueRunningChangeBlock;
+}
+
#pragma mark - Operations
#define MCO_TO_OBJC_OP(op) [self _objcOperationFromNativeOp:op];
@@ -340,13 +384,9 @@ MCO_OBJC_SYNTHESIZE_SCALAR(unsigned int, unsigned int, setMaximumConnections, ma
return MCO_TO_OBJC_OP(coreOp);
}
-- (MCOIMAPIdentityOperation *) identityOperationWithVendor:(NSString *)vendor
- name:(NSString *)name
- version:(NSString *)version
+- (MCOIMAPIdentityOperation *) identityOperationWithClientIdentity:(MCOIMAPIdentity *)identity
{
- IMAPIdentityOperation * coreOp = MCO_NATIVE_INSTANCE->identityOperation([vendor mco_mcString],
- [name mco_mcString],
- [version mco_mcString]);
+ IMAPIdentityOperation * coreOp = MCO_NATIVE_INSTANCE->identityOperation(MCO_FROM_OBJC(IMAPIdentity, identity));
return MCO_TO_OBJC_OP(coreOp);
}
@@ -362,6 +402,12 @@ MCO_OBJC_SYNTHESIZE_SCALAR(unsigned int, unsigned int, setMaximumConnections, ma
return MCO_TO_OBJC_OP(coreOp);
}
+- (MCOIMAPQuotaOperation *) quotaOperation
+{
+ IMAPQuotaOperation * coreOp = MCO_NATIVE_INSTANCE->quotaOperation();
+ return MCO_TO_OBJC_OP((IMAPOperation*)coreOp);
+}
+
- (void) _logWithSender:(void *)sender connectionType:(MCOConnectionLogType)logType data:(NSData *)data
{
_connectionLogger(sender, logType, data);
@@ -395,4 +441,17 @@ MCO_OBJC_SYNTHESIZE_SCALAR(unsigned int, unsigned int, setMaximumConnections, ma
return MCO_TO_OBJC_OP(coreOp);
}
+- (void) _queueRunningChanged
+{
+ if (_operationQueueRunningChangeBlock == NULL)
+ return;
+
+ _operationQueueRunningChangeBlock();
+}
+
+- (BOOL) isOperationQueueRunning
+{
+ return _session->isOperationQueueRunning();
+}
+
@end
diff --git a/src/objc/provider/MCOMailProvidersManager.mm b/src/objc/provider/MCOMailProvidersManager.mm
index 8f12aa11..b1585166 100644
--- a/src/objc/provider/MCOMailProvidersManager.mm
+++ b/src/objc/provider/MCOMailProvidersManager.mm
@@ -18,12 +18,12 @@
+ (MCOMailProvidersManager *) sharedManager
{
- static MCOMailProvidersManager * sharedInstance = nil;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- sharedInstance = [[self alloc] init]; \
- });
- return sharedInstance;
+ static MCOMailProvidersManager * sharedInstance = nil;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ sharedInstance = [[self alloc] init]; \
+ });
+ return sharedInstance;
}
- (id) init
@@ -32,27 +32,29 @@
self = [super init];
- filename = [[NSBundle bundleForClass:[self class]] pathForResource:@"providers" ofType:@"json"];
- mailcore::MailProvidersManager::sharedManager()->registerProvidersWithFilename(filename.mco_mcString);
-
+ filename = [[NSBundle bundleForClass:[self class]] pathForResource:@"providers" ofType:@"json"];
+ if (filename) {
+ mailcore::MailProvidersManager::sharedManager()->registerProvidersWithFilename(filename.mco_mcString);
+ }
+
return self;
}
- (MCOMailProvider *) providerForEmail:(NSString *)email
{
- mailcore::MailProvider *provider = mailcore::MailProvidersManager::sharedManager()->providerForEmail(email.mco_mcString);
+ mailcore::MailProvider *provider = mailcore::MailProvidersManager::sharedManager()->providerForEmail(email.mco_mcString);
return MCO_TO_OBJC(provider);
}
- (MCOMailProvider *) providerForMX:(NSString *)hostname
{
- mailcore::MailProvider *provider = mailcore::MailProvidersManager::sharedManager()->providerForMX(hostname.mco_mcString);
+ mailcore::MailProvider *provider = mailcore::MailProvidersManager::sharedManager()->providerForMX(hostname.mco_mcString);
return MCO_TO_OBJC(provider);
}
- (MCOMailProvider *) providerForIdentifier:(NSString *)identifier
{
- mailcore::MailProvider *provider = mailcore::MailProvidersManager::sharedManager()->providerForIdentifier(identifier.mco_mcString);
+ mailcore::MailProvider *provider = mailcore::MailProvidersManager::sharedManager()->providerForIdentifier(identifier.mco_mcString);
return MCO_TO_OBJC(provider);
}
diff --git a/src/objc/smtp/MCOSMTPSession.h b/src/objc/smtp/MCOSMTPSession.h
index bb7c5f57..6716ee30 100644
--- a/src/objc/smtp/MCOSMTPSession.h
+++ b/src/objc/smtp/MCOSMTPSession.h
@@ -93,6 +93,24 @@
- (MCOSMTPSendOperation *) sendOperationWithData:(NSData *)messageData;
/**
+ Returns an operation that will send the given message through SMTP.
+ It will use the sender and recipient set from the parameters.
+ It will also filter out Bcc from the content of the message.
+
+ Generate RFC 822 data using MCOMessageBuilder
+
+ MCOPOPOperation * op = [session sendOperationWithData:rfc822Data
+ from:[MCOAddress addressWithMailbox:@"hoa@etpan.org"]
+ recipients:[NSArray arrayWithObject:[MCOAddress addressWithMailbox:@"laura@etpan.org"]]];
+ [op start:^(NSError * error) {
+ ...
+ }];
+ */
+- (MCOSMTPSendOperation *) sendOperationWithData:(NSData *)messageData
+ from:(MCOAddress *)from
+ recipients:(NSArray *)recipients;
+
+/**
Returns an operation that will check whether the SMTP account is valid.
MCOPOPOperation * op = [session checkAccountOperationWithFrom:[MCOAddress addressWithMailbox:@"hoa@etpan.org"]];
diff --git a/src/objc/smtp/MCOSMTPSession.mm b/src/objc/smtp/MCOSMTPSession.mm
index c9f9f0fc..0c24f66c 100644
--- a/src/objc/smtp/MCOSMTPSession.mm
+++ b/src/objc/smtp/MCOSMTPSession.mm
@@ -109,6 +109,19 @@ MCO_OBJC_SYNTHESIZE_BOOL(setUseHeloIPEnabled, useHeloIPEnabled)
return result;
}
+- (MCOSMTPSendOperation *) sendOperationWithData:(NSData *)messageData
+ from:(MCOAddress *)from
+ recipients:(NSArray *)recipients
+{
+ mailcore::SMTPOperation * coreOp =
+ MCO_NATIVE_INSTANCE->sendMessageOperation(MCO_FROM_OBJC(Address, from),
+ MCO_FROM_OBJC(Array, recipients),
+ [messageData mco_mcData]);
+ MCOSMTPSendOperation * result = [[[MCOSMTPSendOperation alloc] initWithMCOperation:coreOp] autorelease];
+ [result setSession:self];
+ return result;
+}
+
- (MCOOperation *) checkAccountOperationWithFrom:(MCOAddress *)from
{
mailcore::SMTPOperation *coreOp = MCO_NATIVE_INSTANCE->checkAccountOperation(MCO_FROM_OBJC(mailcore::Address, from));
diff --git a/src/ui/ios/MCOMessageView.mm b/src/ui/ios/MCOMessageView.mm
index e3786bb5..1c541548 100755
--- a/src/ui/ios/MCOMessageView.mm
+++ b/src/ui/ios/MCOMessageView.mm
@@ -173,7 +173,7 @@ pre {\
void (^replaceImages)(NSError *error) = ^(NSError *error) {
NSData * downloadedData = [[self delegate] MCOMessageView:self dataForPartWithUniqueID:partUniqueID];
NSData * previewData = [[self delegate] MCOMessageView:self previewForData:downloadedData isHTMLInlineImage:[MCOCIDURLProtocol isCID:url]];
- NSString * filename = [NSString stringWithFormat:@"%lu", (unsigned long)urlString.hash];
+ NSString * filename = [NSString stringWithFormat:@"%u", downloadedData.hash];
NSURL * cacheURL = [self _cacheJPEGImageData:previewData withFilename:filename];
NSDictionary * args = @{ @"URLKey": urlString, @"LocalPathKey": cacheURL.absoluteString };
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 00000000..61fa7120
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,14 @@
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src/include)
+link_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}/../Externals/ctemplate/lib
+ ${CMAKE_CURRENT_SOURCE_DIR}/../Externals/icu4c/lib
+ ${CMAKE_CURRENT_SOURCE_DIR}/../Externals/libetpan/lib
+)
+
+find_library(FOUNDATIONFRAMEWORK NAMES Foundation)
+find_library(SECURITYFRAMEWORK NAMES Security)
+find_library(CORESERVICESFRAMEWORK NAMES CoreServices)
+
+add_executable (tests main.mm test-all.mm)
+target_link_libraries (tests MailCore z etpan xml2 icudata icui18n icuuc sasl2 iconv tidy ctemplate ssl crypto
+ ${FOUNDATIONFRAMEWORK} ${SECURITYFRAMEWORK} ${CORESERVICESFRAMEWORK})
diff --git a/tests/test-all.mm b/tests/test-all.mm
index 255e518a..2d6fe30b 100644
--- a/tests/test-all.mm
+++ b/tests/test-all.mm
@@ -8,9 +8,6 @@
#include "test-all.h"
-#include <unicode/putil.h>
-#include <unicode/uclean.h>
-#include <unicode/ucnv.h>
#include <MailCore/MailCore.h>
extern "C" {
@@ -347,8 +344,8 @@ void testObjC()
void testAll()
{
- u_setDataDirectory("/usr/local/share/icu");
-
+ mailcore::setICUDataDirectory(MCSTR("/usr/local/share/icu"));
+
email = MCSTR("email@gmail.com");
password = MCSTR("MyP4ssw0rd");
displayName = MCSTR("My Email");