diff options
114 files changed, 4141 insertions, 653 deletions
@@ -33,8 +33,8 @@ MailCore 2 provides a simple and asynchronous Objective-C API to work with the e * Add `libMailCore-ios.a` * Add `CFNetwork.framework` * Add `Security.framework` - * Set 'Other Linker Flags': `-lctemplate-ios -letpan-ios -licudata -licui18n -licuuc -lxml2 -lsasl2 -liconv -ltidy -lz` `-licucore -lstdc++ -stdlib=libstdc++ -ObjC` - * Make sure to use GNU C++ standard library. In Build Settings, locate 'C++ Standard Library', and select `libstdc++`. + * Set 'Other Linker Flags': `-lctemplate-ios -letpan-ios -licudata -licui18n -licuuc -lxml2 -lsasl2 -liconv -ltidy -lz` `-licucore -lc++ -stdlib=libc++ -ObjC` + * Make sure to use LLVM C++ standard library. Open Build Settings, scroll down to 'C++ Standard Library', and select `libc++`. * In Build Phases, add a Target Dependency of `static mailcore2 ios`. 6. Profit. diff --git a/build-mac/mailcore2.xcodeproj/project.pbxproj b/build-mac/mailcore2.xcodeproj/project.pbxproj index 4ce9c632..d7df7fc0 100755 --- a/build-mac/mailcore2.xcodeproj/project.pbxproj +++ b/build-mac/mailcore2.xcodeproj/project.pbxproj @@ -19,6 +19,19 @@ 8416A99E17F284F400B3C7DA /* MCOSMTPNoopOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8416A99C17F284F400B3C7DA /* MCOSMTPNoopOperation.mm */; }; 8416A9A117F2871D00B3C7DA /* MCOIMAPNoopOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8416A9A017F2871D00B3C7DA /* MCOIMAPNoopOperation.mm */; }; 8416A9A217F2871D00B3C7DA /* MCOIMAPNoopOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8416A9A017F2871D00B3C7DA /* MCOIMAPNoopOperation.mm */; }; + 84391342199C3AA800FEFCDD /* MCONNTPListNewsgroupsOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73789199C0260005124E5 /* MCONNTPListNewsgroupsOperation.h */; }; + 84391343199C3AAA00FEFCDD /* MCONNTPListNewsgroupsOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73789199C0260005124E5 /* MCONNTPListNewsgroupsOperation.h */; }; + 84391344199C3AB200FEFCDD /* MCONNTPDisconnectOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D7378D199C02A8005124E5 /* MCONNTPDisconnectOperation.h */; }; + 84391345199C3AB400FEFCDD /* MCONNTPDisconnectOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D7378D199C02A8005124E5 /* MCONNTPDisconnectOperation.h */; }; + 84391346199C3ABB00FEFCDD /* MCONNTPGroupInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73791199C0511005124E5 /* MCONNTPGroupInfo.h */; }; + 84391347199C3ABD00FEFCDD /* MCONNTPGroupInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73791199C0511005124E5 /* MCONNTPGroupInfo.h */; }; + 84915BB8199C4B0400EDDED9 /* MCNNTP.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8491899C18C93F92002063A3 /* MCNNTP.h */; }; + 849189A118C93FB7002063A3 /* MCNNTPSession.cc in Sources */ = {isa = PBXBuildFile; fileRef = 8491899F18C93FB7002063A3 /* MCNNTPSession.cc */; }; + 849189A218C93FB7002063A3 /* MCNNTPSession.cc in Sources */ = {isa = PBXBuildFile; fileRef = 8491899F18C93FB7002063A3 /* MCNNTPSession.cc */; }; + 849189A318C94023002063A3 /* MCNNTP.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8491899C18C93F92002063A3 /* MCNNTP.h */; }; + 849189A418C94023002063A3 /* MCNNTPSession.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 849189A018C93FB7002063A3 /* MCNNTPSession.h */; }; + 849189AB18C94986002063A3 /* MCNNTPGroupInfo.cc in Sources */ = {isa = PBXBuildFile; fileRef = 849189A918C94986002063A3 /* MCNNTPGroupInfo.cc */; }; + 849189AC18C94986002063A3 /* MCNNTPGroupInfo.cc in Sources */ = {isa = PBXBuildFile; fileRef = 849189A918C94986002063A3 /* MCNNTPGroupInfo.cc */; }; 849F53D817F28443002D417F /* MCOPOPNoopOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84B639EF17F282B4003B5BA2 /* MCOPOPNoopOperation.h */; }; 849F53D917F28443002D417F /* MCIMAPNoopOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84B639EC17F280F3003B5BA2 /* MCIMAPNoopOperation.h */; }; 849F53DA17F28443002D417F /* MCPOPNoopOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84B639E717F27EBD003B5BA2 /* MCPOPNoopOperation.h */; }; @@ -36,6 +49,73 @@ 84B639F417F2839C003B5BA2 /* MCIMAPNoopOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84B639EC17F280F3003B5BA2 /* MCIMAPNoopOperation.h */; }; 84B639F517F2839C003B5BA2 /* MCPOPNoopOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84B639E717F27EBD003B5BA2 /* MCPOPNoopOperation.h */; }; 84B639F617F2839C003B5BA2 /* MCSMTPNoopOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84B639E217F279BB003B5BA2 /* MCSMTPNoopOperation.h */; }; + 84D7372C199BF66C005124E5 /* MCNNTPAsyncSession.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D7372A199BF66C005124E5 /* MCNNTPAsyncSession.cc */; }; + 84D7372D199BF66C005124E5 /* MCNNTPAsyncSession.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D7372A199BF66C005124E5 /* MCNNTPAsyncSession.cc */; }; + 84D73730199BF704005124E5 /* MCNNTPOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D7372E199BF704005124E5 /* MCNNTPOperation.cc */; }; + 84D73731199BF704005124E5 /* MCNNTPOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D7372E199BF704005124E5 /* MCNNTPOperation.cc */; }; + 84D73733199BF7A7005124E5 /* MCNNTPProgressCallback.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73732199BF754005124E5 /* MCNNTPProgressCallback.h */; }; + 84D73734199BF7A9005124E5 /* MCNNTPProgressCallback.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73732199BF754005124E5 /* MCNNTPProgressCallback.h */; }; + 84D73737199BF7F2005124E5 /* MCNNTPFetchHeaderOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D73735199BF7F2005124E5 /* MCNNTPFetchHeaderOperation.cc */; }; + 84D73738199BF7F2005124E5 /* MCNNTPFetchHeaderOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D73735199BF7F2005124E5 /* MCNNTPFetchHeaderOperation.cc */; }; + 84D73739199BF81A005124E5 /* MCNNTPOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D7372F199BF704005124E5 /* MCNNTPOperation.h */; }; + 84D7373A199BF81D005124E5 /* MCNNTPOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D7372F199BF704005124E5 /* MCNNTPOperation.h */; }; + 84D7373D199BF83B005124E5 /* MCNNTPFetchArticleOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D7373B199BF83B005124E5 /* MCNNTPFetchArticleOperation.cc */; }; + 84D7373E199BF83B005124E5 /* MCNNTPFetchArticleOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D7373B199BF83B005124E5 /* MCNNTPFetchArticleOperation.cc */; }; + 84D73742199BF963005124E5 /* MCNNTPFetchArticlesOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D73740199BF963005124E5 /* MCNNTPFetchArticlesOperation.cc */; }; + 84D73743199BF963005124E5 /* MCNNTPFetchArticlesOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D73740199BF963005124E5 /* MCNNTPFetchArticlesOperation.cc */; }; + 84D73746199BFA8C005124E5 /* MCNNTPCheckAccountOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D73744199BFA8C005124E5 /* MCNNTPCheckAccountOperation.cc */; }; + 84D73747199BFA8C005124E5 /* MCNNTPCheckAccountOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D73744199BFA8C005124E5 /* MCNNTPCheckAccountOperation.cc */; }; + 84D73748199BFACA005124E5 /* MCNNTPAsyncSession.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D7372B199BF66C005124E5 /* MCNNTPAsyncSession.h */; }; + 84D73749199BFACF005124E5 /* MCNNTPAsyncSession.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D7372B199BF66C005124E5 /* MCNNTPAsyncSession.h */; }; + 84D7374A199BFB92005124E5 /* MCAsyncNNTP.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73729199BF63F005124E5 /* MCAsyncNNTP.h */; }; + 84D7374B199BFB94005124E5 /* MCAsyncNNTP.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73729199BF63F005124E5 /* MCAsyncNNTP.h */; }; + 84D7374C199BFB9C005124E5 /* MCNNTPFetchHeaderOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73736199BF7F2005124E5 /* MCNNTPFetchHeaderOperation.h */; }; + 84D7374D199BFB9F005124E5 /* MCNNTPFetchArticleOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D7373C199BF83B005124E5 /* MCNNTPFetchArticleOperation.h */; }; + 84D7374E199BFBBA005124E5 /* MCNNTPFetchHeaderOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73736199BF7F2005124E5 /* MCNNTPFetchHeaderOperation.h */; }; + 84D7374F199BFBC8005124E5 /* MCNNTPFetchArticlesOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73741199BF963005124E5 /* MCNNTPFetchArticlesOperation.h */; }; + 84D73750199BFBD9005124E5 /* MCNNTPFetchArticleOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D7373C199BF83B005124E5 /* MCNNTPFetchArticleOperation.h */; }; + 84D73751199BFBDF005124E5 /* MCNNTPFetchArticlesOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73741199BF963005124E5 /* MCNNTPFetchArticlesOperation.h */; }; + 84D73752199BFBE3005124E5 /* MCNNTPCheckAccountOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73745199BFA8C005124E5 /* MCNNTPCheckAccountOperation.h */; }; + 84D73753199BFBE6005124E5 /* MCNNTPCheckAccountOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73745199BFA8C005124E5 /* MCNNTPCheckAccountOperation.h */; }; + 84D73754199BFBEC005124E5 /* MCNNTPOperationCallback.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D7373F199BF887005124E5 /* MCNNTPOperationCallback.h */; }; + 84D73755199BFBF2005124E5 /* MCNNTPOperationCallback.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D7373F199BF887005124E5 /* MCNNTPOperationCallback.h */; }; + 84D73758199BFC8A005124E5 /* MCNNTPDisconnectOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D73756199BFC8A005124E5 /* MCNNTPDisconnectOperation.cc */; }; + 84D73759199BFC8A005124E5 /* MCNNTPDisconnectOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D73756199BFC8A005124E5 /* MCNNTPDisconnectOperation.cc */; }; + 84D7375C199BFDCA005124E5 /* MCNNTPListNewsgroupsOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D7375A199BFDCA005124E5 /* MCNNTPListNewsgroupsOperation.cc */; }; + 84D7375D199BFDCA005124E5 /* MCNNTPListNewsgroupsOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 84D7375A199BFDCA005124E5 /* MCNNTPListNewsgroupsOperation.cc */; }; + 84D7375E199BFF34005124E5 /* MCNNTPListNewsgroupsOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D7375B199BFDCA005124E5 /* MCNNTPListNewsgroupsOperation.h */; }; + 84D7375F199BFF38005124E5 /* MCNNTPListNewsgroupsOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D7375B199BFDCA005124E5 /* MCNNTPListNewsgroupsOperation.h */; }; + 84D73764199BFFC7005124E5 /* MCONNTPSession.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D73763199BFFC7005124E5 /* MCONNTPSession.mm */; }; + 84D73765199BFFC7005124E5 /* MCONNTPSession.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D73763199BFFC7005124E5 /* MCONNTPSession.mm */; }; + 84D73768199BFFFC005124E5 /* MCONNTPOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D73767199BFFFC005124E5 /* MCONNTPOperation.mm */; }; + 84D73769199BFFFC005124E5 /* MCONNTPOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D73767199BFFFC005124E5 /* MCONNTPOperation.mm */; }; + 84D7376D199C005A005124E5 /* MCONNTPFetchHeaderOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D7376C199C005A005124E5 /* MCONNTPFetchHeaderOperation.mm */; }; + 84D7376E199C005A005124E5 /* MCONNTPFetchHeaderOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D7376C199C005A005124E5 /* MCONNTPFetchHeaderOperation.mm */; }; + 84D73771199C007E005124E5 /* MCONNTPFetchArticleOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D73770199C007E005124E5 /* MCONNTPFetchArticleOperation.mm */; }; + 84D73772199C007E005124E5 /* MCONNTPFetchArticleOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D73770199C007E005124E5 /* MCONNTPFetchArticleOperation.mm */; }; + 84D73775199C00AB005124E5 /* MCONNTPFetchArticlesOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D73774199C00AB005124E5 /* MCONNTPFetchArticlesOperation.mm */; }; + 84D73776199C00AB005124E5 /* MCONNTPFetchArticlesOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D73774199C00AB005124E5 /* MCONNTPFetchArticlesOperation.mm */; }; + 84D7377B199C00F5005124E5 /* MCONNTP.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73761199BFF80005124E5 /* MCONNTP.h */; }; + 84D7377C199C00F7005124E5 /* MCONNTP.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73761199BFF80005124E5 /* MCONNTP.h */; }; + 84D7377D199C00FE005124E5 /* MCONNTPSession.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73762199BFFC7005124E5 /* MCONNTPSession.h */; }; + 84D7377E199C0100005124E5 /* MCONNTPSession.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73762199BFFC7005124E5 /* MCONNTPSession.h */; }; + 84D7377F199C0104005124E5 /* MCONNTPOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73766199BFFFC005124E5 /* MCONNTPOperation.h */; }; + 84D73780199C0107005124E5 /* MCONNTPFetchHeaderOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D7376B199C005A005124E5 /* MCONNTPFetchHeaderOperation.h */; }; + 84D73781199C010A005124E5 /* MCONNTPFetchArticleOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D7376F199C007E005124E5 /* MCONNTPFetchArticleOperation.h */; }; + 84D73782199C010B005124E5 /* MCONNTPFetchArticlesOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73773199C00AB005124E5 /* MCONNTPFetchArticlesOperation.h */; }; + 84D73784199C0114005124E5 /* MCONNTPOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73766199BFFFC005124E5 /* MCONNTPOperation.h */; }; + 84D73785199C0117005124E5 /* MCONNTPFetchHeaderOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D7376B199C005A005124E5 /* MCONNTPFetchHeaderOperation.h */; }; + 84D73786199C0118005124E5 /* MCONNTPFetchArticleOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D7376F199C007E005124E5 /* MCONNTPFetchArticleOperation.h */; }; + 84D73787199C011A005124E5 /* MCONNTPFetchArticlesOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73773199C00AB005124E5 /* MCONNTPFetchArticlesOperation.h */; }; + 84D7378B199C0260005124E5 /* MCONNTPListNewsgroupsOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D7378A199C0260005124E5 /* MCONNTPListNewsgroupsOperation.mm */; }; + 84D7378C199C0260005124E5 /* MCONNTPListNewsgroupsOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D7378A199C0260005124E5 /* MCONNTPListNewsgroupsOperation.mm */; }; + 84D7378F199C02A8005124E5 /* MCONNTPDisconnectOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D7378E199C02A8005124E5 /* MCONNTPDisconnectOperation.mm */; }; + 84D73790199C02A8005124E5 /* MCONNTPDisconnectOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D7378E199C02A8005124E5 /* MCONNTPDisconnectOperation.mm */; }; + 84D73793199C0511005124E5 /* MCONNTPGroupInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D73792199C0511005124E5 /* MCONNTPGroupInfo.mm */; }; + 84D73794199C0511005124E5 /* MCONNTPGroupInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D73792199C0511005124E5 /* MCONNTPGroupInfo.mm */; }; + 84E65533199BE15500EC8CC4 /* MCNNTPSession.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 849189A018C93FB7002063A3 /* MCNNTPSession.h */; }; + 84E65534199BE2BF00EC8CC4 /* MCNNTPGroupInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 849189AA18C94986002063A3 /* MCNNTPGroupInfo.h */; }; + 84E65535199BE2C300EC8CC4 /* MCNNTPGroupInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 849189AA18C94986002063A3 /* MCNNTPGroupInfo.h */; }; 943F1A9A17D964F600F0C798 /* MCIMAPConnectOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 943F1A9817D964F600F0C798 /* MCIMAPConnectOperation.cc */; }; 943F1A9E17D96C5500F0C798 /* MCIMAPConnectOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 943F1A9817D964F600F0C798 /* MCIMAPConnectOperation.cc */; }; 943F1AA017D9736100F0C798 /* MCIMAPConnectOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 943F1A9917D964F600F0C798 /* MCIMAPConnectOperation.h */; }; @@ -783,21 +863,37 @@ dstPath = include/MailCore; dstSubfolderSpec = 16; files = ( + 849189A318C94023002063A3 /* MCNNTP.h in CopyFiles */, + 849189A418C94023002063A3 /* MCNNTPSession.h in CopyFiles */, 84B639F317F2839C003B5BA2 /* MCOPOPNoopOperation.h in CopyFiles */, 84B639F417F2839C003B5BA2 /* MCIMAPNoopOperation.h in CopyFiles */, + 84D7377B199C00F5005124E5 /* MCONNTP.h in CopyFiles */, 84B639F517F2839C003B5BA2 /* MCPOPNoopOperation.h in CopyFiles */, + 84D7374B199BFB94005124E5 /* MCAsyncNNTP.h in CopyFiles */, + 84D7377E199C0100005124E5 /* MCONNTPSession.h in CopyFiles */, 84B639F617F2839C003B5BA2 /* MCSMTPNoopOperation.h in CopyFiles */, + 84E65535199BE2C300EC8CC4 /* MCNNTPGroupInfo.h in CopyFiles */, 943F1AA017D9736100F0C798 /* MCIMAPConnectOperation.h in CopyFiles */, 4BE4029217B548D900ECC5E4 /* MCIMAPQuotaOperation.h in CopyFiles */, + 84391342199C3AA800FEFCDD /* MCONNTPListNewsgroupsOperation.h in CopyFiles */, 4BE4029117B548B900ECC5E4 /* MCOIMAPQuotaOperation.h in CopyFiles */, + 84D7374C199BFB9C005124E5 /* MCNNTPFetchHeaderOperation.h in CopyFiles */, + 84391345199C3AB400FEFCDD /* MCONNTPDisconnectOperation.h in CopyFiles */, C69BA85E17DEFD9F00D601B7 /* NSIndexSet+MCO.h in CopyFiles */, + 84391346199C3ABB00FEFCDD /* MCONNTPGroupInfo.h in CopyFiles */, + 84D7373A199BF81D005124E5 /* MCNNTPOperation.h in CopyFiles */, + 84D73753199BFBE6005124E5 /* MCNNTPCheckAccountOperation.h in CopyFiles */, + 84D73748199BFACA005124E5 /* MCNNTPAsyncSession.h in CopyFiles */, + 84D7375F199BFF38005124E5 /* MCNNTPListNewsgroupsOperation.h in CopyFiles */, C6E665001790963E0063F2CF /* MCIMAPMessageRenderingOperation.h in CopyFiles */, DAE42E89178F7E1800E0DB8F /* MCOIMAPMessageRenderingOperation.h in CopyFiles */, C63D316617C997B400A4D993 /* MCOIMAPIdentity.h in CopyFiles */, + 84D73754199BFBEC005124E5 /* MCNNTPOperationCallback.h in CopyFiles */, C63D315E17C9279700A4D993 /* MCIMAPIdentity.h in CopyFiles */, 9E774D8C1767CD490065EB9B /* MCIMAPFolderStatus.h in CopyFiles */, 9EF9AB24175F409D0027FA3B /* MCIMAPFolderStatusOperation.h in CopyFiles */, 9EF9AB22175F406D0027FA3B /* MCOIMAPFolderStatus.h in CopyFiles */, + 84D73733199BF7A7005124E5 /* MCNNTPProgressCallback.h in CopyFiles */, 9EF9AB23175F406D0027FA3B /* MCOIMAPFolderStatusOperation.h in CopyFiles */, C6CF62CD1753250E006398B9 /* MCOMailProvider.h in CopyFiles */, C6CF62CE17532510006398B9 /* MCOMailProvidersManager.h in CopyFiles */, @@ -831,9 +927,13 @@ C6F61FAD170288610073032E /* MCOAttachment.h in CopyFiles */, C6F61FAF170288660073032E /* MCOMessageParser.h in CopyFiles */, C6F61FB0170288680073032E /* MCOMessagePart.h in CopyFiles */, + 84D7377F199C0104005124E5 /* MCONNTPOperation.h in CopyFiles */, + 84D73780199C0107005124E5 /* MCONNTPFetchHeaderOperation.h in CopyFiles */, C6D6F959171E5D5E006F5B28 /* MCMD5.h in CopyFiles */, C6F61FA0170187B80073032E /* MCOIMAPFolderInfoOperation.h in CopyFiles */, C6F61FA4170187C30073032E /* MCOIMAPFetchMessagesOperation.h in CopyFiles */, + 84D73781199C010A005124E5 /* MCONNTPFetchArticleOperation.h in CopyFiles */, + 84D73782199C010B005124E5 /* MCONNTPFetchArticlesOperation.h in CopyFiles */, C6F61FA3170187BD0073032E /* MCOIMAPCopyMessagesOperation.h in CopyFiles */, C6D6F95A171E5D60006F5B28 /* MCJSON.h in CopyFiles */, C6F61FA2170187BC0073032E /* MCOIMAPAppendMessageOperation.h in CopyFiles */, @@ -860,6 +960,8 @@ C6F5B9F516FEBB4500D9DABD /* MCOIMAPFolder.h in CopyFiles */, C623C59016FE71B2001BBEFC /* MCOIMAPOperation.h in CopyFiles */, C6F5B9F616FEBB4900D9DABD /* MCOIMAPMessage.h in CopyFiles */, + 84D73750199BFBD9005124E5 /* MCNNTPFetchArticleOperation.h in CopyFiles */, + 84D7374F199BFBC8005124E5 /* MCNNTPFetchArticlesOperation.h in CopyFiles */, C623C58916FD8B71001BBEFC /* MCOUtils.h in CopyFiles */, C64EA74F169E859600778456 /* MCAbstractMessage.h in CopyFiles */, C623C58816FD6DF6001BBEFC /* NSValue+MCO.h in CopyFiles */, @@ -986,19 +1088,40 @@ 849F53D917F28443002D417F /* MCIMAPNoopOperation.h in CopyFiles */, 849F53DA17F28443002D417F /* MCPOPNoopOperation.h in CopyFiles */, 849F53DB17F28443002D417F /* MCSMTPNoopOperation.h in CopyFiles */, + 84915BB8199C4B0400EDDED9 /* MCNNTP.h in CopyFiles */, + 84D7377C199C00F7005124E5 /* MCONNTP.h in CopyFiles */, + 84D7374A199BFB92005124E5 /* MCAsyncNNTP.h in CopyFiles */, 943F1AA117D973A800F0C798 /* MCIMAPConnectOperation.h in CopyFiles */, + 84D73784199C0114005124E5 /* MCONNTPOperation.h in CopyFiles */, + 84D7377D199C00FE005124E5 /* MCONNTPSession.h in CopyFiles */, 4B3C1BE417AC0156008BBF4C /* MCIMAPQuotaOperation.h in CopyFiles */, + 84E65534199BE2BF00EC8CC4 /* MCNNTPGroupInfo.h in CopyFiles */, + 84D73785199C0117005124E5 /* MCONNTPFetchHeaderOperation.h in CopyFiles */, + 84D73739199BF81A005124E5 /* MCNNTPOperation.h in CopyFiles */, + 84D73787199C011A005124E5 /* MCONNTPFetchArticlesOperation.h in CopyFiles */, + 84391344199C3AB200FEFCDD /* MCONNTPDisconnectOperation.h in CopyFiles */, + 84391343199C3AAA00FEFCDD /* MCONNTPListNewsgroupsOperation.h in CopyFiles */, + 84D73786199C0118005124E5 /* MCONNTPFetchArticleOperation.h in CopyFiles */, + 84391347199C3ABD00FEFCDD /* MCONNTPGroupInfo.h in CopyFiles */, + 84D73749199BFACF005124E5 /* MCNNTPAsyncSession.h in CopyFiles */, + 84D73752199BFBE3005124E5 /* MCNNTPCheckAccountOperation.h in CopyFiles */, 4B3C1BE217ABFF7C008BBF4C /* MCOIMAPQuotaOperation.h in CopyFiles */, + 84D7374E199BFBBA005124E5 /* MCNNTPFetchHeaderOperation.h in CopyFiles */, + 84D7375E199BFF34005124E5 /* MCNNTPListNewsgroupsOperation.h in CopyFiles */, C63D316717C997BA00A4D993 /* MCOIMAPIdentity.h in CopyFiles */, + 84D7374D199BFB9F005124E5 /* MCNNTPFetchArticleOperation.h in CopyFiles */, DAE42E8A178F7E2200E0DB8F /* MCOIMAPMessageRenderingOperation.h in CopyFiles */, C6E6652F1791B2530063F2CF /* MCIMAPMessageRenderingOperation.h in CopyFiles */, + 84D73751199BFBDF005124E5 /* MCNNTPFetchArticlesOperation.h in CopyFiles */, 9E774D8B1767CD3C0065EB9B /* MCIMAPFolderStatus.h in CopyFiles */, + 84D73755199BFBF2005124E5 /* MCNNTPOperationCallback.h in CopyFiles */, 9EF9AB25175F40C70027FA3B /* MCIMAPFolderStatusOperation.h in CopyFiles */, 9EF9AB20175F3FD10027FA3B /* MCOIMAPFolderStatus.h in CopyFiles */, 9EF9AB21175F3FD10027FA3B /* MCOIMAPFolderStatusOperation.h in CopyFiles */, C6CF62D5175325BB006398B9 /* MCOMailProvider.h in CopyFiles */, C6CF62D6175325BD006398B9 /* MCOMailProvidersManager.h in CopyFiles */, C63D315F17C9279D00A4D993 /* MCIMAPIdentity.h in CopyFiles */, + 84D73734199BF7A9005124E5 /* MCNNTPProgressCallback.h in CopyFiles */, C6CF62D7175325BF006398B9 /* MCONetService.h in CopyFiles */, C6CF62D8175325C5006398B9 /* MCOProvider.h in CopyFiles */, C68B2AEF1778A869005E61EF /* MCConnectionLogger.h in CopyFiles */, @@ -1008,6 +1131,7 @@ C6BA2B0D1705F4E6003F0E9E /* MCOMultipart.h in CopyFiles */, C6BA2B0E1705F4E6003F0E9E /* MCOMessageBuilder.h in CopyFiles */, C6D6F97117211177006F5B28 /* MCIterator.h in CopyFiles */, + 84E65533199BE15500EC8CC4 /* MCNNTPSession.h in CopyFiles */, C6A81BF1170780EC00882C15 /* MCOPOPSession.h in CopyFiles */, C6A81C04170A82F300882C15 /* MCIMAPSyncResult.h in CopyFiles */, C6BA2B0F1705F4E6003F0E9E /* MCOIMAPBaseOperation.h in CopyFiles */, @@ -1177,6 +1301,11 @@ 8416A99C17F284F400B3C7DA /* MCOSMTPNoopOperation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCOSMTPNoopOperation.mm; sourceTree = "<group>"; }; 8416A99F17F2871D00B3C7DA /* MCOIMAPNoopOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCOIMAPNoopOperation.h; sourceTree = "<group>"; }; 8416A9A017F2871D00B3C7DA /* MCOIMAPNoopOperation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCOIMAPNoopOperation.mm; sourceTree = "<group>"; }; + 8491899C18C93F92002063A3 /* MCNNTP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MCNNTP.h; path = nntp/MCNNTP.h; sourceTree = "<group>"; }; + 8491899F18C93FB7002063A3 /* MCNNTPSession.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MCNNTPSession.cc; path = nntp/MCNNTPSession.cc; sourceTree = "<group>"; }; + 849189A018C93FB7002063A3 /* MCNNTPSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MCNNTPSession.h; path = nntp/MCNNTPSession.h; sourceTree = "<group>"; }; + 849189A918C94986002063A3 /* MCNNTPGroupInfo.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MCNNTPGroupInfo.cc; path = nntp/MCNNTPGroupInfo.cc; sourceTree = "<group>"; }; + 849189AA18C94986002063A3 /* MCNNTPGroupInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MCNNTPGroupInfo.h; path = nntp/MCNNTPGroupInfo.h; sourceTree = "<group>"; }; 84AF9E7D172DBAF600E60AA3 /* providers.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = providers.json; path = ../resources/providers.json; sourceTree = "<group>"; }; 84B639E117F279BB003B5BA2 /* MCSMTPNoopOperation.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCSMTPNoopOperation.cc; sourceTree = "<group>"; }; 84B639E217F279BB003B5BA2 /* MCSMTPNoopOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCSMTPNoopOperation.h; sourceTree = "<group>"; }; @@ -1186,6 +1315,43 @@ 84B639EC17F280F3003B5BA2 /* MCIMAPNoopOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCIMAPNoopOperation.h; sourceTree = "<group>"; }; 84B639EF17F282B4003B5BA2 /* MCOPOPNoopOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCOPOPNoopOperation.h; sourceTree = "<group>"; }; 84B639F017F282B4003B5BA2 /* MCOPOPNoopOperation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCOPOPNoopOperation.mm; sourceTree = "<group>"; }; + 84D73729199BF63F005124E5 /* MCAsyncNNTP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCAsyncNNTP.h; sourceTree = "<group>"; }; + 84D7372A199BF66C005124E5 /* MCNNTPAsyncSession.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCNNTPAsyncSession.cc; sourceTree = "<group>"; }; + 84D7372B199BF66C005124E5 /* MCNNTPAsyncSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCNNTPAsyncSession.h; sourceTree = "<group>"; }; + 84D7372E199BF704005124E5 /* MCNNTPOperation.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCNNTPOperation.cc; sourceTree = "<group>"; }; + 84D7372F199BF704005124E5 /* MCNNTPOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCNNTPOperation.h; sourceTree = "<group>"; }; + 84D73732199BF754005124E5 /* MCNNTPProgressCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MCNNTPProgressCallback.h; path = nntp/MCNNTPProgressCallback.h; sourceTree = "<group>"; }; + 84D73735199BF7F2005124E5 /* MCNNTPFetchHeaderOperation.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCNNTPFetchHeaderOperation.cc; sourceTree = "<group>"; }; + 84D73736199BF7F2005124E5 /* MCNNTPFetchHeaderOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCNNTPFetchHeaderOperation.h; sourceTree = "<group>"; }; + 84D7373B199BF83B005124E5 /* MCNNTPFetchArticleOperation.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCNNTPFetchArticleOperation.cc; sourceTree = "<group>"; }; + 84D7373C199BF83B005124E5 /* MCNNTPFetchArticleOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCNNTPFetchArticleOperation.h; sourceTree = "<group>"; }; + 84D7373F199BF887005124E5 /* MCNNTPOperationCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCNNTPOperationCallback.h; sourceTree = "<group>"; }; + 84D73740199BF963005124E5 /* MCNNTPFetchArticlesOperation.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCNNTPFetchArticlesOperation.cc; sourceTree = "<group>"; }; + 84D73741199BF963005124E5 /* MCNNTPFetchArticlesOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCNNTPFetchArticlesOperation.h; sourceTree = "<group>"; }; + 84D73744199BFA8C005124E5 /* MCNNTPCheckAccountOperation.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCNNTPCheckAccountOperation.cc; sourceTree = "<group>"; }; + 84D73745199BFA8C005124E5 /* MCNNTPCheckAccountOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCNNTPCheckAccountOperation.h; sourceTree = "<group>"; }; + 84D73756199BFC8A005124E5 /* MCNNTPDisconnectOperation.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCNNTPDisconnectOperation.cc; sourceTree = "<group>"; }; + 84D73757199BFC8A005124E5 /* MCNNTPDisconnectOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCNNTPDisconnectOperation.h; sourceTree = "<group>"; }; + 84D7375A199BFDCA005124E5 /* MCNNTPListNewsgroupsOperation.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCNNTPListNewsgroupsOperation.cc; sourceTree = "<group>"; }; + 84D7375B199BFDCA005124E5 /* MCNNTPListNewsgroupsOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCNNTPListNewsgroupsOperation.h; sourceTree = "<group>"; }; + 84D73761199BFF80005124E5 /* MCONNTP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCONNTP.h; sourceTree = "<group>"; }; + 84D73762199BFFC7005124E5 /* MCONNTPSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCONNTPSession.h; sourceTree = "<group>"; }; + 84D73763199BFFC7005124E5 /* MCONNTPSession.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCONNTPSession.mm; sourceTree = "<group>"; }; + 84D73766199BFFFC005124E5 /* MCONNTPOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCONNTPOperation.h; sourceTree = "<group>"; }; + 84D73767199BFFFC005124E5 /* MCONNTPOperation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCONNTPOperation.mm; sourceTree = "<group>"; }; + 84D7376A199C0014005124E5 /* MCONNTPOperation+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MCONNTPOperation+Private.h"; sourceTree = "<group>"; }; + 84D7376B199C005A005124E5 /* MCONNTPFetchHeaderOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCONNTPFetchHeaderOperation.h; sourceTree = "<group>"; }; + 84D7376C199C005A005124E5 /* MCONNTPFetchHeaderOperation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCONNTPFetchHeaderOperation.mm; sourceTree = "<group>"; }; + 84D7376F199C007E005124E5 /* MCONNTPFetchArticleOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCONNTPFetchArticleOperation.h; sourceTree = "<group>"; }; + 84D73770199C007E005124E5 /* MCONNTPFetchArticleOperation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCONNTPFetchArticleOperation.mm; sourceTree = "<group>"; }; + 84D73773199C00AB005124E5 /* MCONNTPFetchArticlesOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCONNTPFetchArticlesOperation.h; sourceTree = "<group>"; }; + 84D73774199C00AB005124E5 /* MCONNTPFetchArticlesOperation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCONNTPFetchArticlesOperation.mm; sourceTree = "<group>"; }; + 84D73789199C0260005124E5 /* MCONNTPListNewsgroupsOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCONNTPListNewsgroupsOperation.h; sourceTree = "<group>"; }; + 84D7378A199C0260005124E5 /* MCONNTPListNewsgroupsOperation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCONNTPListNewsgroupsOperation.mm; sourceTree = "<group>"; }; + 84D7378D199C02A8005124E5 /* MCONNTPDisconnectOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCONNTPDisconnectOperation.h; sourceTree = "<group>"; }; + 84D7378E199C02A8005124E5 /* MCONNTPDisconnectOperation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCONNTPDisconnectOperation.mm; sourceTree = "<group>"; }; + 84D73791199C0511005124E5 /* MCONNTPGroupInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCONNTPGroupInfo.h; sourceTree = "<group>"; }; + 84D73792199C0511005124E5 /* MCONNTPGroupInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCONNTPGroupInfo.mm; sourceTree = "<group>"; }; 943F1A9817D964F600F0C798 /* MCIMAPConnectOperation.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCIMAPConnectOperation.cc; sourceTree = "<group>"; }; 943F1A9917D964F600F0C798 /* MCIMAPConnectOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCIMAPConnectOperation.h; sourceTree = "<group>"; }; 9E774D871767C54E0065EB9B /* MCIMAPFolderStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCIMAPFolderStatus.h; sourceTree = "<group>"; }; @@ -1657,6 +1823,19 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 8491899A18C93F6E002063A3 /* nntp */ = { + isa = PBXGroup; + children = ( + 8491899C18C93F92002063A3 /* MCNNTP.h */, + 849189A918C94986002063A3 /* MCNNTPGroupInfo.cc */, + 849189AA18C94986002063A3 /* MCNNTPGroupInfo.h */, + 84D73732199BF754005124E5 /* MCNNTPProgressCallback.h */, + 8491899F18C93FB7002063A3 /* MCNNTPSession.cc */, + 849189A018C93FB7002063A3 /* MCNNTPSession.h */, + ); + name = nntp; + sourceTree = "<group>"; + }; 84AF9E72172DACC900E60AA3 /* provider */ = { isa = PBXGroup; children = ( @@ -1685,6 +1864,56 @@ path = provider; sourceTree = "<group>"; }; + 84D73728199BF61B005124E5 /* nntp */ = { + isa = PBXGroup; + children = ( + 84D73729199BF63F005124E5 /* MCAsyncNNTP.h */, + 84D7372A199BF66C005124E5 /* MCNNTPAsyncSession.cc */, + 84D7372B199BF66C005124E5 /* MCNNTPAsyncSession.h */, + 84D73735199BF7F2005124E5 /* MCNNTPFetchHeaderOperation.cc */, + 84D73736199BF7F2005124E5 /* MCNNTPFetchHeaderOperation.h */, + 84D7373B199BF83B005124E5 /* MCNNTPFetchArticleOperation.cc */, + 84D7373C199BF83B005124E5 /* MCNNTPFetchArticleOperation.h */, + 84D7375A199BFDCA005124E5 /* MCNNTPListNewsgroupsOperation.cc */, + 84D7375B199BFDCA005124E5 /* MCNNTPListNewsgroupsOperation.h */, + 84D73740199BF963005124E5 /* MCNNTPFetchArticlesOperation.cc */, + 84D73741199BF963005124E5 /* MCNNTPFetchArticlesOperation.h */, + 84D73744199BFA8C005124E5 /* MCNNTPCheckAccountOperation.cc */, + 84D73745199BFA8C005124E5 /* MCNNTPCheckAccountOperation.h */, + 84D73756199BFC8A005124E5 /* MCNNTPDisconnectOperation.cc */, + 84D73757199BFC8A005124E5 /* MCNNTPDisconnectOperation.h */, + 84D7372E199BF704005124E5 /* MCNNTPOperation.cc */, + 84D7372F199BF704005124E5 /* MCNNTPOperation.h */, + 84D7373F199BF887005124E5 /* MCNNTPOperationCallback.h */, + ); + path = nntp; + sourceTree = "<group>"; + }; + 84D73760199BFF6A005124E5 /* nntp */ = { + isa = PBXGroup; + children = ( + 84D73761199BFF80005124E5 /* MCONNTP.h */, + 84D73762199BFFC7005124E5 /* MCONNTPSession.h */, + 84D73763199BFFC7005124E5 /* MCONNTPSession.mm */, + 84D73766199BFFFC005124E5 /* MCONNTPOperation.h */, + 84D7376A199C0014005124E5 /* MCONNTPOperation+Private.h */, + 84D73767199BFFFC005124E5 /* MCONNTPOperation.mm */, + 84D7376B199C005A005124E5 /* MCONNTPFetchHeaderOperation.h */, + 84D7376C199C005A005124E5 /* MCONNTPFetchHeaderOperation.mm */, + 84D7376F199C007E005124E5 /* MCONNTPFetchArticleOperation.h */, + 84D73770199C007E005124E5 /* MCONNTPFetchArticleOperation.mm */, + 84D73789199C0260005124E5 /* MCONNTPListNewsgroupsOperation.h */, + 84D7378A199C0260005124E5 /* MCONNTPListNewsgroupsOperation.mm */, + 84D73773199C00AB005124E5 /* MCONNTPFetchArticlesOperation.h */, + 84D73774199C00AB005124E5 /* MCONNTPFetchArticlesOperation.mm */, + 84D7378D199C02A8005124E5 /* MCONNTPDisconnectOperation.h */, + 84D7378E199C02A8005124E5 /* MCONNTPDisconnectOperation.mm */, + 84D73791199C0511005124E5 /* MCONNTPGroupInfo.h */, + 84D73792199C0511005124E5 /* MCONNTPGroupInfo.mm */, + ); + path = nntp; + sourceTree = "<group>"; + }; C63CD67616BDCDD300DB18F1 /* renderer */ = { isa = PBXGroup; children = ( @@ -1795,6 +2024,7 @@ children = ( C64EA68B169E847800778456 /* imap */, C64EA68D169E847800778456 /* pop */, + 84D73728199BF61B005124E5 /* nntp */, C64EA68E169E847800778456 /* smtp */, C64EA7E416A14A4500778456 /* MCAsync.h */, ); @@ -1923,6 +2153,7 @@ C64EA6A1169E847800778456 /* basetypes */, C64EA6C3169E847800778456 /* imap */, C64EA6D8169E847800778456 /* pop */, + 8491899A18C93F6E002063A3 /* nntp */, C63CD67616BDCDD300DB18F1 /* renderer */, C64EA6DF169E847800778456 /* rfc822 */, C64EA6EB169E847800778456 /* smtp */, @@ -2159,6 +2390,7 @@ children = ( C6F61F771701420A0073032E /* pop */, C6F61F781701420A0073032E /* smtp */, + 84D73760199BFF6A005124E5 /* nntp */, C64BB23216EDA9E8000DB34C /* abstract */, F8EA941316BAED500011AC6F /* imap */, C64BB25B16FD3E98000DB34C /* rfc822 */, @@ -2554,6 +2786,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 84D7373D199BF83B005124E5 /* MCNNTPFetchArticleOperation.cc in Sources */, C64EA6F4169E847800778456 /* MCAbstractMessage.cc in Sources */, C64EA6F6169E847800778456 /* MCAbstractMessagePart.cc in Sources */, 84B639ED17F280F3003B5BA2 /* MCIMAPNoopOperation.cc in Sources */, @@ -2566,6 +2799,7 @@ C6E665B51796500B0063F2CF /* MCZip.cc in Sources */, 84B639E317F279BB003B5BA2 /* MCSMTPNoopOperation.cc in Sources */, C64EA706169E847800778456 /* MCAssert.c in Sources */, + 84D73793199C0511005124E5 /* MCONNTPGroupInfo.mm in Sources */, C64EA708169E847800778456 /* MCData.cc in Sources */, C64EA70A169E847800778456 /* MCHash.cc in Sources */, C64EA70C169E847800778456 /* MCHashMap.cc in Sources */, @@ -2581,6 +2815,7 @@ C64EA723169E847800778456 /* MCIMAPFolder.cc in Sources */, C64EA725169E847800778456 /* MCIMAPMessage.cc in Sources */, C64EA727169E847800778456 /* MCIMAPMessagePart.cc in Sources */, + 84D73775199C00AB005124E5 /* MCONNTPFetchArticlesOperation.mm in Sources */, C64EA729169E847800778456 /* MCIMAPMultipart.cc in Sources */, C64EA72B169E847800778456 /* MCIMAPNamespace.cc in Sources */, C64EA72D169E847800778456 /* MCIMAPNamespaceItem.cc in Sources */, @@ -2590,10 +2825,12 @@ C68B2AF717797389005E61EF /* MCConnectionLoggerUtils.cc in Sources */, C64EA737169E847800778456 /* MCPOPMessageInfo.cc in Sources */, C64EA73A169E847800778456 /* MCPOPSession.cc in Sources */, + 84D7375C199BFDCA005124E5 /* MCNNTPListNewsgroupsOperation.cc in Sources */, C64EA73C169E847800778456 /* MCAttachment.cc in Sources */, C64EA73E169E847800778456 /* MCMessageBuilder.cc in Sources */, C64EA740169E847800778456 /* MCMessageParser.cc in Sources */, C64EA742169E847800778456 /* MCMessagePart.cc in Sources */, + 84D7378B199C0260005124E5 /* MCONNTPListNewsgroupsOperation.mm in Sources */, C64EA744169E847800778456 /* MCMultipart.cc in Sources */, C64EA781169E89F600778456 /* MCSMTPSession.cc in Sources */, 8416A9A117F2871D00B3C7DA /* MCOIMAPNoopOperation.mm in Sources */, @@ -2609,14 +2846,17 @@ C64EA80216A295E400778456 /* MCIMAPRenameFolderOperation.cc in Sources */, C64EA80516A2997E00778456 /* MCIMAPDeleteFolderOperation.cc in Sources */, C63D315C17C9155C00A4D993 /* MCIMAPIdentity.cc in Sources */, + 84D73742199BF963005124E5 /* MCNNTPFetchArticlesOperation.cc in Sources */, C64EA80816A2999A00778456 /* MCIMAPCreateFolderOperation.cc in Sources */, C64EA80B16A299B700778456 /* MCIMAPSubscribeFolderOperation.cc in Sources */, + 84D7372C199BF66C005124E5 /* MCNNTPAsyncSession.cc in Sources */, C64EA81116A299ED00778456 /* MCIMAPAppendMessageOperation.cc in Sources */, C64EA81416A29A2300778456 /* MCIMAPCopyMessagesOperation.cc in Sources */, C64EA81716A29A8700778456 /* MCIMAPExpungeOperation.cc in Sources */, C69BA85B17DEFCCB00D601B7 /* NSIndexSet+MCO.m in Sources */, C64EA81A16A29AF200778456 /* MCIMAPFetchMessagesOperation.cc in Sources */, C64EA81D16A29DC500778456 /* MCIMAPFetchContentOperation.cc in Sources */, + 84D73746199BFA8C005124E5 /* MCNNTPCheckAccountOperation.cc in Sources */, C64EA82016A29E4100778456 /* MCIMAPStoreFlagsOperation.cc in Sources */, C64EA82316A29E5300778456 /* MCIMAPStoreLabelsOperation.cc in Sources */, C643F492189A3D59007EA2F7 /* NSSet+MCO.mm in Sources */, @@ -2625,7 +2865,9 @@ C64EA82916A29F2200778456 /* MCIMAPIdleOperation.cc in Sources */, C6E665B91796500C0063F2CF /* mztools.c in Sources */, C64EA82C16A2A08B00778456 /* MCIMAPFetchNamespaceOperation.cc in Sources */, + 84D73758199BFC8A005124E5 /* MCNNTPDisconnectOperation.cc in Sources */, 84B639E817F27EBD003B5BA2 /* MCPOPNoopOperation.cc in Sources */, + 849189A118C93FB7002063A3 /* MCNNTPSession.cc in Sources */, C62C6ED416A2A0E600737497 /* MCIMAPIdentityOperation.cc in Sources */, C62C6ED816A398FA00737497 /* MCIMAPFolderInfoOperation.cc in Sources */, C62C6EDA16A3D60700737497 /* MCIMAPAsyncConnection.cc in Sources */, @@ -2639,6 +2881,8 @@ C6D42C1D16AE03D6002BB4F9 /* NSData+MCO.mm in Sources */, C6D42C1E16AE03D6002BB4F9 /* NSString+MCO.mm in Sources */, C64FF39116B3C13000F8C162 /* MCOObjectWrapper.mm in Sources */, + 84D73737199BF7F2005124E5 /* MCNNTPFetchHeaderOperation.cc in Sources */, + 84D7376D199C005A005124E5 /* MCONNTPFetchHeaderOperation.mm in Sources */, C6E665B71796500B0063F2CF /* ioapi.c in Sources */, C07ADC28B83E7959BF114D46 /* MCOIMAPSession.mm in Sources */, C07AD99B2E2054C684DB8FF6 /* NSError+MCO.mm in Sources */, @@ -2656,6 +2900,7 @@ C64BB22116E34DCB000DB34C /* MCIMAPSyncResult.cc in Sources */, C64BB22B16E5C0A4000DB34C /* MCIMAPCapabilityOperation.cc in Sources */, C64BB22E16E5C1EE000DB34C /* MCIndexSet.cc in Sources */, + 84D73764199BFFC7005124E5 /* MCONNTPSession.mm in Sources */, C64BB23516EDAA17000DB34C /* MCOAbstractMessage.mm in Sources */, C64BB23916EDAA3F000DB34C /* MCOAbstractMessagePart.mm in Sources */, C64BB23C16EDAAC7000DB34C /* MCOAbstractMultipart.mm in Sources */, @@ -2679,6 +2924,7 @@ C6F5B9EE16FEA3C400D9DABD /* MCOIMAPNamespaceItem.mm in Sources */, C6F5B9F116FEA3D700D9DABD /* MCOIMAPPart.mm in Sources */, C6F5B9F416FEAC6C00D9DABD /* MCOIndexSet.mm in Sources */, + 849189AB18C94986002063A3 /* MCNNTPGroupInfo.cc in Sources */, C6F5B9FE16FED18600D9DABD /* MCOAbstractMessageRendererCallback.mm in Sources */, C6CCC5C716FFE5190077A5FC /* MCORange.mm in Sources */, C63D316217C92D8300A4D993 /* MCOIMAPIdentity.mm in Sources */, @@ -2707,6 +2953,7 @@ C6A81BDA1706903E00882C15 /* MCOPOPFetchHeaderOperation.mm in Sources */, C608167B177635D2001F1018 /* MCIMAPDisconnectOperation.cc in Sources */, C6A81BDE1706904800882C15 /* MCOPOPFetchMessageOperation.mm in Sources */, + 84D73730199BF704005124E5 /* MCNNTPOperation.cc in Sources */, C6A81BE21706905600882C15 /* MCOPOPOperation.mm in Sources */, C6A81BE61706906D00882C15 /* MCOPOPFetchMessagesOperation.mm in Sources */, C6A81C001707CEE600882C15 /* MCOPOPMessageInfo.mm in Sources */, @@ -2715,10 +2962,12 @@ C6D6F954171E5CB8006F5B28 /* MCMD5.cc in Sources */, C6D6F956171E5CB8006F5B28 /* MCNull.cc in Sources */, C6D6F967171FCF9F006F5B28 /* MCJSONParser.cc in Sources */, + 84D73768199BFFFC005124E5 /* MCONNTPOperation.mm in Sources */, C668E2C71735C8D500A2BB47 /* MCObjectMac.mm in Sources */, C668E2CC1735CB8900A2BB47 /* MCAutoreleasePoolMac.mm in Sources */, C6CF62B9175324CE006398B9 /* MCOMailProvider.mm in Sources */, C6CF62BB175324CE006398B9 /* MCOMailProvidersManager.mm in Sources */, + 84D7378F199C02A8005124E5 /* MCONNTPDisconnectOperation.mm in Sources */, C6CF62BD175324CE006398B9 /* MCONetService.mm in Sources */, C6EFFBCC1833334900CFF656 /* MCOIMAPMultiDisconnectOperation.mm in Sources */, C6CF62C6175324F0006398B9 /* MCMailProvider.cc in Sources */, @@ -2732,6 +2981,7 @@ BD63713B177DFF080094121B /* MCLibetpan.cc in Sources */, DAACAD5117886807000B4517 /* MCHTMLRendererIMAPDataCallback.cc in Sources */, DA89896D178A47D200F6D90A /* MCOIMAPMessageRenderingOperation.mm in Sources */, + 84D73771199C007E005124E5 /* MCONNTPFetchArticleOperation.mm in Sources */, 4B3C1BDE17ABF309008BBF4C /* MCOIMAPQuotaOperation.mm in Sources */, 4B3C1BE117ABF4BC008BBF4C /* MCIMAPQuotaOperation.cc in Sources */, ); @@ -2760,6 +3010,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 84D7373E199BF83B005124E5 /* MCNNTPFetchArticleOperation.cc in Sources */, C6BA2B991705F4E6003F0E9E /* MCAbstractMessage.cc in Sources */, C6BA2B9A1705F4E6003F0E9E /* MCAbstractMessagePart.cc in Sources */, 84B639EE17F280F3003B5BA2 /* MCIMAPNoopOperation.cc in Sources */, @@ -2772,6 +3023,7 @@ C6E665B61796500B0063F2CF /* MCZip.cc in Sources */, 84B639E417F279BB003B5BA2 /* MCSMTPNoopOperation.cc in Sources */, C6BA2BA11705F4E6003F0E9E /* MCAssert.c in Sources */, + 84D73794199C0511005124E5 /* MCONNTPGroupInfo.mm in Sources */, C6BA2BA21705F4E6003F0E9E /* MCData.cc in Sources */, C6BA2BA31705F4E6003F0E9E /* MCHash.cc in Sources */, C6BA2BA41705F4E6003F0E9E /* MCHashMap.cc in Sources */, @@ -2788,6 +3040,7 @@ C6BA2BAE1705F4E6003F0E9E /* MCIMAPFolder.cc in Sources */, C6BA2BAF1705F4E6003F0E9E /* MCIMAPMessage.cc in Sources */, C6BA2BB01705F4E6003F0E9E /* MCIMAPMessagePart.cc in Sources */, + 84D73776199C00AB005124E5 /* MCONNTPFetchArticlesOperation.mm in Sources */, C6BA2BB11705F4E6003F0E9E /* MCIMAPMultipart.cc in Sources */, C6BA2BB21705F4E6003F0E9E /* MCIMAPNamespace.cc in Sources */, C6BA2BB31705F4E6003F0E9E /* MCIMAPNamespaceItem.cc in Sources */, @@ -2797,10 +3050,12 @@ C68B2AF817797389005E61EF /* MCConnectionLoggerUtils.cc in Sources */, C6BA2BB71705F4E6003F0E9E /* MCPOPMessageInfo.cc in Sources */, C6BA2BB81705F4E6003F0E9E /* MCPOPSession.cc in Sources */, + 84D7375D199BFDCA005124E5 /* MCNNTPListNewsgroupsOperation.cc in Sources */, C6BA2BB91705F4E6003F0E9E /* MCAttachment.cc in Sources */, C6BA2BBA1705F4E6003F0E9E /* MCMessageBuilder.cc in Sources */, C6BA2BBB1705F4E6003F0E9E /* MCMessageParser.cc in Sources */, C6BA2BBC1705F4E6003F0E9E /* MCMessagePart.cc in Sources */, + 84D7378C199C0260005124E5 /* MCONNTPListNewsgroupsOperation.mm in Sources */, C6BA2BBD1705F4E6003F0E9E /* MCMultipart.cc in Sources */, C6BA2BBE1705F4E6003F0E9E /* MCSMTPSession.cc in Sources */, 8416A9A217F2871D00B3C7DA /* MCOIMAPNoopOperation.mm in Sources */, @@ -2816,14 +3071,17 @@ C6BA2BC61705F4E6003F0E9E /* MCIMAPRenameFolderOperation.cc in Sources */, C6BA2BC71705F4E6003F0E9E /* MCIMAPDeleteFolderOperation.cc in Sources */, C63D315D17C9155C00A4D993 /* MCIMAPIdentity.cc in Sources */, + 84D73743199BF963005124E5 /* MCNNTPFetchArticlesOperation.cc in Sources */, C6BA2BC81705F4E6003F0E9E /* MCIMAPCreateFolderOperation.cc in Sources */, C6BA2BC91705F4E6003F0E9E /* MCIMAPSubscribeFolderOperation.cc in Sources */, + 84D7372D199BF66C005124E5 /* MCNNTPAsyncSession.cc in Sources */, C6BA2BCA1705F4E6003F0E9E /* MCIMAPAppendMessageOperation.cc in Sources */, C6BA2BCB1705F4E6003F0E9E /* MCIMAPCopyMessagesOperation.cc in Sources */, C6BA2BCC1705F4E6003F0E9E /* MCIMAPExpungeOperation.cc in Sources */, C69BA85C17DEFCCB00D601B7 /* NSIndexSet+MCO.m in Sources */, C6BA2BCD1705F4E6003F0E9E /* MCIMAPFetchMessagesOperation.cc in Sources */, C6BA2BCE1705F4E6003F0E9E /* MCIMAPFetchContentOperation.cc in Sources */, + 84D73747199BFA8C005124E5 /* MCNNTPCheckAccountOperation.cc in Sources */, C6BA2BCF1705F4E6003F0E9E /* MCIMAPStoreFlagsOperation.cc in Sources */, C6BA2BD01705F4E6003F0E9E /* MCIMAPStoreLabelsOperation.cc in Sources */, C643F493189A3D59007EA2F7 /* NSSet+MCO.mm in Sources */, @@ -2832,7 +3090,9 @@ C6BA2BD21705F4E6003F0E9E /* MCIMAPIdleOperation.cc in Sources */, C6E665BA1796500C0063F2CF /* mztools.c in Sources */, C6BA2BD31705F4E6003F0E9E /* MCIMAPFetchNamespaceOperation.cc in Sources */, + 84D73759199BFC8A005124E5 /* MCNNTPDisconnectOperation.cc in Sources */, 84B639E917F27EBD003B5BA2 /* MCPOPNoopOperation.cc in Sources */, + 849189A218C93FB7002063A3 /* MCNNTPSession.cc in Sources */, C6BA2BD41705F4E6003F0E9E /* MCIMAPIdentityOperation.cc in Sources */, C6BA2BD51705F4E6003F0E9E /* MCIMAPFolderInfoOperation.cc in Sources */, C6BA2BD61705F4E6003F0E9E /* MCIMAPAsyncConnection.cc in Sources */, @@ -2846,6 +3106,8 @@ C6BA2BDE1705F4E6003F0E9E /* NSData+MCO.mm in Sources */, C6BA2BDF1705F4E6003F0E9E /* NSString+MCO.mm in Sources */, C6BA2BE01705F4E6003F0E9E /* MCOObjectWrapper.mm in Sources */, + 84D73738199BF7F2005124E5 /* MCNNTPFetchHeaderOperation.cc in Sources */, + 84D7376E199C005A005124E5 /* MCONNTPFetchHeaderOperation.mm in Sources */, C6E665B81796500B0063F2CF /* ioapi.c in Sources */, C6BA2BE11705F4E6003F0E9E /* MCOIMAPSession.mm in Sources */, C6BA2BE21705F4E6003F0E9E /* NSError+MCO.mm in Sources */, @@ -2863,6 +3125,7 @@ C6BA2BED1705F4E6003F0E9E /* MCIMAPSyncResult.cc in Sources */, C6BA2BEE1705F4E6003F0E9E /* MCIMAPCapabilityOperation.cc in Sources */, C6BA2BEF1705F4E6003F0E9E /* MCIndexSet.cc in Sources */, + 84D73765199BFFC7005124E5 /* MCONNTPSession.mm in Sources */, C6BA2BF01705F4E6003F0E9E /* MCOAbstractMessage.mm in Sources */, C6BA2BF11705F4E6003F0E9E /* MCOAbstractMessagePart.mm in Sources */, C6BA2BF21705F4E6003F0E9E /* MCOAbstractMultipart.mm in Sources */, @@ -2886,6 +3149,7 @@ C6BA2C031705F4E6003F0E9E /* MCOIMAPNamespaceItem.mm in Sources */, C6BA2C041705F4E6003F0E9E /* MCOIMAPPart.mm in Sources */, C6BA2C051705F4E6003F0E9E /* MCOIndexSet.mm in Sources */, + 849189AC18C94986002063A3 /* MCNNTPGroupInfo.cc in Sources */, C6BA2C061705F4E6003F0E9E /* MCOAbstractMessageRendererCallback.mm in Sources */, C6BA2C071705F4E6003F0E9E /* MCORange.mm in Sources */, C63D316317C92D8300A4D993 /* MCOIMAPIdentity.mm in Sources */, @@ -2914,6 +3178,7 @@ C6A81BDB1706903E00882C15 /* MCOPOPFetchHeaderOperation.mm in Sources */, C608167C177635D2001F1018 /* MCIMAPDisconnectOperation.cc in Sources */, C6A81BDF1706904800882C15 /* MCOPOPFetchMessageOperation.mm in Sources */, + 84D73731199BF704005124E5 /* MCNNTPOperation.cc in Sources */, C6A81BE31706905600882C15 /* MCOPOPOperation.mm in Sources */, C6A81BE71706906D00882C15 /* MCOPOPFetchMessagesOperation.mm in Sources */, C6A81C011707CEE600882C15 /* MCOPOPMessageInfo.mm in Sources */, @@ -2922,10 +3187,12 @@ C6D6F955171E5CB8006F5B28 /* MCMD5.cc in Sources */, C6D6F957171E5CB8006F5B28 /* MCNull.cc in Sources */, C6D6F968171FCF9F006F5B28 /* MCJSONParser.cc in Sources */, + 84D73769199BFFFC005124E5 /* MCONNTPOperation.mm in Sources */, C668E2C81735C8D500A2BB47 /* MCObjectMac.mm in Sources */, C668E2CD1735CB8900A2BB47 /* MCAutoreleasePoolMac.mm in Sources */, C6CF62BA175324CE006398B9 /* MCOMailProvider.mm in Sources */, C6CF62BC175324CE006398B9 /* MCOMailProvidersManager.mm in Sources */, + 84D73790199C02A8005124E5 /* MCONNTPDisconnectOperation.mm in Sources */, C6CF62BE175324CE006398B9 /* MCONetService.mm in Sources */, C6EFFBCD1833334900CFF656 /* MCOIMAPMultiDisconnectOperation.mm in Sources */, C6CF62C7175324F0006398B9 /* MCMailProvider.cc in Sources */, @@ -2938,6 +3205,7 @@ DAD28C8C1783CFFC00F2BB8F /* MCHTMLBodyRendererTemplateCallback.cc in Sources */, DAACAD5217886807000B4517 /* MCHTMLRendererIMAPDataCallback.cc in Sources */, DA89896E178A47D200F6D90A /* MCOIMAPMessageRenderingOperation.mm in Sources */, + 84D73772199C007E005124E5 /* MCONNTPFetchArticleOperation.mm in Sources */, 4B3C1BE317ABFF91008BBF4C /* MCOIMAPQuotaOperation.mm in Sources */, 4B3C1BE517AC0176008BBF4C /* MCIMAPQuotaOperation.cc in Sources */, ); @@ -3074,8 +3342,6 @@ C64EA53C169E772200778456 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; - CLANG_CXX_LIBRARY = "libc++"; COMBINE_HIDPI_IMAGES = YES; EXECUTABLE_PREFIX = lib; PRODUCT_NAME = MailCore; @@ -3086,8 +3352,6 @@ C64EA53D169E772200778456 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; - CLANG_CXX_LIBRARY = "libc++"; COMBINE_HIDPI_IMAGES = YES; EXECUTABLE_PREFIX = lib; PRODUCT_NAME = MailCore; @@ -3114,8 +3378,6 @@ C6A81BAA1706840C00882C15 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libstdc++"; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; @@ -3150,8 +3412,6 @@ C6A81BAB1706840C00882C15 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libstdc++"; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; @@ -3188,8 +3448,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libstdc++"; DEAD_CODE_STRIPPING = NO; EXECUTABLE_PREFIX = lib; ONLY_ACTIVE_ARCH = NO; @@ -3203,8 +3461,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libstdc++"; DEAD_CODE_STRIPPING = NO; EXECUTABLE_PREFIX = lib; ONLY_ACTIVE_ARCH = NO; @@ -3217,8 +3473,6 @@ C6BD289E170BD71100A91AC1 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; - CLANG_CXX_LIBRARY = "libc++"; COMBINE_HIDPI_IMAGES = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -3250,8 +3504,6 @@ C6BD289F170BD71100A91AC1 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; - CLANG_CXX_LIBRARY = "libc++"; COMBINE_HIDPI_IMAGES = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; 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 491161bd..bb9f0ea1 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 @@ -471,7 +471,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; @@ -501,7 +501,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; @@ -525,7 +525,7 @@ AB9EAE29170368F000D750C7 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LIBRARY = "libstdc++"; + CLANG_CXX_LIBRARY = "libc++"; 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"; @@ -540,7 +540,7 @@ "-liconv", "-all_load", "-ltidy", - "-lstdc++", + "-lc++", "-lz", "-licucore", ); @@ -552,7 +552,7 @@ AB9EAE2A170368F000D750C7 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LIBRARY = "libstdc++"; + CLANG_CXX_LIBRARY = "libc++"; 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"; @@ -567,7 +567,7 @@ "-liconv", "-all_load", "-ltidy", - "-lstdc++", + "-lc++", "-lz", "-licucore", ); diff --git a/example/ios/iOS UI Test/iOS UI Test/MCTMsgViewController.mm b/example/ios/iOS UI Test/iOS UI Test/MCTMsgViewController.mm index ca3aecfc..ed41fd87 100755 --- a/example/ios/iOS UI Test/iOS UI Test/MCTMsgViewController.mm +++ b/example/ios/iOS UI Test/iOS UI Test/MCTMsgViewController.mm @@ -249,9 +249,9 @@ typedef void (^DownloadCallback)(NSError * error); return nil; info = [[NSMutableDictionary alloc] init]; - [info setObject:(id) kCFBooleanTrue forKey:(id) kCGImageSourceCreateThumbnailWithTransform]; - [info setObject:(id) kCFBooleanTrue forKey:(id) kCGImageSourceCreateThumbnailFromImageAlways]; - [info setObject:(id) [NSNumber numberWithFloat:(float) IMAGE_PREVIEW_WIDTH] forKey:(id) kCGImageSourceThumbnailMaxPixelSize]; + [info setObject:(id) kCFBooleanTrue forKey:(__bridge id) kCGImageSourceCreateThumbnailWithTransform]; + [info setObject:(id) kCFBooleanTrue forKey:(__bridge id) kCGImageSourceCreateThumbnailFromImageAlways]; + [info setObject:(id) [NSNumber numberWithFloat:(float) IMAGE_PREVIEW_WIDTH] forKey:(__bridge id) kCGImageSourceThumbnailMaxPixelSize]; thumbnail = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, (__bridge CFDictionaryRef) info); CGImageDestinationRef destination; diff --git a/resources/providers.json b/resources/providers.json index e38e1f3d..0fcf174a 100644 --- a/resources/providers.json +++ b/resources/providers.json @@ -1086,5 +1086,95 @@ "sentmail": "Отправленные", "trash": "Корзина" } + }, + "yandex": { + "servers": { + "imap": [ + { + "port": 993, + "hostname": "imap.yandex.ru", + "ssl": true + } + ], + "smtp": [ + { + "port": 465, + "hostname": "smtp.yandex.ru", + "ssl": true + } + ] + + }, + "domain-match": [ + "yandex\\.ru" + ], + "mailboxes": { + "drafts": "Черновики", + "spam": "Спам", + "sentmail": "Отправленные", + "trash": "Удалённые" + } + }, + "comcast": { + "servers": { + "pop": [{ + "port": 995, + "hostname": "mail.comcast.net", + "ssl": true + }, { + "port": 110, + "hostname": "mail.comcast.net", + "ssl": true + }], + "smtp": [{ + "port": 587, + "hostname": "smtp.comcast.net", + "starttls": true + }, { + "port": 465, + "hostname": "smtp.comcast.net", + "ssl": true + }] + }, + "mx-match": [ + "mx1\\.comcast\\.net", + "mx2\\.comcast\\.net" + ] + }, + "verizon": { + "servers": { + "pop": [{ + "port": 995, + "hostname": "pop.verizon.net", + "ssl": true + }], + "smtp": [{ + "port": 465, + "hostname": "smtp.verizon.net", + "ssl": true + }] + + }, + "mx-match": [ + "relay\\.verizon\\.net" + ] + }, + "rcn": { + "servers": { + "pop": [{ + "port": 110, + "hostname": "pop.rcn.com", + "ssl": true + }], + "smtp": [{ + "port": 25, + "hostname": "smtp.rcn.com", + "ssl": true + }] + + }, + "mx-match": [ + "mx\\.rcn\\.com" + ] } } diff --git a/scripts/build-mailcore2-ios.sh b/scripts/build-mailcore2-ios.sh index 77b2bf46..b6d3bfe7 100755 --- a/scripts/build-mailcore2-ios.sh +++ b/scripts/build-mailcore2-ios.sh @@ -2,16 +2,16 @@ if xcodebuild -showsdks|grep iphoneos6.1 >/dev/null ; then sdkversion=6.1 - devicearchs="armv7 armv7s" + devicearchs="armv7 armv7s" elif xcodebuild -showsdks|grep iphoneos7.0 >/dev/null ; then sdkversion=7.0 - devicearchs="armv7 armv7s arm64" + devicearchs="armv7 armv7s arm64" elif xcodebuild -showsdks|grep iphoneos7.1 >/dev/null ; then - sdkversion=7.1 - devicearchs="armv7 armv7s arm64" + sdkversion=7.1 + devicearchs="armv7 armv7s arm64" elif xcodebuild -showsdks|grep iphoneos8.0 >/dev/null ; then - sdkversion=8.0 - devicearchs="armv7 armv7s arm64" + sdkversion=8.0 + devicearchs="armv7 armv7s arm64" else echo SDK not found exit 1 diff --git a/scripts/prepare-ctemplate-ios.sh b/scripts/prepare-ctemplate-ios.sh index 3b6c0e0b..d23c10fd 100755 --- a/scripts/prepare-ctemplate-ios.sh +++ b/scripts/prepare-ctemplate-ios.sh @@ -49,7 +49,7 @@ else cd ctemplate fi version=`git rev-parse HEAD | cut -c1-10` -build_version="$version~1" +build_version="$version~2" if test -f "$resultdir/ctemplate-ios-$build_version.zip" ; then echo install from cache @@ -71,12 +71,12 @@ cp -R "$builddir/downloads/ctemplate" "$srcdir/ctemplate" echo building ctemplate cd "$srcdir/ctemplate" -TOOLCHAIN=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin +TOOLCHAIN=`xcode-select -p`/Toolchains/XcodeDefault.xctoolchain/usr/bin export CC=$TOOLCHAIN/clang export CXX=$TOOLCHAIN/clang++ sdk="iphoneos$sdkversion" -sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$sdkversion.sdk" +sysroot="`xcode-select -p`/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$sdkversion.sdk" ARCH=arm for MARCH in $MARCHS; do @@ -84,8 +84,8 @@ for MARCH in $MARCHS; do echo "$logdir/ctemplate-build.log" export CPPFLAGS="-arch ${MARCH} -isysroot $sysroot -miphoneos-version-min=$sdkversion" export CFLAGS="$CPPFLAGS" - export CXXFLAGS="$CFLAGS -stdlib=libstdc++ -std=gnu++11" - export LDFLAGS="-lstdc++ -stdlib=libstdc++" + export CXXFLAGS="$CFLAGS -stdlib=libc++" + export LDFLAGS="-lstdc++ -stdlib=libc++" ./configure --host=${ARCH} --disable-shared --disable-dependency-tracking >> "$logdir/ctemplate-build.log" make >> "$logdir/ctemplate-build.log" @@ -105,7 +105,7 @@ for MARCH in $MARCHS; do done sdk="iphonesimulator$sdkversion" -sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator$sdkversion.sdk" +sysroot="`xcode-select -p`/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator$sdkversion.sdk" ARCH=i386 MARCHS="i386 x86_64" @@ -115,8 +115,8 @@ for MARCH in $MARCHS; do echo "$logdir/ctemplate-build.log" export CPPFLAGS="-arch ${MARCH} -isysroot $sysroot -miphoneos-version-min=$sdkversion" export CFLAGS="$CPPFLAGS" - export CXXFLAGS="$CFLAGS -stdlib=libstdc++ -std=gnu++11" - export LDFLAGS="-lstdc++ -stdlib=libstdc++" + export CXXFLAGS="$CFLAGS -stdlib=libc++" + export LDFLAGS="-lstdc++ -stdlib=libc++" ./configure --host=${MARCH} --disable-shared --disable-dependency-tracking >> "$logdir/ctemplate-build.log" make >> "$logdir/ctemplate-build.log" diff --git a/scripts/prepare-icu4c-ios.sh b/scripts/prepare-icu4c-ios.sh index f214399b..31cb13d7 100755 --- a/scripts/prepare-icu4c-ios.sh +++ b/scripts/prepare-icu4c-ios.sh @@ -19,10 +19,10 @@ fi versionfolder='51.1' version='51_1' -build_version="$version~2" +build_version="$version~3" url="http://download.icu-project.org/files/icu4c/$versionfolder/icu4c-$version-src.tgz" package_filename="icu4c-$version-src.tgz" -sysrootpath="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk" +sysrootpath="`xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk" enable_icu_data=0 pushd `dirname $0` > /dev/null @@ -77,10 +77,10 @@ cd icu patch -p1 < "$scriptpath/icu4c-ios.patch" cd .. -TOOLCHAIN=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin +TOOLCHAIN=`xcode-select -p`/Toolchains/XcodeDefault.xctoolchain/usr/bin export CC=$TOOLCHAIN/clang export CXX=$TOOLCHAIN/clang++ -export SYSROOTPATH="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" +export SYSROOTPATH="`xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" export CPPFLAGS="-isysroot $SYSROOTPATH" export CFLAGS="$CPPFLAGS" export LDLAGS="-lc++ -isysroot $SYSROOTPATH" @@ -95,25 +95,30 @@ make # >> "$logdir/icu4c-build.log" make install "prefix=$tmpdir/crossbuild/icu4c-$MARCH" # >> "$logdir/icu4c-build.log" ARCH=arm -if xcodebuild -showsdks|grep iphoneos7.0 >/dev/null ; then +if xcodebuild -showsdks|grep iphoneos7.1 >/dev/null ; then + sdkversion=7.1 + MARCHS="armv7 armv7s arm64" +elif xcodebuild -showsdks|grep iphoneos7.0 >/dev/null ; then sdkversion=7.0 MARCHS="armv7 armv7s arm64" elif xcodebuild -showsdks|grep iphoneos6.1 >/dev/null ; then MARCHS="armv7 armv7s" +elif xcodebuild -showsdks|grep iphoneos8.0 >/dev/null ; then + MARCHS="armv7 armv7s arm64" else echo SDK not found exit 1 fi iphonesdk="iphoneos$sdkversion" -sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$sdkversion.sdk" +sysroot="`xcode-select -p`/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$sdkversion.sdk" cd "$srcdir/icu/source" for MARCH in $MARCHS; do export CPPFLAGS="-arch ${MARCH} -isysroot ${sysroot} -DUCONFIG_NO_FILE_IO=1 -miphoneos-version-min=$sdkversion" export CFLAGS="$CPPFLAGS" - export CXXFLAGS="$CFLAGS -stdlib=libstdc++ -std=gnu++11" - export LDFLAGS="-lstdc++ -stdlib=libstdc++ -isysroot ${sysroot}" + export CXXFLAGS="$CFLAGS -stdlib=libc++ -std=gnu++11" + export LDFLAGS="-lstdc++ -stdlib=libc++ -isysroot ${sysroot}" echo building $MARCH @@ -129,7 +134,7 @@ for MARCH in $MARCHS; do done sdk="iphonesimulator$sdkversion" -sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator$sdkversion.sdk" +sysroot="`xcode-select -p`/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator$sdkversion.sdk" ARCH=i386 MARCHS="x86_64 i386" @@ -138,8 +143,8 @@ cd "$srcdir/icu/source" for MARCH in $MARCHS; do export CPPFLAGS="-arch ${MARCH} -isysroot ${sysroot} -DUCONFIG_NO_FILE_IO=1 -miphoneos-version-min=$sdkversion" export CFLAGS="$CPPFLAGS" - export CXXFLAGS="$CFLAGS -stdlib=libstdc++ -std=gnu++11" - export LDFLAGS="-lstdc++ -stdlib=libstdc++" + export CXXFLAGS="$CFLAGS -stdlib=libc++ -std=gnu++11" + export LDFLAGS="-lstdc++ -stdlib=libc++" echo building $MARCH diff --git a/scripts/prepare-libetpan-ios.sh b/scripts/prepare-libetpan-ios.sh index 180e3721..e787fb95 100755 --- a/scripts/prepare-libetpan-ios.sh +++ b/scripts/prepare-libetpan-ios.sh @@ -18,7 +18,7 @@ else fi url="https://github.com/dinhviethoa/libetpan.git" -rev=01b3b3b83d2b8651c0279018d4e48061509494eb +rev=51ca6bfc3cb34dcba1ead473223379eef495e9c7 pushd `dirname $0` > /dev/null scriptpath=`pwd` diff --git a/scripts/prepare-libetpan-macos.sh b/scripts/prepare-libetpan-macos.sh index 37405416..1ce05d47 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=01b3b3b83d2b8651c0279018d4e48061509494eb +rev=51ca6bfc3cb34dcba1ead473223379eef495e9c7 pushd `dirname $0` > /dev/null scriptpath=`pwd` diff --git a/src/async/MCAsync.h b/src/async/MCAsync.h index 45284590..90b3e263 100644 --- a/src/async/MCAsync.h +++ b/src/async/MCAsync.h @@ -13,5 +13,6 @@ #include <MailCore/MCAsyncSMTP.h> #include <MailCore/MCAsyncIMAP.h> #include <MailCore/MCAsyncPOP.h> +#include <MailCore/MCAsyncNNTP.h> #endif diff --git a/src/async/imap/MCIMAPAsyncConnection.cc b/src/async/imap/MCIMAPAsyncConnection.cc index 2f685ca3..3a6508d6 100755 --- a/src/async/imap/MCIMAPAsyncConnection.cc +++ b/src/async/imap/MCIMAPAsyncConnection.cc @@ -249,295 +249,6 @@ IMAPIdentity * IMAPAsyncConnection::clientIdentity() return mClientIdentity; } -IMAPFolderInfoOperation * IMAPAsyncConnection::folderInfoOperation(String * folder) -{ - IMAPFolderInfoOperation * op = new IMAPFolderInfoOperation(); - op->setSession(this); - op->setFolder(folder); - op->autorelease(); - return op; -} - -IMAPFolderStatusOperation * IMAPAsyncConnection::folderStatusOperation(String * folder) -{ - IMAPFolderStatusOperation * op = new IMAPFolderStatusOperation(); - op->setSession(this); - op->setFolder(folder); - op->autorelease(); - return op; -} - -IMAPFetchFoldersOperation * IMAPAsyncConnection::fetchSubscribedFoldersOperation() -{ - IMAPFetchFoldersOperation * op = new IMAPFetchFoldersOperation(); - op->setSession(this); - op->setFetchSubscribedEnabled(true); - op->autorelease(); - return op; -} - -IMAPFetchFoldersOperation * IMAPAsyncConnection::fetchAllFoldersOperation() -{ - IMAPFetchFoldersOperation * op = new IMAPFetchFoldersOperation(); - op->setSession(this); - op->autorelease(); - return op; -} - -IMAPOperation * IMAPAsyncConnection::renameFolderOperation(String * folder, String * otherName) -{ - IMAPRenameFolderOperation * op = new IMAPRenameFolderOperation(); - op->setSession(this); - op->setFolder(folder); - op->setOtherName(otherName); - op->autorelease(); - return op; -} - -IMAPOperation * IMAPAsyncConnection::deleteFolderOperation(String * folder) -{ - IMAPDeleteFolderOperation * op = new IMAPDeleteFolderOperation(); - op->setSession(this); - op->setFolder(folder); - op->autorelease(); - return op; -} - -IMAPOperation * IMAPAsyncConnection::createFolderOperation(String * folder) -{ - IMAPCreateFolderOperation * op = new IMAPCreateFolderOperation(); - op->setSession(this); - op->setFolder(folder); - op->autorelease(); - return op; -} - -IMAPOperation * IMAPAsyncConnection::subscribeFolderOperation(String * folder) -{ - IMAPSubscribeFolderOperation * op = new IMAPSubscribeFolderOperation(); - op->setSession(this); - op->setFolder(folder); - op->autorelease(); - return op; -} - -IMAPOperation * IMAPAsyncConnection::unsubscribeFolderOperation(String * folder) -{ - IMAPSubscribeFolderOperation * op = new IMAPSubscribeFolderOperation(); - op->setSession(this); - op->setUnsubscribeEnabled(true); - op->setFolder(folder); - op->autorelease(); - return op; -} - -IMAPAppendMessageOperation * IMAPAsyncConnection::appendMessageOperation(String * folder, Data * messageData, MessageFlag flags, Array * customFlags) -{ - IMAPAppendMessageOperation * op = new IMAPAppendMessageOperation(); - op->setSession(this); - op->setFolder(folder); - op->setMessageData(messageData); - op->setFlags(flags); - op->setCustomFlags(customFlags); - op->autorelease(); - return op; -} - -IMAPCopyMessagesOperation * IMAPAsyncConnection::copyMessagesOperation(String * folder, IndexSet * uids, String * destFolder) -{ - IMAPCopyMessagesOperation * op = new IMAPCopyMessagesOperation(); - op->setSession(this); - op->setFolder(folder); - op->setUids(uids); - op->setDestFolder(destFolder); - op->autorelease(); - return op; -} - -IMAPOperation * IMAPAsyncConnection::expungeOperation(String * folder) -{ - IMAPExpungeOperation * op = new IMAPExpungeOperation(); - op->setSession(this); - op->setFolder(folder); - op->autorelease(); - return op; -} - -IMAPFetchMessagesOperation * IMAPAsyncConnection::fetchMessagesByUIDOperation(String * folder, IMAPMessagesRequestKind requestKind, - IndexSet * uids) -{ - IMAPFetchMessagesOperation * op = new IMAPFetchMessagesOperation(); - op->setSession(this); - op->setFolder(folder); - op->setKind(requestKind); - op->setFetchByUidEnabled(true); - op->setIndexes(uids); - op->autorelease(); - return op; -} - -IMAPFetchMessagesOperation * IMAPAsyncConnection::fetchMessagesByNumberOperation(String * folder, IMAPMessagesRequestKind requestKind, - IndexSet * numbers) -{ - IMAPFetchMessagesOperation * op = new IMAPFetchMessagesOperation(); - op->setSession(this); - op->setFolder(folder); - op->setKind(requestKind); - op->setIndexes(numbers); - op->autorelease(); - return op; -} - -IMAPFetchMessagesOperation * IMAPAsyncConnection::syncMessagesByUID(String * folder, IMAPMessagesRequestKind requestKind, - IndexSet * uids, uint64_t modSeq) -{ - IMAPFetchMessagesOperation * op = new IMAPFetchMessagesOperation(); - op->setSession(this); - op->setFolder(folder); - op->setKind(requestKind); - op->setFetchByUidEnabled(true); - op->setIndexes(uids); - op->setModSequenceValue(modSeq); - op->autorelease(); - return op; -} - -IMAPFetchContentOperation * IMAPAsyncConnection::fetchMessageByUIDOperation(String * folder, uint32_t uid) -{ - IMAPFetchContentOperation * op = new IMAPFetchContentOperation(); - op->setSession(this); - op->setFolder(folder); - op->setUid(uid); - op->autorelease(); - return op; -} - -IMAPFetchContentOperation * IMAPAsyncConnection::fetchMessageAttachmentByUIDOperation(String * folder, uint32_t uid, String * partID, - Encoding encoding) -{ - IMAPFetchContentOperation * op = new IMAPFetchContentOperation(); - op->setSession(this); - op->setFolder(folder); - op->setUid(uid); - op->setPartID(partID); - op->setEncoding(encoding); - op->autorelease(); - return op; -} - -IMAPOperation * IMAPAsyncConnection::storeFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags) -{ - IMAPStoreFlagsOperation * op = new IMAPStoreFlagsOperation(); - op->setSession(this); - op->setFolder(folder); - op->setUids(uids); - op->setKind(kind); - op->setFlags(flags); - op->setCustomFlags(customFlags); - op->autorelease(); - return op; -} - -IMAPOperation * IMAPAsyncConnection::storeLabelsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, Array * labels) -{ - IMAPStoreLabelsOperation * op = new IMAPStoreLabelsOperation(); - op->setSession(this); - op->setFolder(folder); - op->setUids(uids); - op->setKind(kind); - op->setLabels(labels); - op->autorelease(); - return op; -} - -IMAPSearchOperation * IMAPAsyncConnection::searchOperation(String * folder, IMAPSearchKind kind, String * searchString) -{ - IMAPSearchOperation * op = new IMAPSearchOperation(); - op->setSession(this); - op->setFolder(folder); - op->setSearchKind(kind); - op->setSearchString(searchString); - op->autorelease(); - return op; -} - -IMAPSearchOperation * IMAPAsyncConnection::searchOperation(String * folder, IMAPSearchExpression * expression) -{ - IMAPSearchOperation * op = new IMAPSearchOperation(); - op->setSession(this); - op->setFolder(folder); - op->setSearchExpression(expression); - op->autorelease(); - return op; -} - -IMAPIdleOperation * IMAPAsyncConnection::idleOperation(String * folder, uint32_t lastKnownUID) -{ - IMAPIdleOperation * op = new IMAPIdleOperation(); - op->setSession(this); - op->setFolder(folder); - op->setLastKnownUID(lastKnownUID); - op->autorelease(); - return op; -} - -IMAPFetchNamespaceOperation * IMAPAsyncConnection::fetchNamespaceOperation() -{ - IMAPFetchNamespaceOperation * op = new IMAPFetchNamespaceOperation(); - op->setSession(this); - op->autorelease(); - return op; -} - -IMAPIdentityOperation * IMAPAsyncConnection::identityOperation(IMAPIdentity * identity) -{ - IMAPIdentityOperation * op = new IMAPIdentityOperation(); - op->setSession(this); - op->setClientIdentity(identity); - op->autorelease(); - return op; -} - -IMAPOperation * IMAPAsyncConnection::connectOperation() -{ - IMAPConnectOperation * op = new IMAPConnectOperation(); - op->setSession(this); - op->autorelease(); - return op; -} - -IMAPOperation * IMAPAsyncConnection::checkAccountOperation() -{ - IMAPCheckAccountOperation * op = new IMAPCheckAccountOperation(); - op->setSession(this); - op->autorelease(); - return op; -} - -IMAPOperation * IMAPAsyncConnection::noopOperation() -{ - IMAPNoopOperation * op = new IMAPNoopOperation(); - op->setSession(this); - op->autorelease(); - return op; -} - -IMAPCapabilityOperation * IMAPAsyncConnection::capabilityOperation() -{ - IMAPCapabilityOperation * op = new IMAPCapabilityOperation(); - op->setSession(this); - op->autorelease(); - return op; -} - -IMAPQuotaOperation * IMAPAsyncConnection::quotaOperation() -{ - IMAPQuotaOperation * op = new IMAPQuotaOperation(); - op->setSession(this); - op->autorelease(); - return op; -} - IMAPOperation * IMAPAsyncConnection::disconnectOperation() { IMAPDisconnectOperation * op = new IMAPDisconnectOperation(); @@ -679,46 +390,6 @@ void IMAPAsyncConnection::logConnection(ConnectionLogType logType, Data * buffer pthread_mutex_unlock(&mConnectionLoggerLock); } -IMAPMessageRenderingOperation * IMAPAsyncConnection::renderingOperation(IMAPMessage * message, - String * folder, - IMAPMessageRenderingType type) -{ - IMAPMessageRenderingOperation * op = new IMAPMessageRenderingOperation(); - op->setSession(this); - op->setMessage(message); - op->setFolder(folder); - op->setRenderingType(type); - op->autorelease(); - return op; -} - -IMAPMessageRenderingOperation * IMAPAsyncConnection::htmlRenderingOperation(IMAPMessage * message, - String * folder) -{ - return renderingOperation(message, folder, IMAPMessageRenderingTypeHTML); -} - -IMAPMessageRenderingOperation * IMAPAsyncConnection::htmlBodyRenderingOperation(IMAPMessage * message, - String * folder) -{ - return renderingOperation(message, folder, IMAPMessageRenderingTypeHTMLBody); -} - -IMAPMessageRenderingOperation * IMAPAsyncConnection::plainTextRenderingOperation(IMAPMessage * message, - String * folder) -{ - return renderingOperation(message, folder, IMAPMessageRenderingTypePlainText); -} - -IMAPMessageRenderingOperation * IMAPAsyncConnection::plainTextBodyRenderingOperation(IMAPMessage * message, - String * folder, - bool stripWhitespace) -{ - return renderingOperation(message, folder, - stripWhitespace ? IMAPMessageRenderingTypePlainTextBodyAndStripWhitespace : - IMAPMessageRenderingTypePlainTextBody); -} - void IMAPAsyncConnection::setAutomaticConfigurationEnabled(bool enabled) { mAutomaticConfigurationEnabled = enabled; diff --git a/src/async/imap/MCIMAPAsyncConnection.h b/src/async/imap/MCIMAPAsyncConnection.h index 6af22b50..50d1409a 100755 --- a/src/async/imap/MCIMAPAsyncConnection.h +++ b/src/async/imap/MCIMAPAsyncConnection.h @@ -86,63 +86,8 @@ namespace mailcore { virtual dispatch_queue_t dispatchQueue(); #endif - virtual IMAPFolderInfoOperation * folderInfoOperation(String * folder); - virtual IMAPFolderStatusOperation * folderStatusOperation(String * folder); - - virtual IMAPFetchFoldersOperation * fetchSubscribedFoldersOperation(); - virtual IMAPFetchFoldersOperation * fetchAllFoldersOperation(); - - virtual IMAPOperation * renameFolderOperation(String * folder, String * otherName); - virtual IMAPOperation * deleteFolderOperation(String * folder); - virtual IMAPOperation * createFolderOperation(String * folder); - - virtual IMAPOperation * subscribeFolderOperation(String * folder); - virtual IMAPOperation * unsubscribeFolderOperation(String * folder); - - virtual IMAPAppendMessageOperation * appendMessageOperation(String * folder, Data * messageData, MessageFlag flags, Array * customFlags); - - virtual IMAPCopyMessagesOperation * copyMessagesOperation(String * folder, IndexSet * uids, String * destFolder); - - virtual IMAPOperation * expungeOperation(String * folder); - - virtual IMAPFetchMessagesOperation * fetchMessagesByUIDOperation(String * folder, IMAPMessagesRequestKind requestKind, - IndexSet * uids); - virtual IMAPFetchMessagesOperation * fetchMessagesByNumberOperation(String * folder, IMAPMessagesRequestKind requestKind, - IndexSet * numbers); - virtual IMAPFetchMessagesOperation * syncMessagesByUID(String * folder, IMAPMessagesRequestKind requestKind, - IndexSet * uids, uint64_t modSeq); - - virtual IMAPFetchContentOperation * fetchMessageByUIDOperation(String * folder, uint32_t uid); - virtual IMAPFetchContentOperation * fetchMessageAttachmentByUIDOperation(String * folder, uint32_t uid, String * partID, - Encoding encoding); - - virtual IMAPOperation * storeFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags); - virtual IMAPOperation * storeLabelsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, Array * labels); - - virtual IMAPSearchOperation * searchOperation(String * folder, IMAPSearchKind kind, String * searchString); - virtual IMAPSearchOperation * searchOperation(String * folder, IMAPSearchExpression * expression); - - virtual IMAPIdleOperation * idleOperation(String * folder, uint32_t lastKnownUID); - - virtual IMAPFetchNamespaceOperation * fetchNamespaceOperation(); - - virtual IMAPIdentityOperation * identityOperation(IMAPIdentity * identity); - - virtual IMAPOperation * connectOperation(); - virtual IMAPOperation * checkAccountOperation(); virtual IMAPOperation * disconnectOperation(); - - virtual IMAPOperation * noopOperation(); - - 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, bool stripWhitespace); - - + private: IMAPSession * mSession; OperationQueue * mQueue; @@ -159,10 +104,7 @@ namespace mailcore { bool mScheduledAutomaticDisconnect; virtual void tryAutomaticDisconnectAfterDelay(void * context); - virtual IMAPMessageRenderingOperation * renderingOperation(IMAPMessage * message, - String * folder, - IMAPMessageRenderingType type); - + public: // private virtual void runOperation(IMAPOperation * operation); virtual IMAPSession * session(); diff --git a/src/async/imap/MCIMAPAsyncSession.cc b/src/async/imap/MCIMAPAsyncSession.cc index 1f1808df..68625746 100755 --- a/src/async/imap/MCIMAPAsyncSession.cc +++ b/src/async/imap/MCIMAPAsyncSession.cc @@ -16,6 +16,33 @@ #include "MCIMAPIdentity.h" #include "MCIMAPMultiDisconnectOperation.h" +#include "MCIMAPFolderInfoOperation.h" +#include "MCIMAPFolderStatusOperation.h" +#include "MCIMAPFetchFoldersOperation.h" +#include "MCIMAPRenameFolderOperation.h" +#include "MCIMAPDeleteFolderOperation.h" +#include "MCIMAPCreateFolderOperation.h" +#include "MCIMAPSubscribeFolderOperation.h" +#include "MCIMAPExpungeOperation.h" +#include "MCIMAPAppendMessageOperation.h" +#include "MCIMAPCopyMessagesOperation.h" +#include "MCIMAPFetchMessagesOperation.h" +#include "MCIMAPFetchContentOperation.h" +#include "MCIMAPFetchContentOperation.h" +#include "MCIMAPStoreFlagsOperation.h" +#include "MCIMAPStoreLabelsOperation.h" +#include "MCIMAPSearchOperation.h" +#include "MCIMAPConnectOperation.h" +#include "MCIMAPCheckAccountOperation.h" +#include "MCIMAPFetchNamespaceOperation.h" +#include "MCIMAPIdleOperation.h" +#include "MCIMAPIdentityOperation.h" +#include "MCIMAPCapabilityOperation.h" +#include "MCIMAPQuotaOperation.h" +#include "MCIMAPDisconnectOperation.h" +#include "MCIMAPNoopOperation.h" +#include "MCIMAPMessageRenderingOperation.h" + #define DEFAULT_MAX_CONNECTIONS 3 using namespace mailcore; @@ -321,180 +348,293 @@ IMAPAsyncConnection * IMAPAsyncSession::matchingSessionForFolder(String * folder IMAPFolderInfoOperation * IMAPAsyncSession::folderInfoOperation(String * folder) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->folderInfoOperation(folder); + IMAPFolderInfoOperation * op = new IMAPFolderInfoOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->autorelease(); + return op; } IMAPFolderStatusOperation * IMAPAsyncSession::folderStatusOperation(String * folder) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->folderStatusOperation(folder); + IMAPFolderStatusOperation * op = new IMAPFolderStatusOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->autorelease(); + return op; } IMAPFetchFoldersOperation * IMAPAsyncSession::fetchSubscribedFoldersOperation() { - IMAPAsyncConnection * session = sessionForFolder(NULL); - return session->fetchSubscribedFoldersOperation(); + IMAPFetchFoldersOperation * op = new IMAPFetchFoldersOperation(); + op->setMainSession(this); + op->setFetchSubscribedEnabled(true); + op->autorelease(); + return op; } IMAPFetchFoldersOperation * IMAPAsyncSession::fetchAllFoldersOperation() { - IMAPAsyncConnection * session = sessionForFolder(NULL); - return session->fetchAllFoldersOperation(); + IMAPFetchFoldersOperation * op = new IMAPFetchFoldersOperation(); + op->setMainSession(this); + op->autorelease(); + return op; } IMAPOperation * IMAPAsyncSession::renameFolderOperation(String * folder, String * otherName) { - IMAPAsyncConnection * session = sessionForFolder(NULL); - return session->renameFolderOperation(folder, otherName); + IMAPRenameFolderOperation * op = new IMAPRenameFolderOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setOtherName(otherName); + op->autorelease(); + return op; } IMAPOperation * IMAPAsyncSession::deleteFolderOperation(String * folder) { - IMAPAsyncConnection * session = sessionForFolder(NULL); - return session->deleteFolderOperation(folder); + IMAPDeleteFolderOperation * op = new IMAPDeleteFolderOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->autorelease(); + return op; } IMAPOperation * IMAPAsyncSession::createFolderOperation(String * folder) { - IMAPAsyncConnection * session = sessionForFolder(NULL); - return session->createFolderOperation(folder); + IMAPCreateFolderOperation * op = new IMAPCreateFolderOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->autorelease(); + return op; } IMAPOperation * IMAPAsyncSession::subscribeFolderOperation(String * folder) { - IMAPAsyncConnection * session = sessionForFolder(NULL); - return session->subscribeFolderOperation(folder); + IMAPSubscribeFolderOperation * op = new IMAPSubscribeFolderOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->autorelease(); + return op; } IMAPOperation * IMAPAsyncSession::unsubscribeFolderOperation(String * folder) { - IMAPAsyncConnection * session = sessionForFolder(NULL); - return session->unsubscribeFolderOperation(folder); + IMAPSubscribeFolderOperation * op = new IMAPSubscribeFolderOperation(); + op->setMainSession(this); + op->setUnsubscribeEnabled(true); + op->setFolder(folder); + op->autorelease(); + return op; } IMAPAppendMessageOperation * IMAPAsyncSession::appendMessageOperation(String * folder, Data * messageData, MessageFlag flags, Array * customFlags) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->appendMessageOperation(folder, messageData, flags, customFlags); + IMAPAppendMessageOperation * op = new IMAPAppendMessageOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setMessageData(messageData); + op->setFlags(flags); + op->setCustomFlags(customFlags); + op->autorelease(); + return op; } IMAPCopyMessagesOperation * IMAPAsyncSession::copyMessagesOperation(String * folder, IndexSet * uids, String * destFolder) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->copyMessagesOperation(folder, uids, destFolder); + IMAPCopyMessagesOperation * op = new IMAPCopyMessagesOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setUids(uids); + op->setDestFolder(destFolder); + op->autorelease(); + return op; } IMAPOperation * IMAPAsyncSession::expungeOperation(String * folder) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->expungeOperation(folder); + IMAPExpungeOperation * op = new IMAPExpungeOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->autorelease(); + return op; } IMAPFetchMessagesOperation * IMAPAsyncSession::fetchMessagesByUIDOperation(String * folder, IMAPMessagesRequestKind requestKind, IndexSet * uids) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->fetchMessagesByUIDOperation(folder, requestKind, uids); + IMAPFetchMessagesOperation * op = new IMAPFetchMessagesOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setKind(requestKind); + op->setFetchByUidEnabled(true); + op->setIndexes(uids); + op->autorelease(); + return op; } IMAPFetchMessagesOperation * IMAPAsyncSession::fetchMessagesByNumberOperation(String * folder, IMAPMessagesRequestKind requestKind, IndexSet * numbers) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->fetchMessagesByNumberOperation(folder, requestKind, numbers); + IMAPFetchMessagesOperation * op = new IMAPFetchMessagesOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setKind(requestKind); + op->setIndexes(numbers); + op->autorelease(); + return op; } IMAPFetchMessagesOperation * IMAPAsyncSession::syncMessagesByUID(String * folder, IMAPMessagesRequestKind requestKind, IndexSet * uids, uint64_t modSeq) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->syncMessagesByUID(folder, requestKind, uids, modSeq); + IMAPFetchMessagesOperation * op = new IMAPFetchMessagesOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setKind(requestKind); + op->setFetchByUidEnabled(true); + op->setIndexes(uids); + op->setModSequenceValue(modSeq); + op->autorelease(); + return op; } IMAPFetchContentOperation * IMAPAsyncSession::fetchMessageByUIDOperation(String * folder, uint32_t uid, bool urgent) { - IMAPAsyncConnection * session = sessionForFolder(folder, urgent); - return session->fetchMessageByUIDOperation(folder, uid); + IMAPFetchContentOperation * op = new IMAPFetchContentOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setUid(uid); + op->setUrgent(urgent); + op->autorelease(); + return op; } IMAPFetchContentOperation * IMAPAsyncSession::fetchMessageAttachmentByUIDOperation(String * folder, uint32_t uid, String * partID, Encoding encoding, bool urgent) { - IMAPAsyncConnection * session = sessionForFolder(folder, urgent); - return session->fetchMessageAttachmentByUIDOperation(folder, uid, partID, encoding); + IMAPFetchContentOperation * op = new IMAPFetchContentOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setUid(uid); + op->setPartID(partID); + op->setEncoding(encoding); + op->setUrgent(urgent); + op->autorelease(); + return op; } IMAPOperation * IMAPAsyncSession::storeFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->storeFlagsOperation(folder, uids, kind, flags, customFlags); + IMAPStoreFlagsOperation * op = new IMAPStoreFlagsOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setUids(uids); + op->setKind(kind); + op->setFlags(flags); + op->setCustomFlags(customFlags); + op->autorelease(); + return op; } IMAPOperation * IMAPAsyncSession::storeLabelsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, Array * labels) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->storeLabelsOperation(folder, uids, kind, labels); + IMAPStoreLabelsOperation * op = new IMAPStoreLabelsOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setUids(uids); + op->setKind(kind); + op->setLabels(labels); + op->autorelease(); + return op; } IMAPSearchOperation * IMAPAsyncSession::searchOperation(String * folder, IMAPSearchKind kind, String * searchString) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->searchOperation(folder, kind, searchString); + IMAPSearchOperation * op = new IMAPSearchOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setSearchKind(kind); + op->setSearchString(searchString); + op->autorelease(); + return op; } IMAPSearchOperation * IMAPAsyncSession::searchOperation(String * folder, IMAPSearchExpression * expression) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->searchOperation(folder, expression); + IMAPSearchOperation * op = new IMAPSearchOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setSearchExpression(expression); + op->autorelease(); + return op; } IMAPIdleOperation * IMAPAsyncSession::idleOperation(String * folder, uint32_t lastKnownUID) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->idleOperation(folder, lastKnownUID); + IMAPIdleOperation * op = new IMAPIdleOperation(); + op->setMainSession(this); + op->setFolder(folder); + op->setLastKnownUID(lastKnownUID); + op->autorelease(); + return op; } IMAPFetchNamespaceOperation * IMAPAsyncSession::fetchNamespaceOperation() { - IMAPAsyncConnection * session = sessionForFolder(NULL); - return session->fetchNamespaceOperation(); + IMAPFetchNamespaceOperation * op = new IMAPFetchNamespaceOperation(); + op->setMainSession(this); + op->autorelease(); + return op; } IMAPIdentityOperation * IMAPAsyncSession::identityOperation(IMAPIdentity * identity) { - IMAPAsyncConnection * session = sessionForFolder(NULL); - return session->identityOperation(identity); + IMAPIdentityOperation * op = new IMAPIdentityOperation(); + op->setMainSession(this); + op->setClientIdentity(identity); + op->autorelease(); + return op; } IMAPOperation * IMAPAsyncSession::connectOperation() { - IMAPAsyncConnection * session = sessionForFolder(NULL); - return session->connectOperation(); + IMAPConnectOperation * op = new IMAPConnectOperation(); + op->setMainSession(this); + op->autorelease(); + return op; } IMAPOperation * IMAPAsyncSession::checkAccountOperation() { - IMAPAsyncConnection * session = sessionForFolder(NULL); - return session->checkAccountOperation(); + IMAPCheckAccountOperation * op = new IMAPCheckAccountOperation(); + op->setMainSession(this); + op->autorelease(); + return op; } IMAPCapabilityOperation * IMAPAsyncSession::capabilityOperation() { - IMAPAsyncConnection * session = sessionForFolder(NULL); - return session->capabilityOperation(); + IMAPCapabilityOperation * op = new IMAPCapabilityOperation(); + op->setMainSession(this); + op->autorelease(); + return op; } IMAPQuotaOperation * IMAPAsyncSession::quotaOperation() { - IMAPAsyncConnection * session = sessionForFolder(NULL); - return session->quotaOperation(); + IMAPQuotaOperation * op = new IMAPQuotaOperation(); + op->setMainSession(this); + op->autorelease(); + return op; } IMAPOperation * IMAPAsyncSession::noopOperation() { - IMAPAsyncConnection * session = sessionForFolder(NULL); - return session->noopOperation(); + IMAPNoopOperation * op = new IMAPNoopOperation(); + op->setMainSession(this); + op->autorelease(); + return op; } IMAPOperation * IMAPAsyncSession::disconnectOperation() @@ -522,33 +662,44 @@ ConnectionLogger * IMAPAsyncSession::connectionLogger() return mConnectionLogger; } +IMAPMessageRenderingOperation * IMAPAsyncSession::renderingOperation(IMAPMessage * message, + String * folder, + IMAPMessageRenderingType type) +{ + IMAPMessageRenderingOperation * op = new IMAPMessageRenderingOperation(); + op->setMainSession(this); + op->setMessage(message); + op->setFolder(folder); + op->setRenderingType(type); + op->autorelease(); + return op; +} + IMAPMessageRenderingOperation * IMAPAsyncSession::htmlRenderingOperation(IMAPMessage * message, String * folder) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->htmlRenderingOperation(message, folder); + return renderingOperation(message, folder, IMAPMessageRenderingTypeHTML); } IMAPMessageRenderingOperation * IMAPAsyncSession::htmlBodyRenderingOperation(IMAPMessage * message, String * folder) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->htmlBodyRenderingOperation(message, folder); + return renderingOperation(message, folder, IMAPMessageRenderingTypeHTMLBody); } IMAPMessageRenderingOperation * IMAPAsyncSession::plainTextRenderingOperation(IMAPMessage * message, String * folder) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->plainTextRenderingOperation(message, folder); + return renderingOperation(message, folder, IMAPMessageRenderingTypePlainText); } IMAPMessageRenderingOperation * IMAPAsyncSession::plainTextBodyRenderingOperation(IMAPMessage * message, String * folder, bool stripWhitespace) { - IMAPAsyncConnection * session = sessionForFolder(folder); - return session->plainTextBodyRenderingOperation(message, folder, stripWhitespace); + return renderingOperation(message, folder, + stripWhitespace ? IMAPMessageRenderingTypePlainTextBodyAndStripWhitespace : + IMAPMessageRenderingTypePlainTextBody); } void IMAPAsyncSession::automaticConfigurationDone(IMAPSession * session) diff --git a/src/async/imap/MCIMAPAsyncSession.h b/src/async/imap/MCIMAPAsyncSession.h index b00af1d3..333783b2 100755 --- a/src/async/imap/MCIMAPAsyncSession.h +++ b/src/async/imap/MCIMAPAsyncSession.h @@ -162,6 +162,7 @@ namespace mailcore { public: // private virtual void automaticConfigurationDone(IMAPSession * session); virtual void operationRunningStateChanged(); + virtual IMAPAsyncConnection * sessionForFolder(String * folder, bool urgent = false); private: Array * mSessions; @@ -190,10 +191,12 @@ namespace mailcore { #endif String * mGmailUserDisplayName; - virtual IMAPAsyncConnection * sessionForFolder(String * folder, bool urgent = false); virtual IMAPAsyncConnection * session(); virtual IMAPAsyncConnection * matchingSessionForFolder(String * folder); virtual IMAPAsyncConnection * availableSession(); + virtual IMAPMessageRenderingOperation * renderingOperation(IMAPMessage * message, + String * folder, + IMAPMessageRenderingType type); }; } diff --git a/src/async/imap/MCIMAPFolderInfoOperation.cc b/src/async/imap/MCIMAPFolderInfoOperation.cc index 8ca500f3..0ea0d005 100644 --- a/src/async/imap/MCIMAPFolderInfoOperation.cc +++ b/src/async/imap/MCIMAPFolderInfoOperation.cc @@ -20,6 +20,7 @@ IMAPFolderInfoOperation::IMAPFolderInfoOperation() mMessageCount = 0; mModSequenceValue = 0; mFirstUnseenUid = 0; + mAllowsNewPermanentFlags = false; } IMAPFolderInfoOperation::~IMAPFolderInfoOperation() @@ -51,6 +52,11 @@ uint32_t IMAPFolderInfoOperation::firstUnseenUid() return mFirstUnseenUid; } +bool IMAPFolderInfoOperation::allowsNewPermanentFlags() +{ + return mAllowsNewPermanentFlags; +} + void IMAPFolderInfoOperation::main() { ErrorCode error; @@ -73,7 +79,8 @@ void IMAPFolderInfoOperation::main() mModSequenceValue = session()->session()->modSequenceValue(); mMessageCount = session()->session()->lastFolderMessageCount(); mFirstUnseenUid = session()->session()->firstUnseenUid(); - + mAllowsNewPermanentFlags = session()->session()->allowsNewPermanentFlags(); + setError(error); } diff --git a/src/async/imap/MCIMAPFolderInfoOperation.h b/src/async/imap/MCIMAPFolderInfoOperation.h index 9b0027a4..b53be2cb 100644 --- a/src/async/imap/MCIMAPFolderInfoOperation.h +++ b/src/async/imap/MCIMAPFolderInfoOperation.h @@ -26,6 +26,7 @@ namespace mailcore { virtual uint64_t modSequenceValue(); virtual int messageCount(); virtual uint32_t firstUnseenUid(); + virtual bool allowsNewPermanentFlags(); public: // subclass behavior virtual void main(); @@ -37,7 +38,8 @@ namespace mailcore { uint64_t mModSequenceValue; int mMessageCount; uint32_t mFirstUnseenUid; - + bool mAllowsNewPermanentFlags; + }; } diff --git a/src/async/imap/MCIMAPOperation.cc b/src/async/imap/MCIMAPOperation.cc index e4b3529b..9ab30ab0 100644 --- a/src/async/imap/MCIMAPOperation.cc +++ b/src/async/imap/MCIMAPOperation.cc @@ -20,13 +20,16 @@ using namespace mailcore; IMAPOperation::IMAPOperation() { mSession = NULL; + mMainSession = NULL; mImapCallback = NULL; mError = ErrorNone; mFolder = NULL; + mUrgent = false; } IMAPOperation::~IMAPOperation() { + MC_SAFE_RELEASE(mMainSession); MC_SAFE_RELEASE(mFolder); MC_SAFE_RELEASE(mSession); } @@ -51,6 +54,16 @@ IMAPAsyncConnection * IMAPOperation::session() return mSession; } +void IMAPOperation::setMainSession(IMAPAsyncSession * session) +{ + MC_SAFE_REPLACE_RETAIN(IMAPAsyncSession, mMainSession, session); +} + +IMAPAsyncSession * IMAPOperation::mainSession() +{ + return mMainSession; +} + void IMAPOperation::setFolder(String * folder) { MC_SAFE_REPLACE_COPY(String, mFolder, folder); @@ -61,6 +74,16 @@ String * IMAPOperation::folder() return mFolder; } +void IMAPOperation::setUrgent(bool urgent) +{ + mUrgent = urgent; +} + +bool IMAPOperation::isUrgent() +{ + return mUrgent; +} + void IMAPOperation::setImapCallback(IMAPOperationCallback * callback) { mImapCallback = callback; @@ -83,6 +106,10 @@ ErrorCode IMAPOperation::error() void IMAPOperation::start() { + if (session() == NULL) { + IMAPAsyncConnection * connection = mMainSession->sessionForFolder(mFolder, mUrgent); + setSession(connection); + } mSession->runOperation(this); } diff --git a/src/async/imap/MCIMAPOperation.h b/src/async/imap/MCIMAPOperation.h index 7455fdeb..ed5bc560 100644 --- a/src/async/imap/MCIMAPOperation.h +++ b/src/async/imap/MCIMAPOperation.h @@ -18,6 +18,7 @@ namespace mailcore { class IMAPAsyncConnection; + class IMAPAsyncSession; class IMAPOperationCallback; class IMAPOperation : public Operation, public IMAPProgressCallback { @@ -25,12 +26,18 @@ namespace mailcore { IMAPOperation(); virtual ~IMAPOperation(); + virtual void setMainSession(IMAPAsyncSession * session); + virtual IMAPAsyncSession * mainSession(); + virtual void setSession(IMAPAsyncConnection * session); virtual IMAPAsyncConnection * session(); virtual void setFolder(String * folder); virtual String * folder(); + virtual void setUrgent(bool urgent); + virtual bool isUrgent(); + virtual void setImapCallback(IMAPOperationCallback * callback); virtual IMAPOperationCallback * imapCallback(); @@ -44,10 +51,12 @@ namespace mailcore { virtual ErrorCode error(); private: + IMAPAsyncSession * mMainSession; IMAPAsyncConnection * mSession; String * mFolder; IMAPOperationCallback * mImapCallback; ErrorCode mError; + bool mUrgent; private: virtual void bodyProgress(IMAPSession * session, unsigned int current, unsigned int maximum); diff --git a/src/async/nntp/MCAsyncNNTP.h b/src/async/nntp/MCAsyncNNTP.h new file mode 100644 index 00000000..56509ff8 --- /dev/null +++ b/src/async/nntp/MCAsyncNNTP.h @@ -0,0 +1,21 @@ +// +// MCAsyncNNTP.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCASYNCNNTP_H + +#define MAILCORE_MCASYNCNNTP_H + +#include <MailCore/MCNNTPAsyncSession.h> +#include <MailCore/MCNNTPOperation.h> +#include <MailCore/MCNNTPFetchHeaderOperation.h> +#include <MailCore/MCNNTPFetchArticleOperation.h> +#include <MailCore/MCNNTPFetchArticlesOperation.h> +#include <MailCore/MCNNTPListNewsgroupsOperation.h> +#include <MailCore/MCNNTPOperationCallback.h> + +#endif diff --git a/src/async/nntp/MCNNTPAsyncSession.cc b/src/async/nntp/MCNNTPAsyncSession.cc new file mode 100644 index 00000000..833bf4d5 --- /dev/null +++ b/src/async/nntp/MCNNTPAsyncSession.cc @@ -0,0 +1,272 @@ +// +// MCNNTPAsyncSession.cpp +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#include "MCNNTPAsyncSession.h" + +#include "MCNNTP.h" +#include "MCNNTPFetchHeaderOperation.h" +#include "MCNNTPFetchArticleOperation.h" +#include "MCNNTPFetchArticlesOperation.h" +#include "MCNNTPListNewsgroupsOperation.h" +#include "MCNNTPCheckAccountOperation.h" +#include "MCNNTPDisconnectOperation.h" +#include "MCOperationQueueCallback.h" +#include "MCConnectionLogger.h" + +using namespace mailcore; + +namespace mailcore { + class NNTPOperationQueueCallback : public Object, public OperationQueueCallback { + public: + NNTPOperationQueueCallback(NNTPAsyncSession * session) { + mSession = session; + } + + virtual ~NNTPOperationQueueCallback() { + } + + virtual void queueStartRunning() { + mSession->retain(); + } + + virtual void queueStoppedRunning() { + mSession->release(); + } + + private: + NNTPAsyncSession * mSession; + }; + + class NNTPConnectionLogger : public Object, public ConnectionLogger { + public: + NNTPConnectionLogger(NNTPAsyncSession * session) { + mSession = session; + } + + virtual ~NNTPConnectionLogger() { + } + + virtual void log(void * sender, ConnectionLogType logType, Data * buffer) + { + mSession->logConnection(logType, buffer); + } + + private: + NNTPAsyncSession * mSession; + }; + +} + +NNTPAsyncSession::NNTPAsyncSession() +{ + mSession = new NNTPSession(); + mQueue = new OperationQueue(); + mQueueCallback = new NNTPOperationQueueCallback(this); + mQueue->setCallback(mQueueCallback); + mConnectionLogger = NULL; + pthread_mutex_init(&mConnectionLoggerLock, NULL); + mInternalLogger = new NNTPConnectionLogger(this); + mSession->setConnectionLogger(mInternalLogger); +} + +NNTPAsyncSession::~NNTPAsyncSession() +{ + MC_SAFE_RELEASE(mInternalLogger); + pthread_mutex_destroy(&mConnectionLoggerLock); + MC_SAFE_RELEASE(mQueueCallback); + MC_SAFE_RELEASE(mSession); + MC_SAFE_RELEASE(mQueue); +} + +void NNTPAsyncSession::setHostname(String * hostname) +{ + mSession->setHostname(hostname); +} + +String * NNTPAsyncSession::hostname() +{ + return mSession->hostname(); +} + +void NNTPAsyncSession::setPort(unsigned int port) +{ + mSession->setPort(port); +} + +unsigned int NNTPAsyncSession::port() +{ + return mSession->port(); +} + +void NNTPAsyncSession::setUsername(String * username) +{ + mSession->setUsername(username); +} + +String * NNTPAsyncSession::username() +{ + return mSession->username(); +} + +void NNTPAsyncSession::setPassword(String * password) +{ + mSession->setPassword(password); +} + +String * NNTPAsyncSession::password() +{ + return mSession->password(); +} + +void NNTPAsyncSession::setConnectionType(ConnectionType connectionType) +{ + mSession->setConnectionType(connectionType); +} + +ConnectionType NNTPAsyncSession::connectionType() +{ + return mSession->connectionType(); +} + +void NNTPAsyncSession::setTimeout(time_t timeout) +{ + mSession->setTimeout(timeout); +} + +time_t NNTPAsyncSession::timeout() +{ + return mSession->timeout(); +} + +void NNTPAsyncSession::setCheckCertificateEnabled(bool enabled) +{ + mSession->setCheckCertificateEnabled(enabled); +} + +bool NNTPAsyncSession::isCheckCertificateEnabled() +{ + return mSession->isCheckCertificateEnabled(); +} + +MCNNTPFetchArticlesOperation * NNTPAsyncSession::fetchArticlesOperation(String * group) +{ + MCNNTPFetchArticlesOperation * op = new MCNNTPFetchArticlesOperation(); + op->setSession(this); + op->setGroupName(group); + op->autorelease(); + return op; +} + +NNTPFetchHeaderOperation * NNTPAsyncSession::fetchHeaderOperation(String * groupName, unsigned int index) +{ + NNTPFetchHeaderOperation * op = new NNTPFetchHeaderOperation(); + op->setSession(this); + op->setGroupName(groupName); + op->setMessageIndex(index); + op->autorelease(); + return op; +} + +NNTPFetchArticleOperation * NNTPAsyncSession::fetchArticleOperation(String * groupName, unsigned int index) +{ + NNTPFetchArticleOperation * op = new NNTPFetchArticleOperation(); + op->setSession(this); + op->setGroupName(groupName); + op->setMessageIndex(index); + op->autorelease(); + return op; +} + +NNTPListNewsgroupsOperation * NNTPAsyncSession::listAllNewsgroupsOperation() +{ + NNTPListNewsgroupsOperation * op = new NNTPListNewsgroupsOperation(); + op->setSession(this); + op->setListsSubscribed(false); + op->autorelease(); + return op; +} + +NNTPListNewsgroupsOperation * NNTPAsyncSession::listSubscribedNewsgroupsOperation() +{ + NNTPListNewsgroupsOperation * op = new NNTPListNewsgroupsOperation(); + op->setSession(this); + op->setListsSubscribed(true); + op->autorelease(); + return op; +} + +NNTPOperation * NNTPAsyncSession::disconnectOperation() +{ + NNTPDisconnectOperation * op = new NNTPDisconnectOperation(); + op->setSession(this); + op->autorelease(); + return op; +} + +NNTPOperation * NNTPAsyncSession::checkAccountOperation() +{ + NNTPCheckAccountOperation * op = new NNTPCheckAccountOperation(); + op->setSession(this); + op->autorelease(); + return op; +} + +NNTPSession * NNTPAsyncSession::session() +{ + return mSession; +} + +void NNTPAsyncSession::runOperation(NNTPOperation * operation) +{ + mQueue->addOperation(operation); +} + +void NNTPAsyncSession::setConnectionLogger(ConnectionLogger * logger) +{ + pthread_mutex_lock(&mConnectionLoggerLock); + mConnectionLogger = logger; + if (mConnectionLogger != NULL) { + mSession->setConnectionLogger(mInternalLogger); + } + else { + mSession->setConnectionLogger(NULL); + } + pthread_mutex_unlock(&mConnectionLoggerLock); +} + +ConnectionLogger * NNTPAsyncSession::connectionLogger() +{ + ConnectionLogger * result; + + pthread_mutex_lock(&mConnectionLoggerLock); + result = mConnectionLogger; + pthread_mutex_unlock(&mConnectionLoggerLock); + + return result; +} + +void NNTPAsyncSession::logConnection(ConnectionLogType logType, Data * buffer) +{ + pthread_mutex_lock(&mConnectionLoggerLock); + if (mConnectionLogger != NULL) { + mConnectionLogger->log(this, logType, buffer); + } + pthread_mutex_unlock(&mConnectionLoggerLock); +} + +#if __APPLE__ +void NNTPAsyncSession::setDispatchQueue(dispatch_queue_t dispatchQueue) +{ + mQueue->setDispatchQueue(dispatchQueue); +} + +dispatch_queue_t NNTPAsyncSession::dispatchQueue() +{ + return mQueue->dispatchQueue(); +} +#endif diff --git a/src/async/nntp/MCNNTPAsyncSession.h b/src/async/nntp/MCNNTPAsyncSession.h new file mode 100644 index 00000000..66f0cc0d --- /dev/null +++ b/src/async/nntp/MCNNTPAsyncSession.h @@ -0,0 +1,85 @@ +#ifndef MAILCORE_MCNNTPASYNCSESSION_H + +#define MAILCORE_MCNNTPASYNCSESSION_H + +#include <MailCore/MCBaseTypes.h> + +#ifdef __cplusplus + +namespace mailcore { + + class NNTPOperation; + class NNTPSession; + class NNTPFetchHeaderOperation; + class NNTPFetchArticleOperation; + class MCNNTPFetchArticlesOperation; + class NNTPListNewsgroupsOperation; + class NNTPOperationQueueCallback; + class NNTPConnectionLogger; + + class NNTPAsyncSession : public Object { + public: + NNTPAsyncSession(); + virtual ~NNTPAsyncSession(); + + virtual void setHostname(String * hostname); + virtual String * hostname(); + + virtual void setPort(unsigned int port); + virtual unsigned int port(); + + virtual void setUsername(String * login); + virtual String * username(); + + virtual void setPassword(String * password); + virtual String * password(); + + virtual void setConnectionType(ConnectionType connectionType); + virtual ConnectionType connectionType(); + + virtual void setTimeout(time_t timeout); + virtual time_t timeout(); + + virtual void setCheckCertificateEnabled(bool enabled); + virtual bool isCheckCertificateEnabled(); + + virtual void setConnectionLogger(ConnectionLogger * logger); + virtual ConnectionLogger * connectionLogger(); + +#ifdef __APPLE__ + virtual void setDispatchQueue(dispatch_queue_t dispatchQueue); + virtual dispatch_queue_t dispatchQueue(); +#endif + + virtual MCNNTPFetchArticlesOperation * fetchArticlesOperation(String * group); + + virtual NNTPFetchHeaderOperation * fetchHeaderOperation(String * groupName, unsigned int index); + + virtual NNTPFetchArticleOperation * fetchArticleOperation(String *groupName, unsigned int index); + + virtual NNTPListNewsgroupsOperation * listAllNewsgroupsOperation(); + virtual NNTPListNewsgroupsOperation * listSubscribedNewsgroupsOperation(); + + virtual NNTPOperation * disconnectOperation(); + + virtual NNTPOperation * checkAccountOperation(); + + private: + NNTPSession * mSession; + OperationQueue * mQueue; + NNTPOperationQueueCallback * mQueueCallback; + ConnectionLogger * mConnectionLogger; + pthread_mutex_t mConnectionLoggerLock; + NNTPConnectionLogger * mInternalLogger; + + public: // private + virtual void runOperation(NNTPOperation * operation); + virtual NNTPSession * session(); + virtual void logConnection(ConnectionLogType logType, Data * buffer); + }; + +} + +#endif + +#endif diff --git a/src/async/nntp/MCNNTPCheckAccountOperation.cc b/src/async/nntp/MCNNTPCheckAccountOperation.cc new file mode 100644 index 00000000..29b050f0 --- /dev/null +++ b/src/async/nntp/MCNNTPCheckAccountOperation.cc @@ -0,0 +1,30 @@ +// +// MCNNTPCheckAccountOperation.cpp +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#include "MCNNTPCheckAccountOperation.h" + +#include "MCNNTPAsyncSession.h" +#include "MCNNTPSession.h" + +using namespace mailcore; + +NNTPCheckAccountOperation::NNTPCheckAccountOperation() +{ +} + +NNTPCheckAccountOperation::~NNTPCheckAccountOperation() +{ +} + +void NNTPCheckAccountOperation::main() +{ + ErrorCode error; + + session()->session()->checkAccount(&error); + setError(error); +} diff --git a/src/async/nntp/MCNNTPCheckAccountOperation.h b/src/async/nntp/MCNNTPCheckAccountOperation.h new file mode 100644 index 00000000..28db9c58 --- /dev/null +++ b/src/async/nntp/MCNNTPCheckAccountOperation.h @@ -0,0 +1,32 @@ +// +// MCNNTPCheckAccountOperation.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCNNTPCHECKACCOUNTOPERATION_H + +#define MAILCORE_MCNNTPCHECKACCOUNTOPERATION_H + +#include <MailCore/MCNNTPOperation.h> + +#ifdef __cplusplus + +namespace mailcore { + + class NNTPCheckAccountOperation : public NNTPOperation { + public: + NNTPCheckAccountOperation(); + virtual ~NNTPCheckAccountOperation(); + + public: // subclass behavior + virtual void main(); + }; + +} + +#endif + +#endif diff --git a/src/async/nntp/MCNNTPDisconnectOperation.cc b/src/async/nntp/MCNNTPDisconnectOperation.cc new file mode 100644 index 00000000..d269904a --- /dev/null +++ b/src/async/nntp/MCNNTPDisconnectOperation.cc @@ -0,0 +1,30 @@ +// +// MCNNTPDisconnectOperation.cpp +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#include "MCNNTPDisconnectOperation.h" + +#include "MCNNTPAsyncSession.h" +#include "MCNNTPSession.h" + +using namespace mailcore; + +NNTPDisconnectOperation::NNTPDisconnectOperation() +{ +} + +NNTPDisconnectOperation::~NNTPDisconnectOperation() +{ +} + +void NNTPDisconnectOperation::main() +{ + ErrorCode error; + + session()->session()->checkAccount(&error); + setError(error); +} diff --git a/src/async/nntp/MCNNTPDisconnectOperation.h b/src/async/nntp/MCNNTPDisconnectOperation.h new file mode 100644 index 00000000..f2b5d138 --- /dev/null +++ b/src/async/nntp/MCNNTPDisconnectOperation.h @@ -0,0 +1,32 @@ +// +// MCNNTPDisconnectOperation.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCNNTPDISCONNECTOPERATION_H + +#define MAILCORE_MCNNTPDISCONNECTOPERATION_H + +#include <MailCore/MCNNTPOperation.h> + +#ifdef __cplusplus + +namespace mailcore { + + class NNTPDisconnectOperation : public NNTPOperation { + public: + NNTPDisconnectOperation(); + virtual ~NNTPDisconnectOperation(); + + public: // subclass behavior + virtual void main(); + }; + +} + +#endif + +#endif diff --git a/src/async/nntp/MCNNTPFetchArticleOperation.cc b/src/async/nntp/MCNNTPFetchArticleOperation.cc new file mode 100644 index 00000000..a12f346f --- /dev/null +++ b/src/async/nntp/MCNNTPFetchArticleOperation.cc @@ -0,0 +1,57 @@ +// +// MCMCNNTPFetchArticlesOperation.cpp +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#include "MCNNTPFetchArticleOperation.h" + +#include "MCNNTPAsyncSession.h" +#include "MCNNTPSession.h" + +using namespace mailcore; + +NNTPFetchArticleOperation::NNTPFetchArticleOperation() +{ + mMessageIndex = 0; + mData = NULL; +} + +NNTPFetchArticleOperation::~NNTPFetchArticleOperation() +{ + MC_SAFE_RELEASE(mData); +} + +void NNTPFetchArticleOperation::setGroupName(String * groupName) { + MC_SAFE_REPLACE_COPY(String, mGroupName, groupName); +} + +String * NNTPFetchArticleOperation::groupName() { + return mGroupName; +} + +void NNTPFetchArticleOperation::setMessageIndex(unsigned int messageIndex) +{ + mMessageIndex = messageIndex; +} + +unsigned int NNTPFetchArticleOperation::messageIndex() +{ + return mMessageIndex; +} + +Data * NNTPFetchArticleOperation::data() +{ + return mData; +} + +void NNTPFetchArticleOperation::main() +{ + ErrorCode error; + mData = session()->session()->fetchArticle(mGroupName, mMessageIndex, this, &error); + MC_SAFE_RETAIN(mData); + setError(error); +} + diff --git a/src/async/nntp/MCNNTPFetchArticleOperation.h b/src/async/nntp/MCNNTPFetchArticleOperation.h new file mode 100644 index 00000000..4f607c4f --- /dev/null +++ b/src/async/nntp/MCNNTPFetchArticleOperation.h @@ -0,0 +1,45 @@ +// +// MCMCNNTPFetchArticlesOperation.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCNNTPFETCHARTICLEOPERATION_H + +#define MAILCORE_MCNNTPFETCHARTICLEOPERATION_H + +#include <MailCore/MCNNTPOperation.h> + +#ifdef __cplusplus + +namespace mailcore { + class NNTPFetchArticleOperation : public NNTPOperation { + public: + NNTPFetchArticleOperation(); + virtual ~NNTPFetchArticleOperation(); + + virtual void setGroupName(String * groupName); + virtual String * groupName(); + + virtual void setMessageIndex(unsigned int messageIndex); + virtual unsigned int messageIndex(); + + virtual Data * data(); + + public: // subclass behavior + virtual void main(); + + private: + String * mGroupName; + unsigned int mMessageIndex; + Data * mData; + + }; + +} + +#endif + +#endif diff --git a/src/async/nntp/MCNNTPFetchArticlesOperation.cc b/src/async/nntp/MCNNTPFetchArticlesOperation.cc new file mode 100644 index 00000000..39446f35 --- /dev/null +++ b/src/async/nntp/MCNNTPFetchArticlesOperation.cc @@ -0,0 +1,49 @@ +// +// MCMCNNTPFetchArticlesOperation.cpp +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#include "MCNNTPFetchArticlesOperation.h" + +#include "MCNNTPAsyncSession.h" +#include "MCNNTPSession.h" + +using namespace mailcore; + +MCNNTPFetchArticlesOperation::MCNNTPFetchArticlesOperation() +{ + mGroupName = NULL; + mArticles = NULL; +} + +MCNNTPFetchArticlesOperation::~MCNNTPFetchArticlesOperation() +{ + MC_SAFE_RELEASE(mGroupName); + MC_SAFE_RELEASE(mArticles); +} + +void MCNNTPFetchArticlesOperation::setGroupName(String * groupname) +{ + MC_SAFE_REPLACE_COPY(String, mGroupName, groupname); +} + +String * MCNNTPFetchArticlesOperation::groupName() +{ + return mGroupName; +} + +IndexSet * MCNNTPFetchArticlesOperation::articles() +{ + return mArticles; +} + +void MCNNTPFetchArticlesOperation::main() +{ + ErrorCode error; + mArticles = session()->session()->fetchArticles(mGroupName, &error); + setError(error); + MC_SAFE_RETAIN(mArticles); +} diff --git a/src/async/nntp/MCNNTPFetchArticlesOperation.h b/src/async/nntp/MCNNTPFetchArticlesOperation.h new file mode 100644 index 00000000..fa0037c8 --- /dev/null +++ b/src/async/nntp/MCNNTPFetchArticlesOperation.h @@ -0,0 +1,41 @@ +// +// MCMCNNTPFetchArticlesOperation.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCNNTPFETCHARTICLESOPERATION_H + +#define MAILCORE_MCNNTPFETCHARTICLESOPERATION_H + +#include <MailCore/MCNNTPOperation.h> + +#ifdef __cplusplus + +namespace mailcore { + + class MCNNTPFetchArticlesOperation : public NNTPOperation { + public: + MCNNTPFetchArticlesOperation(); + virtual ~MCNNTPFetchArticlesOperation(); + + virtual void setGroupName(String * groupName); + virtual String * groupName(); + + virtual IndexSet * articles(); + + public: // subclass behavior + virtual void main(); + + private: + String * mGroupName; + IndexSet * mArticles; + }; + +} + +#endif + +#endif diff --git a/src/async/nntp/MCNNTPFetchHeaderOperation.cc b/src/async/nntp/MCNNTPFetchHeaderOperation.cc new file mode 100644 index 00000000..386dc142 --- /dev/null +++ b/src/async/nntp/MCNNTPFetchHeaderOperation.cc @@ -0,0 +1,59 @@ +// +// MCNNTPFetchHeaderOperation.cpp +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#include "MCNNTPFetchHeaderOperation.h" + +#include "MCNNTPAsyncSession.h" +#include "MCNNTPSession.h" +#include "MCMessageHeader.h" + +using namespace mailcore; + +NNTPFetchHeaderOperation::NNTPFetchHeaderOperation() +{ + mMessageIndex = 0; + mHeader = NULL; +} + +NNTPFetchHeaderOperation::~NNTPFetchHeaderOperation() +{ + MC_SAFE_RELEASE(mHeader); +} + +void NNTPFetchHeaderOperation::setGroupName(String * groupName) { + MC_SAFE_REPLACE_COPY(String, mGroupName, groupName); +} + +String * NNTPFetchHeaderOperation::groupName() { + return mGroupName; +} + +void NNTPFetchHeaderOperation::setMessageIndex(unsigned int messageIndex) +{ + mMessageIndex = messageIndex; +} + +unsigned int NNTPFetchHeaderOperation::messageIndex() +{ + return mMessageIndex; +} + +MessageHeader * NNTPFetchHeaderOperation::header() +{ + return mHeader; +} + +void NNTPFetchHeaderOperation::main() +{ + ErrorCode error; + mHeader = session()->session()->fetchHeader(mGroupName, mMessageIndex, &error); + if (mHeader != NULL) { + mHeader->retain(); + } + setError(error); +} diff --git a/src/async/nntp/MCNNTPFetchHeaderOperation.h b/src/async/nntp/MCNNTPFetchHeaderOperation.h new file mode 100644 index 00000000..97b12b05 --- /dev/null +++ b/src/async/nntp/MCNNTPFetchHeaderOperation.h @@ -0,0 +1,48 @@ +// +// MCNNTPFetchHeaderOperation.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCNNTPFETCHHEADEROPERATION_H + +#define MAILCORE_MCNNTPFETCHHEADEROPERATION_H + +#include <MailCore/MCNNTPOperation.h> + +#ifdef __cplusplus + +namespace mailcore { + + class MessageHeader; + + class NNTPFetchHeaderOperation : public NNTPOperation { + public: + NNTPFetchHeaderOperation(); + virtual ~NNTPFetchHeaderOperation(); + + virtual void setGroupName(String * groupName); + virtual String * groupName(); + + virtual void setMessageIndex(unsigned int messageIndex); + virtual unsigned int messageIndex(); + + virtual MessageHeader * header(); + + public: // subclass behavior + virtual void main(); + + private: + String * mGroupName; + unsigned int mMessageIndex; + MessageHeader * mHeader; + + }; + +} + +#endif + +#endif diff --git a/src/async/nntp/MCNNTPListNewsgroupsOperation.cc b/src/async/nntp/MCNNTPListNewsgroupsOperation.cc new file mode 100644 index 00000000..253b38d0 --- /dev/null +++ b/src/async/nntp/MCNNTPListNewsgroupsOperation.cc @@ -0,0 +1,48 @@ +// +// MCNNTPListNewsgroupsMessagesOperation.cpp +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#include "MCNNTPListNewsgroupsOperation.h" + +#include "MCNNTPAsyncSession.h" +#include "MCNNTPSession.h" + +using namespace mailcore; + +NNTPListNewsgroupsOperation::NNTPListNewsgroupsOperation() +{ +} + +NNTPListNewsgroupsOperation::~NNTPListNewsgroupsOperation() +{ +} + +void NNTPListNewsgroupsOperation::setListsSubscribed(bool listsSubscribed) +{ + mListsSuscribed = listsSubscribed; +} + +bool NNTPListNewsgroupsOperation::listsSubscribed() +{ + return mListsSuscribed; +} + +Array * NNTPListNewsgroupsOperation::groups() { + return mGroups; +} + +void NNTPListNewsgroupsOperation::main() +{ + ErrorCode error; + + if (mListsSuscribed) { + mGroups = session()->session()->listSubscribedNewsgroups(&error); + } else { + mGroups = session()->session()->listAllNewsgroups(&error); + } + setError(error); +} diff --git a/src/async/nntp/MCNNTPListNewsgroupsOperation.h b/src/async/nntp/MCNNTPListNewsgroupsOperation.h new file mode 100644 index 00000000..54156012 --- /dev/null +++ b/src/async/nntp/MCNNTPListNewsgroupsOperation.h @@ -0,0 +1,41 @@ +// +// MCNNTPListNewsgroupsMessagesOperation.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCNNTPLISTNEWSGROUPSOPERATION_H + +#define MAILCORE_MCNNTPLISTNEWSGROUPSOPERATION_H + +#include <MailCore/MCNNTPOperation.h> + +#ifdef __cplusplus + +namespace mailcore { + + class NNTPListNewsgroupsOperation : public NNTPOperation { + public: + NNTPListNewsgroupsOperation(); + virtual ~NNTPListNewsgroupsOperation(); + + virtual void setListsSubscribed(bool listsSubscribed); + virtual bool listsSubscribed(); + + virtual Array * groups(); + + public: // subclass behavior + virtual void main(); + + private: + bool mListsSuscribed; + Array * /* NNTPGroupInfo */ mGroups; + }; + +} + +#endif + +#endif diff --git a/src/async/nntp/MCNNTPOperation.cc b/src/async/nntp/MCNNTPOperation.cc new file mode 100644 index 00000000..3368ba0e --- /dev/null +++ b/src/async/nntp/MCNNTPOperation.cc @@ -0,0 +1,104 @@ +// +// MCNNTPOperation.cpp +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#include "MCNNTPOperation.h" + +#include <stdlib.h> + +#include "MCNNTPSession.h" +#include "MCNNTPAsyncSession.h" +#include "MCNNTPOperationCallback.h" + +using namespace mailcore; + +NNTPOperation::NNTPOperation() +{ + mSession = NULL; + mPopCallback = NULL; + mError = ErrorNone; +} + +NNTPOperation::~NNTPOperation() +{ + MC_SAFE_RELEASE(mSession); +} + +void NNTPOperation::setSession(NNTPAsyncSession * session) +{ + MC_SAFE_REPLACE_RETAIN(NNTPAsyncSession, mSession, session); +#if __APPLE__ + dispatch_queue_t queue; + if (session != NULL) { + queue = session->dispatchQueue(); + } + else { + queue = dispatch_get_main_queue(); + } + setCallbackDispatchQueue(queue); +#endif +} + +NNTPAsyncSession * NNTPOperation::session() +{ + return mSession; +} + +void NNTPOperation::setNNTPCallback(NNTPOperationCallback * callback) +{ + mPopCallback = callback; +} + +NNTPOperationCallback * NNTPOperation::nntpCallback() +{ + return mPopCallback; +} + +void NNTPOperation::setError(ErrorCode error) +{ + mError = error; +} + +ErrorCode NNTPOperation::error() +{ + return mError; +} + +void NNTPOperation::start() +{ + mSession->runOperation(this); +} + +struct progressContext { + unsigned int current; + unsigned int maximum; +}; + +void NNTPOperation::bodyProgress(NNTPSession * session, unsigned int current, unsigned int maximum) +{ + struct progressContext * context = (struct progressContext *) calloc(sizeof(* context), 1); + context->current = current; + context->maximum = maximum; + + retain(); + performMethodOnCallbackThread((Object::Method) &NNTPOperation::bodyProgressOnMainThread, context); +} + +void NNTPOperation::bodyProgressOnMainThread(void * ctx) +{ + if (isCancelled()) { + release(); + return; + } + + struct progressContext * context = (struct progressContext *) ctx; + if (mPopCallback != NULL) { + mPopCallback->bodyProgress(this, context->current, context->maximum); + } + free(context); + release(); +} diff --git a/src/async/nntp/MCNNTPOperation.h b/src/async/nntp/MCNNTPOperation.h new file mode 100644 index 00000000..fb40e9df --- /dev/null +++ b/src/async/nntp/MCNNTPOperation.h @@ -0,0 +1,53 @@ +// +// MCNNTPOperation.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCNNTPOPERATION_H + +#define MAILCORE_MCNNTPOPERATION_H + +#include <MailCore/MCBaseTypes.h> +#include <MailCore/MCNNTPProgressCallback.h> + +#ifdef __cplusplus + +namespace mailcore { + + class NNTPAsyncSession; + class NNTPOperationCallback; + + class NNTPOperation : public Operation, public NNTPProgressCallback { + public: + NNTPOperation(); + virtual ~NNTPOperation(); + + virtual void setSession(NNTPAsyncSession * session); + virtual NNTPAsyncSession * session(); + + virtual void setNNTPCallback(NNTPOperationCallback * callback); + virtual NNTPOperationCallback * nntpCallback(); + + virtual void setError(ErrorCode error); + virtual ErrorCode error(); + + virtual void start(); + + private: + NNTPAsyncSession * mSession; + NNTPOperationCallback * mPopCallback; + ErrorCode mError; + private: + virtual void bodyProgress(NNTPSession * session, unsigned int current, unsigned int maximum); + virtual void bodyProgressOnMainThread(void * context); + + }; + +} + +#endif + +#endif diff --git a/src/async/nntp/MCNNTPOperationCallback.h b/src/async/nntp/MCNNTPOperationCallback.h new file mode 100644 index 00000000..f6166610 --- /dev/null +++ b/src/async/nntp/MCNNTPOperationCallback.h @@ -0,0 +1,28 @@ +// +// MCNNTPOperationCallback.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCNNTPOPERATIONCALLBACK_H + +#define MAILCORE_MCNNTPOPERATIONCALLBACK_H + +#ifdef __cplusplus + +namespace mailcore { + + class NNTPOperation; + + class NNTPOperationCallback { + public: + virtual void bodyProgress(NNTPOperation * session, unsigned int current, unsigned int maximum) {}; + }; + +} + +#endif + +#endif diff --git a/src/cmake/async.cmake b/src/cmake/async.cmake index 929b200d..e38bffe2 100644 --- a/src/cmake/async.cmake +++ b/src/cmake/async.cmake @@ -52,10 +52,22 @@ set(async_smtp_files async/smtp/MCSMTPNoopOperation.cc ) +set(async_nntp_files + async/nntp/MCNNTPAsyncSession.cc + async/nntp/MCNNTPCheckAccountOperation.cc + async/nntp/MCNNTPDisconnectOperation.cc + async/nntp/MCNNTPFetchArticleOperation.cc + async/nntp/MCNNTPFetchArticlesOperation.cc + async/nntp/MCNNTPFetchHeaderOperation.cc + async/nntp/MCNNTPListNewsgroupsOperation.cc + async/nntp/MCNNTPOperation.cc +) + set(async_files ${async_imap_files} ${async_pop_files} ${async_smtp_files} + ${async_nntp_files} ) # Includes for build @@ -65,4 +77,5 @@ set(async_includes "${CMAKE_CURRENT_SOURCE_DIR}/async/imap" "${CMAKE_CURRENT_SOURCE_DIR}/async/pop" "${CMAKE_CURRENT_SOURCE_DIR}/async/smtp" + "${CMAKE_CURRENT_SOURCE_DIR}/async/nntp" ) diff --git a/src/cmake/core.cmake b/src/cmake/core.cmake index 8e95390d..e69e4fc0 100644 --- a/src/cmake/core.cmake +++ b/src/cmake/core.cmake @@ -64,6 +64,11 @@ set(pop_files core/pop/MCPOPSession.cc ) +set(nntp_files + core/nntp/MCNNTPGroupInfo.cc + core/nntp/MCNNTPSession.cc +) + set(provider_files core/provider/MCMailProvider.cc core/provider/MCMailProvidersManager.cc @@ -110,6 +115,7 @@ set(core_files ${abstract_files} ${imap_files} ${pop_files} + ${nntp_files} ${renderer_files} ${rfc822_files} ${security_files} @@ -125,6 +131,7 @@ set(core_includes "${CMAKE_CURRENT_SOURCE_DIR}/core/basetypes" "${CMAKE_CURRENT_SOURCE_DIR}/core/imap" "${CMAKE_CURRENT_SOURCE_DIR}/core/pop" + "${CMAKE_CURRENT_SOURCE_DIR}/core/nntp" "${CMAKE_CURRENT_SOURCE_DIR}/core/provider" "${CMAKE_CURRENT_SOURCE_DIR}/core/renderer" "${CMAKE_CURRENT_SOURCE_DIR}/core/rfc822" diff --git a/src/cmake/objc.cmake b/src/cmake/objc.cmake index 7224c668..af1cfcf5 100644 --- a/src/cmake/objc.cmake +++ b/src/cmake/objc.cmake @@ -74,6 +74,17 @@ set(objc_smtp_files objc/smtp/MCOSMTPSession.mm ) +set(objc_nntp_files + objc/nntp/MCONNTPDisconnectOperation.mm + objc/nntp/MCONNTPFetchArticleOperation.mm + objc/nntp/MCONNTPFetchArticlesOperation.mm + objc/nntp/MCONNTPFetchHeaderOperation.mm + objc/nntp/MCONNTPGroupInfo.mm + objc/nntp/MCONNTPListNewsgroupsOperation.mm + objc/nntp/MCONNTPOperation.mm + objc/nntp/MCONNTPSession.mm +) + set(objc_utils_files objc/utils/MCOIndexSet.mm objc/utils/MCOObjectWrapper.mm @@ -94,6 +105,7 @@ set(objc_files ${objc_abstract_files} ${objc_imap_files} ${objc_pop_files} + ${objc_nntp_files} ${objc_rfc822_files} ${objc_smtp_files} ${objc_utils_files} @@ -107,6 +119,7 @@ set(objc_includes "${CMAKE_CURRENT_SOURCE_DIR}/objc/abstract" "${CMAKE_CURRENT_SOURCE_DIR}/objc/imap" "${CMAKE_CURRENT_SOURCE_DIR}/objc/pop" + "${CMAKE_CURRENT_SOURCE_DIR}/objc/nntp" "${CMAKE_CURRENT_SOURCE_DIR}/objc/rfc822" "${CMAKE_CURRENT_SOURCE_DIR}/objc/smtp" "${CMAKE_CURRENT_SOURCE_DIR}/objc/utils" diff --git a/src/cmake/public-headers.cmake b/src/cmake/public-headers.cmake index 0aad67f6..705fbc66 100644 --- a/src/cmake/public-headers.cmake +++ b/src/cmake/public-headers.cmake @@ -61,6 +61,10 @@ core/rfc822/MCMultipart.h core/smtp/MCSMTP.h core/smtp/MCSMTPProgressCallback.h core/smtp/MCSMTPSession.h +core/nntp/MCNNTP.h +core/nntp/MCNNTPGroupInfo.h +core/nntp/MCNNTPProgressCallback.h +core/nntp/MCNNTPSession.h core/renderer/MCRenderer.h core/renderer/MCHTMLRendererCallback.h core/renderer/MCDateFormatter.h @@ -99,6 +103,16 @@ async/pop/MCPOPFetchHeaderOperation.h async/pop/MCPOPFetchMessageOperation.h async/pop/MCPOPFetchMessagesOperation.h async/pop/MCPOPOperationCallback.h +async/nntp/MCAsyncNNTP.h +async/nntp/MCNNTPAsyncSession.h +async/nntp/MCNNTPCheckAccountOperation.h +async/nntp/MCNNTPDisconnectOperation.h +async/nntp/MCNNTPFetchArticleOperation.h +async/nntp/MCNNTPFetchArticlesOperation.h +async/nntp/MCNNTPFetchHeaderOperation.h +async/nntp/MCNNTPListNewsgroupsOperation.h +async/nntp/MCNNTPOperation.h +async/nntp/MCNNTPOperationCallback.h objc/MCObjC.h objc/utils/MCOUtils.h objc/utils/MCOObjectWrapper.h @@ -169,6 +183,18 @@ objc/smtp/MCOSMTP.h objc/smtp/MCOSMTPSession.h objc/smtp/MCOSMTPSendOperation.h objc/smtp/MCOSMTPOperation.h +objc/nntp/MCONNTP.h +objc/nntp/MCONNTPDisconnectOperation.h +objc/nntp/MCONNTPFetchArticleOperation.h +objc/nntp/MCONNTPFetchArticleOperation.mm +objc/nntp/MCONNTPFetchArticlesOperation.h +objc/nntp/MCONNTPFetchArticlesOperation.mm +objc/nntp/MCONNTPFetchHeaderOperation.h +objc/nntp/MCONNTPFetchHeaderOperation.mm +objc/nntp/MCONNTPGroupInfo.h +objc/nntp/MCONNTPListNewsgroupsOperation.h +objc/nntp/MCONNTPOperation.h +objc/nntp/MCONNTPSession.h objc/provider/MCOProvider.h objc/provider/MCONetService.h objc/provider/MCOMailProvider.h diff --git a/src/core/MCCore.h b/src/core/MCCore.h index 74c16147..323bb606 100644 --- a/src/core/MCCore.h +++ b/src/core/MCCore.h @@ -14,6 +14,7 @@ #include <MailCore/MCBaseTypes.h> #include <MailCore/MCIMAP.h> #include <MailCore/MCPOP.h> +#include <MailCore/MCNNTP.h> #include <MailCore/MCRFC822.h> #include <MailCore/MCSMTP.h> #include <MailCore/MCRenderer.h> diff --git a/src/core/abstract/MCAbstractMultipart.cc b/src/core/abstract/MCAbstractMultipart.cc index e3a2f9f7..d46a0c75 100644 --- a/src/core/abstract/MCAbstractMultipart.cc +++ b/src/core/abstract/MCAbstractMultipart.cc @@ -57,6 +57,9 @@ String * AbstractMultipart::description() case PartTypeMultipartAlternative: partTypeName = "alternative"; break; + case PartTypeMultipartSigned: + partTypeName = "signed"; + break; } result->appendUTF8Format("<%s:%p %s %s>", diff --git a/src/core/abstract/MCAbstractPart.cc b/src/core/abstract/MCAbstractPart.cc index 08cd83e3..50f12249 100644 --- a/src/core/abstract/MCAbstractPart.cc +++ b/src/core/abstract/MCAbstractPart.cc @@ -294,6 +294,7 @@ void AbstractPart::applyUniquePartID() case PartTypeMultipartMixed: case PartTypeMultipartRelated: case PartTypeMultipartAlternative: + case PartTypeMultipartSigned: queue->addObjectsFromArray(((AbstractMultipart *) part)->parts()); break; } @@ -348,6 +349,9 @@ HashMap * AbstractPart::serializable() case PartTypeMultipartAlternative: partTypeStr = MCSTR("multipart/alternative"); break; + case PartTypeMultipartSigned: + partTypeStr = MCSTR("multipart/signed"); + break; } result->setObjectForKey(MCSTR("partType"), partTypeStr); @@ -386,5 +390,8 @@ void AbstractPart::importSerializable(HashMap * serializable) else if (value->isEqual(MCSTR("multipart/alternative"))) { setPartType(PartTypeMultipartAlternative); } + else if (value->isEqual(MCSTR("multipart/signed"))) { + setPartType(PartTypeMultipartSigned); + } } } diff --git a/src/core/abstract/MCAddress.cc b/src/core/abstract/MCAddress.cc index ff840691..1ecf08ef 100644 --- a/src/core/abstract/MCAddress.cc +++ b/src/core/abstract/MCAddress.cc @@ -84,7 +84,7 @@ Address * Address::addressWithIMAPAddress(struct mailimap_address * imap_addr) else { addr = imap_addr->ad_mailbox_name; } - mailbox = String::stringWithUTF8Characters(addr); + mailbox = String::stringByDecodingMIMEHeaderValue(addr); if (mailbox == NULL) { mailbox = MCSTR(""); } diff --git a/src/core/abstract/MCMessageConstants.h b/src/core/abstract/MCMessageConstants.h index 42d7c332..145d9917 100644 --- a/src/core/abstract/MCMessageConstants.h +++ b/src/core/abstract/MCMessageConstants.h @@ -178,6 +178,7 @@ namespace mailcore { IMAPSearchKindRecipient, // Recipient is the combination of To, Cc and Bcc IMAPSearchKindSubject, IMAPSearchKindContent, + IMAPSearchKindBody, IMAPSearchKindUIDs, IMAPSearchKindHeader, IMAPSearchKindRead, @@ -255,6 +256,7 @@ namespace mailcore { PartTypeMultipartMixed, PartTypeMultipartRelated, PartTypeMultipartAlternative, + PartTypeMultipartSigned, }; // Private type - It should not be used directly. diff --git a/src/core/abstract/MCMessageHeader.cc b/src/core/abstract/MCMessageHeader.cc index 6d2d8066..6e8d2c09 100644 --- a/src/core/abstract/MCMessageHeader.cc +++ b/src/core/abstract/MCMessageHeader.cc @@ -28,7 +28,10 @@ MessageHeader::MessageHeader() MessageHeader::MessageHeader(MessageHeader * other) { init(false, other->mMessageID == NULL); - setMessageID(other->mMessageID); + if (other->mMessageID != NULL) { + setMessageID(other->mMessageID); + mMessageIDAutoGenerated = other->isMessageIDAutoGenerated(); + } setReferences(other->mReferences); setInReplyTo(other->mInReplyTo); setSender(other->mSender); @@ -46,6 +49,7 @@ MessageHeader::MessageHeader(MessageHeader * other) void MessageHeader::init(bool generateDate, bool generateMessageID) { mMessageID = NULL; + mMessageIDAutoGenerated = false; mReferences = NULL; mInReplyTo = NULL; mSender = NULL; @@ -94,6 +98,8 @@ void MessageHeader::init(bool generateDate, bool generateMessageID) messageID->appendString(hostname); setMessageID(messageID); messageID->release(); + + mMessageIDAutoGenerated = true; } } @@ -165,6 +171,7 @@ Object * MessageHeader::copy() void MessageHeader::setMessageID(String * messageID) { MC_SAFE_REPLACE_COPY(String, mMessageID, messageID); + mMessageIDAutoGenerated = false; } String * MessageHeader::messageID() @@ -172,6 +179,11 @@ String * MessageHeader::messageID() return mMessageID; } +bool MessageHeader::isMessageIDAutoGenerated() +{ + return mMessageIDAutoGenerated; +} + void MessageHeader::setReferences(Array * references) { MC_SAFE_REPLACE_COPY(Array, mReferences, references); @@ -1211,6 +1223,9 @@ HashMap * MessageHeader::serializable() if (messageID() != NULL) { result->setObjectForKey(MCSTR("messageID"), messageID()); } + if (mMessageIDAutoGenerated) { + result->setObjectForKey(MCSTR("messageIDAutoGenerated"), Value::valueWithBoolValue(true)); + } if (references() != NULL) { result->setObjectForKey(MCSTR("references"), references()); } @@ -1250,6 +1265,10 @@ HashMap * MessageHeader::serializable() void MessageHeader::importSerializable(HashMap * hashmap) { setMessageID((String *) hashmap->objectForKey(MCSTR("messageID"))); + + Value * value = (Value *)hashmap->objectForKey(MCSTR("messageIDAutoGenerated")); + mMessageIDAutoGenerated = value != NULL && value->boolValue(); + setReferences((Array *) hashmap->objectForKey(MCSTR("references"))); setInReplyTo((Array *) hashmap->objectForKey(MCSTR("inReplyTo"))); setSender((Address *) Object::objectWithSerializable((HashMap *) hashmap->objectForKey(MCSTR("sender")))); diff --git a/src/core/abstract/MCMessageHeader.h b/src/core/abstract/MCMessageHeader.h index 4fef0b7f..51b1e2f7 100644 --- a/src/core/abstract/MCMessageHeader.h +++ b/src/core/abstract/MCMessageHeader.h @@ -19,6 +19,8 @@ namespace mailcore { virtual void setMessageID(String * messageID); virtual String * messageID(); + virtual bool isMessageIDAutoGenerated(); + virtual void setReferences(Array * /* String */ references); virtual Array * /* String */ references(); @@ -84,6 +86,7 @@ namespace mailcore { private: String * mMessageID; + bool mMessageIDAutoGenerated; Array * /* String */ mReferences; Array * /* String */ mInReplyTo; Address * mSender; diff --git a/src/core/basetypes/MCLibetpanTypes.h b/src/core/basetypes/MCLibetpanTypes.h index e2027804..fcb8e70a 100644 --- a/src/core/basetypes/MCLibetpanTypes.h +++ b/src/core/basetypes/MCLibetpanTypes.h @@ -37,6 +37,7 @@ extern "C" { struct mailimap_envelope; typedef struct mailpop3 mailpop3; typedef struct mailsmtp mailsmtp; + typedef struct newsnntp newsnntp; struct mailsem; #ifdef __cplusplus } diff --git a/src/core/basetypes/MCObject.cc b/src/core/basetypes/MCObject.cc index 0e8d9639..1d8f0c27 100644 --- a/src/core/basetypes/MCObject.cc +++ b/src/core/basetypes/MCObject.cc @@ -130,6 +130,7 @@ struct mainThreadCallData { static pthread_once_t delayedPerformOnce = PTHREAD_ONCE_INIT; static chash * delayedPerformHash = NULL; +static pthread_mutex_t delayedPerformLock = PTHREAD_MUTEX_INITIALIZER; static void reallyInitDelayedPerform() { @@ -164,7 +165,9 @@ static void removeFromPerformHash(Object * obj, Object::Method method, void * co key.data = &keyData; key.len = sizeof(keyData); + pthread_mutex_lock(&delayedPerformLock); chash_delete(delayedPerformHash, (chashdatum *) &key, NULL); + pthread_mutex_unlock(&delayedPerformLock); } static void queueIdentifierDestructor(void * identifier) @@ -196,7 +199,9 @@ static void addToPerformHash(Object * obj, Object::Method method, void * context key.len = sizeof(keyData); value.data = performValue; value.len = 0; + pthread_mutex_lock(&delayedPerformLock); chash_set(delayedPerformHash, &key, &value, NULL); + pthread_mutex_unlock(&delayedPerformLock); } static void * getFromPerformHash(Object * obj, Object::Method method, void * context, void * targetDispatchQueue) @@ -221,7 +226,9 @@ static void * getFromPerformHash(Object * obj, Object::Method method, void * con key.data = &keyData; key.len = sizeof(keyData); + pthread_mutex_lock(&delayedPerformLock); r = chash_get(delayedPerformHash, &key, &value); + pthread_mutex_unlock(&delayedPerformLock); if (r < 0) return NULL; diff --git a/src/core/basetypes/MCString.cc b/src/core/basetypes/MCString.cc index 64ec81cc..5c2da323 100644 --- a/src/core/basetypes/MCString.cc +++ b/src/core/basetypes/MCString.cc @@ -761,6 +761,9 @@ String * String::string() String * String::stringWithData(Data * data, const char * charset) { + if (data == NULL) { + return String::string(); + } String * result = NULL; result = new String(data->bytes(), data->length(), charset); result->autorelease(); @@ -807,6 +810,9 @@ String * String::stringWithCharacters(const UChar * characters, unsigned int len void String::appendCharactersLength(const UChar * unicodeCharacters, unsigned int length) { + if (unicodeCharacters == NULL) { + return; + } allocate(mLength + length); u_strncpy(&mUnicodeChars[mLength], unicodeCharacters, length); mLength += length; @@ -815,6 +821,9 @@ void String::appendCharactersLength(const UChar * unicodeCharacters, unsigned in void String::appendString(String * otherString) { + if (otherString == NULL) { + return; + } appendCharactersLength(otherString->unicodeCharacters(), otherString->length()); } @@ -831,8 +840,9 @@ void String::appendUTF8Format(const char * format, ...) void String::appendUTF8CharactersLength(const char * UTF8Characters, unsigned int length) { - if (UTF8Characters == NULL) + if (UTF8Characters == NULL) { return; + } UChar * dest; int32_t destLength; @@ -1124,6 +1134,10 @@ String * String::uppercaseString() void String::appendBytes(const char * bytes, unsigned int length, const char * charset) { + if (bytes == NULL) { + return; + } + #if __APPLE__ CFStringEncoding encoding; if (strcasecmp(charset, "mutf-7") == 0) { diff --git a/src/core/basetypes/MCUtils.h b/src/core/basetypes/MCUtils.h index e1bef841..ad9c4db5 100644 --- a/src/core/basetypes/MCUtils.h +++ b/src/core/basetypes/MCUtils.h @@ -29,7 +29,7 @@ #define MCSTR(str) mailcore::String::uniquedStringWithUTF8Characters("" str "") -#define MCUTF8(str) ((str) != NULL ? (str)->UTF8Characters() : NULL ) +#define MCUTF8(str) MCUTF8DESC(str) #define MCUTF8DESC(obj) ((obj) != NULL ? (obj)->description()->UTF8Characters() : NULL ) #define MCLOCALIZEDSTRING(key) key diff --git a/src/core/imap/MCIMAPMessage.cc b/src/core/imap/MCIMAPMessage.cc index dfb26752..6cb1472c 100644 --- a/src/core/imap/MCIMAPMessage.cc +++ b/src/core/imap/MCIMAPMessage.cc @@ -185,6 +185,7 @@ static AbstractPart * partForPartIDInPart(AbstractPart * part, String * partID) case mailcore::PartTypeMultipartMixed: case mailcore::PartTypeMultipartRelated: case mailcore::PartTypeMultipartAlternative: + case mailcore::PartTypeMultipartSigned: if (partID->isEqual(((IMAPMultipart *) part)->partID())) { return part; } diff --git a/src/core/imap/MCIMAPSearchExpression.cc b/src/core/imap/MCIMAPSearchExpression.cc index cd3ccc2d..b3467e59 100644 --- a/src/core/imap/MCIMAPSearchExpression.cc +++ b/src/core/imap/MCIMAPSearchExpression.cc @@ -154,6 +154,14 @@ IMAPSearchExpression * IMAPSearchExpression::searchContent(String * value) return (IMAPSearchExpression *) expr->autorelease(); } +IMAPSearchExpression * IMAPSearchExpression::searchBody(String * value) +{ + IMAPSearchExpression * expr = new IMAPSearchExpression(); + expr->mKind = IMAPSearchKindBody; + MC_SAFE_REPLACE_COPY(String, expr->mValue, value); + return (IMAPSearchExpression *) expr->autorelease(); +} + IMAPSearchExpression * IMAPSearchExpression::searchUIDs(IndexSet * uids) { IMAPSearchExpression * expr = new IMAPSearchExpression(); diff --git a/src/core/imap/MCIMAPSearchExpression.h b/src/core/imap/MCIMAPSearchExpression.h index a0647216..a6e4833b 100644 --- a/src/core/imap/MCIMAPSearchExpression.h +++ b/src/core/imap/MCIMAPSearchExpression.h @@ -33,6 +33,7 @@ namespace mailcore { static IMAPSearchExpression * searchRecipient(String * value); static IMAPSearchExpression * searchSubject(String * value); static IMAPSearchExpression * searchContent(String * value); + static IMAPSearchExpression * searchBody(String * value); static IMAPSearchExpression * searchHeader(String * header, String * value); static IMAPSearchExpression * searchUIDs(IndexSet * uids); static IMAPSearchExpression * searchRead(); diff --git a/src/core/imap/MCIMAPSession.cc b/src/core/imap/MCIMAPSession.cc index 768b5c98..f6987808 100755 --- a/src/core/imap/MCIMAPSession.cc +++ b/src/core/imap/MCIMAPSession.cc @@ -378,6 +378,7 @@ void IMAPSession::init() mNamespaceEnabled = false; mCompressionEnabled = false; mIsGmail = false; + mAllowsNewPermanentFlags = false; mWelcomeString = NULL; mNeedsMboxMailWorkaround = false; mDefaultNamespace = NULL; @@ -1077,7 +1078,20 @@ void IMAPSession::select(String * folder, ErrorCode * pError) mFirstUnseenUid = 0; } - + if (mImap->imap_selection_info->sel_perm_flags) { + clistiter * cur; + + struct mailimap_flag_perm * perm_flag; + for(cur = clist_end(mImap->imap_selection_info->sel_perm_flags) ; cur != NULL ; + cur = clist_previous(cur)) { + perm_flag = (struct mailimap_flag_perm *)clist_content(cur); + mAllowsNewPermanentFlags = perm_flag->fl_type == MAILIMAP_FLAG_PERM_ALL; + if (mAllowsNewPermanentFlags) { + break; + } + } + } + mModSequenceValue = get_mod_sequence_value(mImap); } @@ -2187,6 +2201,7 @@ IMAPSyncResult * IMAPSession::fetchMessages(String * folder, IMAPMessagesRequest needsGmailLabels = false; needsGmailMessageID = false; needsGmailThreadID = false; + clist * hdrlist = clist_new(); fetch_type = mailimap_fetch_type_new_fetch_att_list_empty(); fetch_att = mailimap_fetch_att_new_uid(); @@ -2214,15 +2229,11 @@ IMAPSyncResult * IMAPSession::fetchMessages(String * folder, IMAPMessagesRequest needsGmailMessageID = true; } if ((requestKind & IMAPMessagesRequestKindFullHeaders) != 0) { - clist * hdrlist; char * header; - struct mailimap_header_list * imap_hdrlist; - struct mailimap_section * section; MCLog("request envelope"); // most important header - hdrlist = clist_new(); header = strdup("Date"); clist_append(hdrlist, header); header = strdup("Subject"); @@ -2243,17 +2254,9 @@ IMAPSyncResult * IMAPSession::fetchMessages(String * folder, IMAPMessagesRequest clist_append(hdrlist, header); header = strdup("In-Reply-To"); clist_append(hdrlist, header); - imap_hdrlist = mailimap_header_list_new(hdrlist); - section = mailimap_section_new_header_fields(imap_hdrlist); - fetch_att = mailimap_fetch_att_new_body_peek_section(section); - mailimap_fetch_type_new_fetch_att_list_add(fetch_type, fetch_att); - needsHeader = true; } if ((requestKind & IMAPMessagesRequestKindHeaders) != 0) { - clist * hdrlist; char * header; - struct mailimap_header_list * imap_hdrlist; - struct mailimap_section * section; MCLog("request envelope"); // envelope @@ -2261,18 +2264,12 @@ IMAPSyncResult * IMAPSession::fetchMessages(String * folder, IMAPMessagesRequest mailimap_fetch_type_new_fetch_att_list_add(fetch_type, fetch_att); // references header - hdrlist = clist_new(); header = strdup("References"); clist_append(hdrlist, header); if ((requestKind & IMAPMessagesRequestKindHeaderSubject) != 0) { header = strdup("Subject"); clist_append(hdrlist, header); } - imap_hdrlist = mailimap_header_list_new(hdrlist); - section = mailimap_section_new_header_fields(imap_hdrlist); - fetch_att = mailimap_fetch_att_new_body_peek_section(section); - mailimap_fetch_type_new_fetch_att_list_add(fetch_type, fetch_att); - needsHeader = true; } if ((requestKind & IMAPMessagesRequestKindSize) != 0) { // message structure @@ -2295,27 +2292,31 @@ IMAPSyncResult * IMAPSession::fetchMessages(String * folder, IMAPMessagesRequest } if ((requestKind & IMAPMessagesRequestKindExtraHeaders) != 0) { // custom header request - clist * hdrlist; char * header; - struct mailimap_header_list * imap_hdrlist; - struct mailimap_section * section; if (extraHeaders && extraHeaders->count() > 0) { - hdrlist = clist_new(); for (unsigned int i = 0; i < extraHeaders->count(); i++) { - String *headerString = (String *)extraHeaders->objectAtIndex(i); + String * headerString = (String *)extraHeaders->objectAtIndex(i); header = strdup(headerString->UTF8Characters()); clist_append(hdrlist, header); } - - imap_hdrlist = mailimap_header_list_new(hdrlist); - section = mailimap_section_new_header_fields(imap_hdrlist); - fetch_att = mailimap_fetch_att_new_body_peek_section(section); - mailimap_fetch_type_new_fetch_att_list_add(fetch_type, fetch_att); - needsHeader = true; } } + if (clist_begin(hdrlist) != NULL) { + struct mailimap_header_list * imap_hdrlist; + struct mailimap_section * section; + + imap_hdrlist = mailimap_header_list_new(hdrlist); + section = mailimap_section_new_header_fields(imap_hdrlist); + fetch_att = mailimap_fetch_att_new_body_peek_section(section); + mailimap_fetch_type_new_fetch_att_list_add(fetch_type, fetch_att); + needsHeader = true; + } + else { + clist_free(hdrlist); + } + struct msg_att_handler_data msg_att_data; memset(&msg_att_data, 0, sizeof(msg_att_data)); @@ -2768,6 +2769,10 @@ static struct mailimap_search_key * searchKeyFromSearchExpression(IMAPSearchExpr { return mailimap_search_key_new_text(strdup(expression->value()->UTF8Characters())); } + case IMAPSearchKindBody: + { + return mailimap_search_key_new_body(strdup(expression->value()->UTF8Characters())); + } case IMAPSearchKindUIDs: { return mailimap_search_key_new_uid(setFromIndexSet(expression->uids())); @@ -3316,7 +3321,7 @@ void IMAPSession::storeFlagsAndCustomFlags(String * folder, IndexSet * uids, IMA return; } - setList = splitSet(imap_set, 10); + setList = splitSet(imap_set, 50); flag_list = mailimap_flag_list_new_empty(); if ((flags & MessageFlagSeen) != 0) { @@ -3707,6 +3712,10 @@ bool IMAPSession::isCompressionEnabled() return mCompressionEnabled; } +bool IMAPSession::allowsNewPermanentFlags() { + return mAllowsNewPermanentFlags; +} + bool IMAPSession::isDisconnected() { return mState == STATE_DISCONNECTED; diff --git a/src/core/imap/MCIMAPSession.h b/src/core/imap/MCIMAPSession.h index e52dc74f..6426fce8 100755 --- a/src/core/imap/MCIMAPSession.h +++ b/src/core/imap/MCIMAPSession.h @@ -167,7 +167,8 @@ namespace mailcore { virtual bool isXOAuthEnabled(); virtual bool isNamespaceEnabled(); virtual bool isCompressionEnabled(); - + virtual bool allowsNewPermanentFlags(); + virtual String * gmailUserDisplayName(); virtual void setConnectionLogger(ConnectionLogger * logger); @@ -227,6 +228,7 @@ namespace mailcore { bool mNamespaceEnabled; bool mCompressionEnabled; bool mIsGmail; + bool mAllowsNewPermanentFlags; String * mWelcomeString; bool mNeedsMboxMailWorkaround; uint32_t mUIDValidity; diff --git a/src/core/nntp/MCNNTP.h b/src/core/nntp/MCNNTP.h new file mode 100644 index 00000000..c2da3a66 --- /dev/null +++ b/src/core/nntp/MCNNTP.h @@ -0,0 +1,9 @@ +#ifndef MAILCORE_MCNNTP_H + +#define MAILCORE_MCNNTP_H + +#include <MailCore/MCNNTPGroupInfo.h> +#include <MailCore/MCNNTPProgressCallback.h> +#include <MailCore/MCNNTPSession.h> + +#endif diff --git a/src/core/nntp/MCNNTPGroupInfo.cc b/src/core/nntp/MCNNTPGroupInfo.cc new file mode 100644 index 00000000..787967f3 --- /dev/null +++ b/src/core/nntp/MCNNTPGroupInfo.cc @@ -0,0 +1,64 @@ +// +// MCNNTPGroupInfo.cpp +// mailcore2 +// +// Created by Robert Widmann on 3/6/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#include "MCNNTPGroupInfo.h" + +using namespace mailcore; + +void NNTPGroupInfo::init() +{ + mMessageCount = 0; +} + +NNTPGroupInfo::NNTPGroupInfo() +{ + init(); +} + + +NNTPGroupInfo::NNTPGroupInfo(NNTPGroupInfo * other) +{ + init(); + setMessageCount(other->messageCount()); + setName(other->name()); +} + +NNTPGroupInfo::~NNTPGroupInfo() +{ +} + +String * NNTPGroupInfo::description() +{ + return String::stringWithUTF8Format("<%s:%p> Group name: %s; Message count: %u", + MCUTF8(className()), this, MCUTF8(mName), mMessageCount); +} + +Object * NNTPGroupInfo::copy() +{ + return new NNTPGroupInfo(this); +} + +void NNTPGroupInfo::setName(String * name) +{ + MC_SAFE_REPLACE_COPY(String, mName, name); +} + +String * NNTPGroupInfo::name() +{ + return mName; +} + +void NNTPGroupInfo::setMessageCount(uint32_t messageCount) +{ + mMessageCount = messageCount; +} + +uint32_t NNTPGroupInfo::messageCount() +{ + return mMessageCount; +}
\ No newline at end of file diff --git a/src/core/nntp/MCNNTPGroupInfo.h b/src/core/nntp/MCNNTPGroupInfo.h new file mode 100644 index 00000000..aeab58ca --- /dev/null +++ b/src/core/nntp/MCNNTPGroupInfo.h @@ -0,0 +1,38 @@ +#ifndef MAILCORE_MCNNTPGROUPINFO_H + +#define MAILCORE_MCNNTPGROUPINFO_H + +#include <MailCore/MCBaseTypes.h> + +#ifdef __cplusplus + +namespace mailcore { + + class NNTPGroupInfo : public Object { + public: + NNTPGroupInfo(); + virtual ~NNTPGroupInfo(); + + virtual void setName(String * uid); + virtual String * name(); + + virtual void setMessageCount(uint32_t messages); + virtual uint32_t messageCount(); + + public: // subclass behavior + NNTPGroupInfo(NNTPGroupInfo * other); + virtual String * description(); + virtual Object * copy(); + + private: + String * mName; + uint32_t mMessageCount; + + void init(); + }; + +} + +#endif + +#endif diff --git a/src/core/nntp/MCNNTPProgressCallback.h b/src/core/nntp/MCNNTPProgressCallback.h new file mode 100644 index 00000000..f863cc0c --- /dev/null +++ b/src/core/nntp/MCNNTPProgressCallback.h @@ -0,0 +1,20 @@ +#ifndef MAILCORE_MCNNTPPROGRESSCALLBACK_H + +#define MAILCORE_MCNNTPPROGRESSCALLBACK_H + +#ifdef __cplusplus + +namespace mailcore { + + class NNTPSession; + + class NNTPProgressCallback { + public: + virtual void bodyProgress(NNTPSession * session, unsigned int current, unsigned int maximum) {}; + }; + +} + +#endif + +#endif diff --git a/src/core/nntp/MCNNTPSession.cc b/src/core/nntp/MCNNTPSession.cc new file mode 100644 index 00000000..02db197e --- /dev/null +++ b/src/core/nntp/MCNNTPSession.cc @@ -0,0 +1,547 @@ +// +// MCNNTPSession.cpp +// mailcore2 +// +// Created by Robert Widmann on 3/6/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#include "MCNNTPSession.h" + +#include <string.h> +#include <libetpan/libetpan.h> + +#include "MCNNTPGroupInfo.h" +#include "MCMessageHeader.h" +#include "MCConnectionLoggerUtils.h" +#include "MCCertificateUtils.h" + +#define NNTP_DEFAULT_PORT 119 +#define NNTPS_DEFAULT_PORT 563 + +using namespace mailcore; + +enum { + STATE_DISCONNECTED, + STATE_CONNECTED, + STATE_LOGGEDIN, + STATE_LISTED, + STATE_SELECTED, +}; + +void NNTPSession::init() +{ + mHostname = NULL; + mPort = NNTP_DEFAULT_PORT; + mUsername = NULL; + mPassword = NULL; + mConnectionType = ConnectionTypeClear; + mCheckCertificateEnabled = true; + mTimeout = 30; + + mNNTP = NULL; + mState = STATE_DISCONNECTED; + mConnectionLogger = NULL; +} + +NNTPSession::NNTPSession() +{ + init(); +} + +NNTPSession::~NNTPSession() +{ + MC_SAFE_RELEASE(mHostname); + MC_SAFE_RELEASE(mUsername); + MC_SAFE_RELEASE(mPassword); +} + +void NNTPSession::setHostname(String * hostname) +{ + MC_SAFE_REPLACE_COPY(String, mHostname, hostname); +} + +String * NNTPSession::hostname() +{ + return mHostname; +} + +void NNTPSession::setPort(unsigned int port) +{ + mPort = port; +} + +unsigned int NNTPSession::port() +{ + return mPort; +} + +void NNTPSession::setUsername(String * username) +{ + MC_SAFE_REPLACE_COPY(String, mUsername, username); +} + +String * NNTPSession::username() +{ + return mUsername; +} + +void NNTPSession::setPassword(String * password) +{ + MC_SAFE_REPLACE_COPY(String, mPassword, password); +} + +String * NNTPSession::password() +{ + return mPassword; +} + +void NNTPSession::setConnectionType(ConnectionType connectionType) +{ + mConnectionType = connectionType; +} + +ConnectionType NNTPSession::connectionType() +{ + return mConnectionType; +} + +void NNTPSession::setTimeout(time_t timeout) +{ + mTimeout = timeout; +} + +time_t NNTPSession::timeout() +{ + return mTimeout; +} + +void NNTPSession::setCheckCertificateEnabled(bool enabled) +{ + mCheckCertificateEnabled = enabled; +} + +bool NNTPSession::isCheckCertificateEnabled() +{ + return mCheckCertificateEnabled; +} + +bool NNTPSession::checkCertificate() +{ + if (!isCheckCertificateEnabled()) + return true; + return mailcore::checkCertificate(mNNTP->nntp_stream, hostname()); +} + +static void logger(newsnntp * nntp, int log_type, const char * buffer, size_t size, void * context) +{ + NNTPSession * session = (NNTPSession *) context; + + if (session->connectionLogger() == NULL) + return; + + ConnectionLogType type = getConnectionType(log_type); + bool isBuffer = isBufferFromLogType(log_type); + + if (isBuffer) { + Data * data = Data::dataWithBytes(buffer, (unsigned int) size); + session->connectionLogger()->log(session, type, data); + } + else { + session->connectionLogger()->log(session, type, NULL); + } +} + + +void NNTPSession::setup() +{ + mNNTP = newsnntp_new(0, NULL); + newsnntp_set_logger(mNNTP, logger, this); +} + +void NNTPSession::unsetup() +{ + if (mNNTP != NULL) { + if (mNNTP->nntp_stream != NULL) { + mailstream_close(mNNTP->nntp_stream); + mNNTP->nntp_stream = NULL; + } + newsnntp_free(mNNTP); + mNNTP = NULL; + } +} + +void NNTPSession::loginIfNeeded(ErrorCode * pError) +{ + connectIfNeeded(pError); + if (* pError != ErrorNone) { + return; + } + + if (mState == STATE_CONNECTED) { + login(pError); + } + else { + * pError = ErrorNone; + } +} + +void NNTPSession::readerIfNeeded(ErrorCode * pError) +{ + connectIfNeeded(pError); + if (* pError != ErrorNone) + return; + + if (mState == STATE_CONNECTED) { + newsnntp_mode_reader(mNNTP); + } + else { + * pError = ErrorNone; + } +} + +void NNTPSession::login(ErrorCode * pError) +{ + int r; + + if (mUsername != NULL) { + r = newsnntp_authinfo_username(mNNTP, mUsername->UTF8Characters()); + if (r == NEWSNNTP_ERROR_STREAM) { + * pError = ErrorConnection; + return; + } + else if (r != NEWSNNTP_NO_ERROR) { + * pError = ErrorAuthentication; + return; + } + } + if (mPassword != NULL) { + r = newsnntp_authinfo_password(mNNTP, mPassword->UTF8Characters()); + if (r == NEWSNNTP_ERROR_STREAM) { + * pError = ErrorConnection; + return; + } + else if (r != NEWSNNTP_NO_ERROR) { + * pError = ErrorAuthentication; + return; + } + } + + mState = STATE_LOGGEDIN; + * pError = ErrorNone; +} + +void NNTPSession::connect(ErrorCode * pError) +{ + int r; + + setup(); + + switch (mConnectionType) { + case ConnectionTypeStartTLS: + MCLog("connect %s %u", MCUTF8(hostname()), (unsigned int) port()); + r = newsnntp_socket_connect(mNNTP, MCUTF8(hostname()), port()); + if (r != NEWSNNTP_NO_ERROR) { + * pError = ErrorConnection; + return; + } + MCLog("done"); + if (!checkCertificate()) { + * pError = ErrorCertificate; + return; + } + break; + + case ConnectionTypeTLS: + MCLog("connect %s %u", MCUTF8(hostname()), (unsigned int) port()); + r = newsnntp_ssl_connect(mNNTP, MCUTF8(hostname()), port()); + if (r != NEWSNNTP_NO_ERROR) { + * pError = ErrorConnection; + return; + } + if (!checkCertificate()) { + * pError = ErrorCertificate; + return; + } + break; + + default: + r = newsnntp_socket_connect(mNNTP, MCUTF8(hostname()), port()); + if (r != NEWSNNTP_NO_ERROR) { + * pError = ErrorConnection; + return; + } + break; + } + + mailstream_low * low; + String * identifierString; + char * identifier; + + low = mailstream_get_low(mNNTP->nntp_stream); + if (mUsername != NULL) { + identifierString = String::stringWithUTF8Format("%s@%s:%u", MCUTF8(mUsername), MCUTF8(mHostname), mPort); + } + else { + identifierString = String::stringWithUTF8Format("%s:%u", MCUTF8(mUsername), mPort); + } + identifier = strdup(identifierString->UTF8Characters()); + mailstream_low_set_identifier(low, identifier); + mState = STATE_CONNECTED; + * pError = ErrorNone; +} + +void NNTPSession::connectIfNeeded(ErrorCode * pError) +{ + if (mState == STATE_DISCONNECTED) { + connect(pError); + } + else { + * pError = ErrorNone; + } +} + +void NNTPSession::disconnect() +{ + if (mNNTP == NULL) + return; + + newsnntp_quit(mNNTP); + mState = STATE_DISCONNECTED; + unsetup(); +} + +void NNTPSession::checkAccount(ErrorCode * pError) +{ + loginIfNeeded(pError); +} + +Array * NNTPSession::listAllNewsgroups(ErrorCode * pError) +{ + int r; + clist * grp_list; + + loginIfNeeded(pError); + if (* pError != ErrorNone) { + return NULL; + } + + r = newsnntp_list(mNNTP, &grp_list); + if (r == NEWSNNTP_ERROR_STREAM) { + * pError = ErrorConnection; + return NULL; + } + else if (r != NEWSNNTP_NO_ERROR) { + * pError = ErrorFetchMessageList; + return NULL; + } + + Array * result = Array::array(); + clistiter * iter; + for(iter = clist_begin(grp_list) ;iter != NULL ; iter = clist_next(iter)) { + struct newsnntp_group_info * grp_info; + String * name; + + grp_info = (struct newsnntp_group_info *) clist_content(iter); + + name = String::stringWithUTF8Characters(grp_info->grp_name); + + NNTPGroupInfo * info = new NNTPGroupInfo(); + info->setName(name); + result->addObject(info); + info->release(); + } + + newsnntp_list_free(grp_list); + * pError = ErrorNone; + mState = STATE_LISTED; + + return result; +} + +Array * NNTPSession::listSubscribedNewsgroups(ErrorCode * pError) +{ + int r; + clist * subd_groups; + + MCLog("fetch subscribed"); + loginIfNeeded(pError); + if (* pError != ErrorNone) + return NULL; + + r = newsnntp_list_subscriptions(mNNTP, &subd_groups); + MCLog("fetch subscribed %u", r); + + Array * result = Array::array(); + clistiter * iter; + for(iter = clist_begin(subd_groups) ;iter != NULL ; iter = clist_next(iter)) { + struct newsnntp_group_info * grp_info; + String * name; + + grp_info = (struct newsnntp_group_info *) clist_content(iter); + + name = String::stringWithUTF8Characters(strdup(grp_info->grp_name)); + name->retain(); + + NNTPGroupInfo * info = new NNTPGroupInfo(); + info->setName(name); + result->addObject(info); + info->release(); + } + newsnntp_list_subscriptions_free(subd_groups); + * pError = ErrorNone; + + return result; +} + +MessageHeader * NNTPSession::fetchHeader(String *groupName, unsigned int index, ErrorCode * pError) +{ + int r; + char * content; + size_t content_len; + + MCLog("fetch header at index %u", index); + loginIfNeeded(pError); + if (* pError != ErrorNone) { + return NULL; + } + + selectGroup(groupName, pError); + if (* pError != ErrorNone) { + return NULL; + } + + r = newsnntp_head(mNNTP, index, &content, &content_len); + if (r != NEWSNNTP_NO_ERROR) { + * pError = ErrorFetchMessageList; + return NULL; + } + + Data * data; + data = new Data(content, (unsigned int) content_len); + MessageHeader * result = new MessageHeader(); + result->importHeadersData(data); + result->autorelease(); + data->release(); + + newsnntp_head_free(content); + * pError = ErrorNone; + + return result; +} + +Data * NNTPSession::fetchArticle(String *groupName, unsigned int index, NNTPProgressCallback * callback, ErrorCode * pError) +{ + int r; + char * content; + size_t content_len; + + MCLog("fetch article at index %u", index); + + loginIfNeeded(pError); + if (* pError != ErrorNone) { + return NULL; + } + + selectGroup(groupName, pError); + if (* pError != ErrorNone) { + return NULL; + } + + r = newsnntp_article(mNNTP, index, &content, &content_len); + if (r == NEWSNNTP_ERROR_STREAM) { + * pError = ErrorConnection; + return NULL; + } + else if (r != NEWSNNTP_NO_ERROR) { + * pError = ErrorFetchMessageList; + return NULL; + } + + Data * result; + result = Data::dataWithBytes(content, (unsigned int) content_len); + newsnntp_article_free(content); + * pError = ErrorNone; + + return result; +} + +IndexSet * NNTPSession::fetchArticles(String * groupName, ErrorCode * pError) +{ + int r; + clist * msg_list; + + selectGroup(groupName, pError); + if (* pError != ErrorNone) { + return NULL; + } + + r = newsnntp_listgroup(mNNTP, groupName->UTF8Characters(), &msg_list); + if (r == NEWSNNTP_ERROR_STREAM) { + * pError = ErrorConnection; + return NULL; + } + else if (r != NEWSNNTP_NO_ERROR) { + * pError = ErrorFetchMessageList; + return NULL; + } + + IndexSet * result = new IndexSet(); + clistiter * iter; + for(iter = clist_begin(msg_list) ;iter != NULL ; iter = clist_next(iter)) { + uint32_t *msg_info; + + msg_info = (uint32_t *) clist_content(iter); + if (!msg_info) { + continue; + } + + result->addIndex(*msg_info); + } + + newsnntp_listgroup_free(msg_list); + * pError = ErrorNone; + mState = STATE_LISTED; + + return result; +} + +void NNTPSession::selectGroup(String * folder, ErrorCode * pError) +{ + int r; + struct newsnntp_group_info * info; + + readerIfNeeded(pError); + if (* pError != ErrorNone) { + return; + } + + r = newsnntp_group(mNNTP, folder->UTF8Characters(), &info); + if (r == NEWSNNTP_ERROR_STREAM) { + * pError = ErrorConnection; + MCLog("select error : %s %i", MCUTF8DESC(this), * pError); + return; + } + else if (r == NEWSNNTP_ERROR_NO_SUCH_NEWS_GROUP) { + * pError = ErrorNonExistantFolder; + return; + } + else if (r == MAILIMAP_ERROR_PARSE) { + * pError = ErrorParse; + return; + } + + mState = STATE_SELECTED; + * pError = ErrorNone; + MCLog("select ok"); +} + +void NNTPSession::setConnectionLogger(ConnectionLogger * logger) +{ + mConnectionLogger = logger; +} + +ConnectionLogger * NNTPSession::connectionLogger() +{ + return mConnectionLogger; +} diff --git a/src/core/nntp/MCNNTPSession.h b/src/core/nntp/MCNNTPSession.h new file mode 100644 index 00000000..a6fb511c --- /dev/null +++ b/src/core/nntp/MCNNTPSession.h @@ -0,0 +1,88 @@ +#ifndef MAILCORE_MCNNTPSESSION_H +#define MAILCORE_MCNNTPSESSION_H + +#include <MailCore/MCBaseTypes.h> +#include <MailCore/MCMessageConstants.h> + +#ifdef __cplusplus + +namespace mailcore { + + class NNTPProgressCallback; + class MessageHeader; + + class NNTPSession : public Object { + public: + NNTPSession(); + virtual ~NNTPSession(); + + virtual void setHostname(String * hostname); + virtual String * hostname(); + + virtual void setPort(unsigned int port); + virtual unsigned int port(); + + virtual void setUsername(String * username); + virtual String * username(); + + virtual void setPassword(String * password); + virtual String * password(); + + virtual void setConnectionType(ConnectionType connectionType); + virtual ConnectionType connectionType(); + + virtual void setTimeout(time_t timeout); + virtual time_t timeout(); + + virtual void setCheckCertificateEnabled(bool enabled); + virtual bool isCheckCertificateEnabled(); + + virtual void connect(ErrorCode * pError); + virtual void disconnect(); + + virtual void login(ErrorCode * pError); + + virtual void checkAccount(ErrorCode * pError); + + virtual Array * /* NNTPGroupInfo */ listAllNewsgroups(ErrorCode * pError); + virtual Array * listSubscribedNewsgroups(ErrorCode * pError); + + virtual MessageHeader * fetchHeader(String *groupName, unsigned int index, ErrorCode * pError); + + virtual IndexSet * fetchArticles(String * groupname, ErrorCode * pError); + + Data * fetchArticle(String *groupName, unsigned int index, NNTPProgressCallback * callback, ErrorCode * pError); + + virtual void setConnectionLogger(ConnectionLogger * logger); + virtual ConnectionLogger * connectionLogger(); + + private: + String * mHostname; + unsigned int mPort; + String * mUsername; + String * mPassword; + ConnectionType mConnectionType; + bool mCheckCertificateEnabled; + time_t mTimeout; + + newsnntp * mNNTP; + int mState; + + ConnectionLogger * mConnectionLogger; + + void init(); + bool checkCertificate(); + void setup(); + void unsetup(); + void connectIfNeeded(ErrorCode * pError); + void loginIfNeeded(ErrorCode * pError); + void readerIfNeeded(ErrorCode * pError); + void listIfNeeded(ErrorCode * pError); + void selectGroup(String * folder, ErrorCode * pError); + }; + +} + +#endif + +#endif diff --git a/src/core/pop/MCPOPSession.cc b/src/core/pop/MCPOPSession.cc index 0d26682e..b703f16d 100644 --- a/src/core/pop/MCPOPSession.cc +++ b/src/core/pop/MCPOPSession.cc @@ -241,7 +241,7 @@ void POPSession::connect(ErrorCode * pError) default: r = mailpop3_socket_connect(mPop, MCUTF8(hostname()), port()); - if (r != MAILIMAP_NO_ERROR) { + if (r != MAILPOP3_NO_ERROR) { * pError = ErrorConnection; return; } diff --git a/src/core/renderer/MCDateFormatter.cc b/src/core/renderer/MCDateFormatter.cc index 2882977d..96d347d5 100644 --- a/src/core/renderer/MCDateFormatter.cc +++ b/src/core/renderer/MCDateFormatter.cc @@ -216,6 +216,12 @@ void DateFormatter::prepare() localeRef = CFLocaleCopyCurrent(); } mAppleDateFormatter = CFDateFormatterCreate(NULL, localeRef, toAppleStyle(mDateStyle), toAppleStyle(mTimeStyle)); + if (mDateFormat != NULL) { + CFStringRef dateFormatCFString = CFStringCreateWithCharacters(NULL, (const UniChar *) mDateFormat->unicodeCharacters(), + mDateFormat->length()); + CFDateFormatterSetFormat((CFDateFormatterRef) mAppleDateFormatter, dateFormatCFString); + CFRelease(dateFormatCFString); + } if (localeIdentifier != NULL) { CFRelease(localeIdentifier); } diff --git a/src/core/renderer/MCHTMLRenderer.cc b/src/core/renderer/MCHTMLRenderer.cc index bbc0d591..568c939e 100644 --- a/src/core/renderer/MCHTMLRenderer.cc +++ b/src/core/renderer/MCHTMLRenderer.cc @@ -147,6 +147,7 @@ static bool partContainsMimeType(AbstractPart * part, String * mimeType) case PartTypeMultipartMixed: case PartTypeMultipartRelated: case PartTypeMultipartAlternative: + case PartTypeMultipartSigned: return multipartContainsMimeType((AbstractMultipart *) part, mimeType); default: return false; @@ -254,6 +255,8 @@ static String * htmlForAbstractPart(AbstractPart * part, htmlRendererContext * c return htmlForAbstractMultipartRelated((AbstractMultipart *) part, context); case PartTypeMultipartAlternative: return htmlForAbstractMultipartAlternative((AbstractMultipart *) part, context); + case PartTypeMultipartSigned: + return htmlForAbstractMultipartMixed((AbstractMultipart *) part, context); default: MCAssert(0); } @@ -310,7 +313,7 @@ static String * htmlForAbstractSinglePart(AbstractPart * part, htmlRendererConte return NULL; String * str = data->stringWithDetectedCharset(charset, true); - str = str->cleanedHTMLString(); + str = context->htmlCallback->cleanHTMLForPart(str); str = context->htmlCallback->filterHTMLForPart(str); context->firstRendered = true; return str; @@ -404,8 +407,27 @@ String * htmlForAbstractMultipartAlternative(AbstractMultipart * part, htmlRende AbstractPart * preferredAlternative = preferredPartInMultipartAlternative(part); if (preferredAlternative == NULL) return MCSTR(""); + + // Exchange sends calendar invitation as alternative part. We need to extract it. + AbstractPart * calendar = NULL; + for(unsigned int i = 0 ; i < part->parts()->count() ; i ++) { + AbstractPart * subpart = (AbstractPart *) part->parts()->objectAtIndex(i); + if (partContainsMimeType(subpart, MCSTR("text/calendar"))) { + calendar = subpart; + } + } + + String * html = htmlForAbstractPart(preferredAlternative, context); + if (html == NULL) { + return NULL; + } - return htmlForAbstractPart(preferredAlternative, context); + String * result = String::string(); + result->appendString(html); + if (calendar != NULL) { + result->appendString(htmlForAbstractPart(calendar, context)); + } + return result; } static String * htmlForAbstractMultipartMixed(AbstractMultipart * part, htmlRendererContext * context) diff --git a/src/core/renderer/MCHTMLRendererCallback.cc b/src/core/renderer/MCHTMLRendererCallback.cc index 1028118e..93c0a409 100644 --- a/src/core/renderer/MCHTMLRendererCallback.cc +++ b/src/core/renderer/MCHTMLRendererCallback.cc @@ -248,6 +248,11 @@ mailcore::String * HTMLRendererTemplateCallback::filterHTMLForMessage(mailcore:: return html; } +mailcore::String * HTMLRendererTemplateCallback::cleanHTMLForPart(mailcore::String * html) +{ + return html->cleanedHTMLString(); +} + mailcore::String * HTMLRendererTemplateCallback::filterHTMLForPart(mailcore::String * html) { return html; diff --git a/src/core/renderer/MCHTMLRendererCallback.h b/src/core/renderer/MCHTMLRendererCallback.h index 5a7c28a9..030b691f 100644 --- a/src/core/renderer/MCHTMLRendererCallback.h +++ b/src/core/renderer/MCHTMLRendererCallback.h @@ -45,6 +45,8 @@ namespace mailcore { virtual String * templateForEmbeddedMessageHeader(MessageHeader * header); virtual String * templateForAttachmentSeparator(); + virtual String * cleanHTMLForPart(String * html); + // Can be used to filter some HTML tags. virtual String * filterHTMLForPart(String * html); diff --git a/src/core/rfc822/MCAttachment.cc b/src/core/rfc822/MCAttachment.cc index 331d7d28..172881cb 100644 --- a/src/core/rfc822/MCAttachment.cc +++ b/src/core/rfc822/MCAttachment.cc @@ -211,6 +211,8 @@ Attachment * Attachment::attachmentWithText(String * text) void Attachment::init() { mData = NULL; + mContentTypeParameters = NULL; + mlcContentTypeParameters = NULL; setMimeType(MCSTR("application/octet-stream")); } @@ -223,11 +225,14 @@ Attachment::Attachment(Attachment * other) : AbstractPart(other) { init(); MC_SAFE_REPLACE_RETAIN(Data, mData, other->mData); + setContentTypeParameters(other->mContentTypeParameters); } Attachment::~Attachment() { MC_SAFE_RELEASE(mData); + MC_SAFE_RELEASE(mContentTypeParameters); + MC_SAFE_RELEASE(mlcContentTypeParameters); } String * Attachment::description() @@ -256,6 +261,11 @@ String * Attachment::description() else { result->appendUTF8Format("no data\n"); } + if (mContentTypeParameters != NULL) { + mc_foreachhashmapKeyAndValue(String, key, String, value, mContentTypeParameters) { + result->appendUTF8Format("%s: %s\n", key->UTF8Characters(), value->UTF8Characters()); + } + } result->appendUTF8Format(">"); return result; @@ -286,6 +296,55 @@ String * Attachment::decodedString() } } +void Attachment::setContentTypeParameters(HashMap * parameters) +{ + MC_SAFE_REPLACE_COPY(HashMap, mContentTypeParameters, parameters); + MC_SAFE_RELEASE(mlcContentTypeParameters); + if (mContentTypeParameters != NULL) { + mlcContentTypeParameters = new HashMap(); + mc_foreachhashmapKeyAndValue(String, key, String, value, mContentTypeParameters) { + mlcContentTypeParameters->setObjectForKey(key->lowercaseString(), value); + } + } +} + +Array * Attachment::allContentTypeParametersNames() +{ + if (mContentTypeParameters == NULL) + return Array::array(); + return mContentTypeParameters->allKeys(); +} + +void Attachment::setContentTypeParameter(String * name, String * object) +{ + if (mContentTypeParameters == NULL) { + mContentTypeParameters = new HashMap(); + } + if (mlcContentTypeParameters == NULL) { + mlcContentTypeParameters = new HashMap(); + } + if (object == NULL) { + removeContentTypeParameter(name); + return; + } + mContentTypeParameters->setObjectForKey(name, object); + mlcContentTypeParameters->setObjectForKey(name->lowercaseString(), object); +} + +void Attachment::removeContentTypeParameter(String * name) +{ + if (mContentTypeParameters == NULL) + return; + mContentTypeParameters->removeObjectForKey(name); + mlcContentTypeParameters->removeObjectForKey(name); +} + +String * Attachment::contentTypeParameterValueForName(String * name) +{ + if (mlcContentTypeParameters == NULL) + return NULL; + return (String *) mlcContentTypeParameters->objectForKey(name->lowercaseString()); +} AbstractPart * Attachment::attachmentsWithMIME(struct mailmime * mime) { @@ -341,6 +400,14 @@ AbstractPart * Attachment::attachmentsWithMIMEWithMain(struct mailmime * mime, b fillMultipartSubAttachments(attachment, mime); return (Multipart *) attachment->autorelease(); } + else if ((mime->mm_content_type != NULL) && (mime->mm_content_type->ct_subtype != NULL) && + (strcasecmp(mime->mm_content_type->ct_subtype, "signed") == 0)) { + Multipart * attachment; + attachment = new Multipart(); + attachment->setPartType(PartTypeMultipartSigned); + fillMultipartSubAttachments(attachment, mime); + return (Multipart *) attachment->autorelease(); + } else { Multipart * attachment; attachment = new Multipart(); @@ -495,6 +562,7 @@ Attachment * Attachment::attachmentWithSingleMIME(struct mailmime * mime) char * description; char * loc; Encoding encoding; + clist * ct_parameters; MCAssert(mime->mm_type == MAILMIME_SINGLE); @@ -523,6 +591,7 @@ Attachment * Attachment::attachmentWithSingleMIME(struct mailmime * mime) content_id = single_fields.fld_id; description = single_fields.fld_description; loc = single_fields.fld_location; + ct_parameters = single_fields.fld_content->ct_parameters; if (filename != NULL) { result->setFilename(String::stringByDecodingMIMEHeaderValue(filename)); @@ -543,6 +612,18 @@ Attachment * Attachment::attachmentWithSingleMIME(struct mailmime * mime) result->setContentLocation(String::stringWithUTF8Characters(loc)); } + if (ct_parameters != NULL) { + clistiter * iter = clist_begin(ct_parameters); + struct mailmime_parameter * param; + while (iter != NULL) { + param = (struct mailmime_parameter *) clist_content(iter); + if (param != NULL) { + result->setContentTypeParameter(String::stringWithUTF8Characters(param->pa_name), String::stringWithUTF8Characters(param->pa_value)); + } + iter = clist_next(iter); + } + } + if (single_fields.fld_disposition != NULL) { if (single_fields.fld_disposition->dsp_type != NULL) { if (single_fields.fld_disposition->dsp_type->dsp_type == MAILMIME_DISPOSITION_TYPE_INLINE) { diff --git a/src/core/rfc822/MCAttachment.h b/src/core/rfc822/MCAttachment.h index 7dd15b89..069688f2 100644 --- a/src/core/rfc822/MCAttachment.h +++ b/src/core/rfc822/MCAttachment.h @@ -29,6 +29,11 @@ namespace mailcore { virtual Data * data(); virtual String * decodedString(); + virtual void setContentTypeParameter(String * name, String * value); + virtual void removeContentTypeParameter(String * name); + virtual String * contentTypeParameterValueForName(String *name); + virtual Array * allContentTypeParametersNames(); + public: // subclass behavior Attachment(Attachment * other); virtual String * description(); @@ -39,6 +44,8 @@ namespace mailcore { private: Data * mData; + HashMap * mContentTypeParameters; + HashMap * mlcContentTypeParameters; void init(); static void fillMultipartSubAttachments(AbstractMultipart * multipart, struct mailmime * mime); static AbstractPart * attachmentsWithMIMEWithMain(struct mailmime * mime, bool isMain); @@ -46,6 +53,7 @@ namespace mailcore { static MessagePart * attachmentWithMessageMIME(struct mailmime * mime); static Encoding encodingForMIMEEncoding(struct mailmime_mechanism * mechanism, int defaultMimeEncoding); static HashMap * readMimeTypesFile(String * filename); + void setContentTypeParameters(HashMap * parameters); }; } diff --git a/src/core/rfc822/MCMessageBuilder.cc b/src/core/rfc822/MCMessageBuilder.cc index cd87009e..3e63ce4a 100644 --- a/src/core/rfc822/MCMessageBuilder.cc +++ b/src/core/rfc822/MCMessageBuilder.cc @@ -134,7 +134,7 @@ err: static struct mailmime * get_text_part(const char * mime_type, const char * charset, const char * content_id, const char * description, - const char * text, size_t length, int encoding_type) + const char * text, size_t length, int encoding_type, clist * contentTypeParameters) { struct mailmime_fields * mime_fields; struct mailmime * mime; @@ -165,6 +165,10 @@ static struct mailmime * get_text_part(const char * mime_type, const char * char param = mailmime_param_new_with_data((char *) "charset", (char *) charset); } clist_append(content->ct_parameters, param); + if (contentTypeParameters != NULL) { + clist_concat(content->ct_parameters, contentTypeParameters); + } + mime = part_new_empty(content, mime_fields, NULL, 1); mailmime_set_body_text(mime, (char *) text, length); @@ -173,7 +177,7 @@ static struct mailmime * get_text_part(const char * mime_type, const char * char static struct mailmime * get_plain_text_part(const char * mime_type, const char * charset, const char * content_id, const char * description, - const char * text, size_t length) + const char * text, size_t length, clist * contentTypeParameters) { bool needsQuotedPrintable; int mechanism; @@ -189,20 +193,20 @@ static struct mailmime * get_plain_text_part(const char * mime_type, const char if (needsQuotedPrintable) { mechanism = MAILMIME_MECHANISM_QUOTED_PRINTABLE; } - return get_text_part(mime_type, charset, content_id, description, text, length, mechanism); + return get_text_part(mime_type, charset, content_id, description, text, length, mechanism, contentTypeParameters); } static struct mailmime * get_other_text_part(const char * mime_type, const char * charset, const char * content_id, const char * description, - const char * text, size_t length) + const char * text, size_t length, clist * contentTypeParameters) { - return get_text_part(mime_type, charset, content_id, description, text, length, MAILMIME_MECHANISM_QUOTED_PRINTABLE); + return get_text_part(mime_type, charset, content_id, description, text, length, MAILMIME_MECHANISM_QUOTED_PRINTABLE, contentTypeParameters); } static struct mailmime * get_file_part(const char * filename, const char * mime_type, int is_inline, const char * content_id, const char * content_description, - const char * text, size_t length) + const char * text, size_t length, clist * contentTypeParameters) { char * disposition_name; int encoding_type; @@ -238,6 +242,11 @@ static struct mailmime * get_file_part(const char * filename, const char * mime_ dup_content_description = strdup(content_description); mime_fields = mailmime_fields_new_with_data(encoding, dup_content_id, dup_content_description, disposition, NULL); + + if (contentTypeParameters != NULL) { + clist_concat(content->ct_parameters, contentTypeParameters); + } + mime = part_new_empty(content, mime_fields, NULL, 1); mailmime_set_body_text(mime, (char *) text, length); @@ -246,6 +255,23 @@ static struct mailmime * get_file_part(const char * filename, const char * mime_ #define MIME_ENCODED_STR(str) (str != NULL ? str->encodedMIMEHeaderValue()->bytes() : NULL) +static clist * content_type_parameters_from_attachment(Attachment * att) +{ + clist * contentTypeParameters = NULL; + struct mailmime_parameter * param; + + mc_foreacharray(String, name, att->allContentTypeParametersNames()) { + if (contentTypeParameters == NULL) { + contentTypeParameters = clist_new(); + } + String * value = att->contentTypeParameterValueForName(name); + param = mailmime_param_new_with_data((char *)name->UTF8Characters(), (char *)value->UTF8Characters()); + clist_append(contentTypeParameters, param); + } + + return contentTypeParameters; +} + static struct mailmime * mime_from_attachment(Attachment * att) { struct mailmime * mime; @@ -262,24 +288,33 @@ static struct mailmime * mime_from_attachment(Attachment * att) if (r != MAILIMF_NO_ERROR) return NULL; } - else if (att->isInlineAttachment() && att->mimeType()->lowercaseString()->isEqual(MCSTR("text/plain"))) { - mime = get_plain_text_part(MCUTF8(att->mimeType()), MCUTF8(att->charset()), - MCUTF8(att->contentID()), - MIME_ENCODED_STR(att->contentDescription()), - data->bytes(), data->length()); - } - else if (att->isInlineAttachment() && att->mimeType()->lowercaseString()->hasPrefix(MCSTR("text/"))) { - mime = get_other_text_part(MCUTF8(att->mimeType()), MCUTF8(att->charset()), - MCUTF8(att->contentID()), - MIME_ENCODED_STR(att->contentDescription()), - data->bytes(), data->length()); - } else { - mime = get_file_part(MIME_ENCODED_STR(att->filename()), - MCUTF8(att->mimeType()), att->isInlineAttachment(), - MCUTF8(att->contentID()), - MIME_ENCODED_STR(att->contentDescription()), - data->bytes(), data->length()); + clist * contentTypeParameters = content_type_parameters_from_attachment(att); + if (att->isInlineAttachment() && att->mimeType()->lowercaseString()->isEqual(MCSTR("text/plain"))) { + mime = get_plain_text_part(MCUTF8(att->mimeType()), MCUTF8(att->charset()), + MCUTF8(att->contentID()), + MIME_ENCODED_STR(att->contentDescription()), + data->bytes(), data->length(), + contentTypeParameters); + } + else if (att->isInlineAttachment() && att->mimeType()->lowercaseString()->hasPrefix(MCSTR("text/"))) { + mime = get_other_text_part(MCUTF8(att->mimeType()), MCUTF8(att->charset()), + MCUTF8(att->contentID()), + MIME_ENCODED_STR(att->contentDescription()), + data->bytes(), data->length(), + contentTypeParameters); + } + else { + mime = get_file_part(MIME_ENCODED_STR(att->filename()), + MCUTF8(att->mimeType()), att->isInlineAttachment(), + MCUTF8(att->contentID()), + MIME_ENCODED_STR(att->contentDescription()), + data->bytes(), data->length(), + contentTypeParameters); + } + if (contentTypeParameters != NULL) { + clist_free(contentTypeParameters); + } } return mime; } diff --git a/src/core/smtp/MCSMTPSession.cc b/src/core/smtp/MCSMTPSession.cc index c6f28ff9..771b6302 100644 --- a/src/core/smtp/MCSMTPSession.cc +++ b/src/core/smtp/MCSMTPSession.cc @@ -323,7 +323,7 @@ void SMTPSession::connect(ErrorCode * pError) default: r = mailsmtp_socket_connect(mSmtp, MCUTF8(hostname()), port()); - if (r != MAILIMAP_NO_ERROR) { + if (r != MAILSMTP_NO_ERROR) { * pError = ErrorConnection; goto close; } diff --git a/src/objc/MCObjC.h b/src/objc/MCObjC.h index e63fc067..68d35f1e 100644 --- a/src/objc/MCObjC.h +++ b/src/objc/MCObjC.h @@ -18,6 +18,7 @@ #import <MailCore/MCORFC822.h> #import <MailCore/MCOPOP.h> #import <MailCore/MCOSMTP.h> +#import <MailCore/MCONNTP.h> #import <MailCore/MCOProvider.h> #endif diff --git a/src/objc/abstract/MCOAbstractMessageRendererCallback.h b/src/objc/abstract/MCOAbstractMessageRendererCallback.h index 08997c84..f9d22a4d 100644 --- a/src/objc/abstract/MCOAbstractMessageRendererCallback.h +++ b/src/objc/abstract/MCOAbstractMessageRendererCallback.h @@ -33,6 +33,7 @@ public: virtual mailcore::String * templateForEmbeddedMessage(mailcore::AbstractMessagePart * part); virtual mailcore::String * templateForEmbeddedMessageHeader(mailcore::MessageHeader * header); virtual mailcore::String * templateForAttachmentSeparator(); + virtual mailcore::String * cleanHTMLForPart(mailcore::String * html); virtual mailcore::String * filterHTMLForPart(mailcore::String * html); virtual mailcore::String * filterHTMLForMessage(mailcore::String * html); diff --git a/src/objc/abstract/MCOAbstractMessageRendererCallback.mm b/src/objc/abstract/MCOAbstractMessageRendererCallback.mm index 20812058..392f0747 100644 --- a/src/objc/abstract/MCOAbstractMessageRendererCallback.mm +++ b/src/objc/abstract/MCOAbstractMessageRendererCallback.mm @@ -146,6 +146,18 @@ String * MCOAbstractMessageRendererCallback::templateForAttachmentSeparator() return result; } +String * MCOAbstractMessageRendererCallback::cleanHTMLForPart(String * html) +{ + String * result = NULL; + if ([mRendererDelegate respondsToSelector:@selector(MCOAbstractMessage:cleanHTMLForPart:)]) { + result = MCO_FROM_OBJC(String, [mRendererDelegate MCOAbstractMessage:mMessage cleanHTMLForPart:MCO_TO_OBJC(html)]); + } + if (result == NULL) { + result = HTMLRendererTemplateCallback::cleanHTMLForPart(html); + } + return result; +} + String * MCOAbstractMessageRendererCallback::filterHTMLForPart(String * html) { String * result = NULL; diff --git a/src/objc/abstract/MCOAbstractPart.h b/src/objc/abstract/MCOAbstractPart.h index 4ee98de3..e30f09bf 100644 --- a/src/objc/abstract/MCOAbstractPart.h +++ b/src/objc/abstract/MCOAbstractPart.h @@ -14,7 +14,7 @@ @class MCOAbstractMessage; -typedef enum { +typedef NS_ENUM(NSInteger, MCOPartType) { // Used for a single part. // The part will be a MCOAbstractPart. MCOPartTypeSingle, @@ -35,7 +35,11 @@ typedef enum { // Used for a multipart, multipart/alternative. // The part will be a MCOAbstractMultipart. MCOPartTypeMultipartAlternative, -} MCOPartType; + + // Used for a signed message, multipart/signed. + // The part will be a MCOAbstractMultipart. + MCOPartTypeMultipartSigned, +}; @interface MCOAbstractPart : NSObject <NSCopying> diff --git a/src/objc/abstract/MCOAddress.mm b/src/objc/abstract/MCOAddress.mm index 679df967..b03b6aa7 100644 --- a/src/objc/abstract/MCOAddress.mm +++ b/src/objc/abstract/MCOAddress.mm @@ -159,6 +159,22 @@ MCO_OBJC_SYNTHESIZE_STRING(setMailbox, mailbox) return MCO_OBJC_BRIDGE_GET(nonEncodedRFC822String); } +- (NSUInteger) hash +{ + return [[self displayName] hash] ^ [[self mailbox] hash]; +} + +- (BOOL) isEqual:(id)object +{ + if (![object isKindOfClass:[MCOAddress class]]) { + return NO; + } + + MCOAddress * other = object; + return [[self displayName] isEqualToString:[other displayName]] && + [[self mailbox] isEqualToString:[other mailbox]]; +} + @end @implementation NSArray (MCOAddress) diff --git a/src/objc/abstract/MCOConstants.h b/src/objc/abstract/MCOConstants.h index eb276e0f..85c92414 100644 --- a/src/objc/abstract/MCOConstants.h +++ b/src/objc/abstract/MCOConstants.h @@ -3,7 +3,7 @@ #define MAILCORE_MCOCONSTANTS_H /** It's the connection type.*/ -typedef enum { +typedef NS_OPTIONS(NSInteger, MCOConnectionType) { /** Clear-text connection for the protocol.*/ MCOConnectionTypeClear = 1 << 0, /** Clear-text connection at the beginning, then switch to encrypted connection using TLS/SSL*/ @@ -11,10 +11,10 @@ typedef enum { MCOConnectionTypeStartTLS = 1 << 1, /** Encrypted connection using TLS/SSL.*/ MCOConnectionTypeTLS = 1 << 2, -} MCOConnectionType; +}; /** It's the authentication type.*/ -typedef enum { +typedef NS_OPTIONS(NSInteger, MCOAuthType) { /** Default authentication scheme of the protocol.*/ MCOAuthTypeSASLNone = 0, /** CRAM-MD5 authentication RFC 2195.*/ @@ -37,10 +37,10 @@ typedef enum { MCOAuthTypeXOAuth2 = 1 << 8, /** OAuth2 authentication on outlook.com.*/ MCOAuthTypeXOAuth2Outlook = 1 << 9, -} MCOAuthType; +}; /** It's the IMAP flags of the folder.*/ -typedef enum { +typedef NS_OPTIONS(NSInteger, MCOIMAPFolderFlag) { MCOIMAPFolderFlagNone = 0, /** \Marked*/ MCOIMAPFolderFlagMarked = 1 << 0, @@ -77,10 +77,10 @@ typedef enum { /** Mask to identify the folder */ MCOIMAPFolderFlagFolderTypeMask = MCOIMAPFolderFlagInbox | MCOIMAPFolderFlagSentMail | MCOIMAPFolderFlagStarred | MCOIMAPFolderFlagAllMail | MCOIMAPFolderFlagTrash| MCOIMAPFolderFlagDrafts | MCOIMAPFolderFlagSpam | MCOIMAPFolderFlagImportant | MCOIMAPFolderFlagArchive, -} MCOIMAPFolderFlag; +}; /** It's the flags of a message.*/ -typedef enum { +typedef NS_OPTIONS(NSInteger, MCOMessageFlag) { MCOMessageFlagNone = 0, /** Seen/Read flag.*/ MCOMessageFlagSeen = 1 << 0, @@ -100,10 +100,10 @@ typedef enum { MCOMessageFlagSubmitPending = 1 << 7, /** $Submitted flag.*/ MCOMessageFlagSubmitted = 1 << 8, -} MCOMessageFlag; +}; /** It's the encoding of a part.*/ -typedef enum { +typedef NS_ENUM(NSInteger, MCOEncoding) { /** 7bit encoding.*/ MCOEncoding7Bit = 0, /** should match MAILIMAP_BODY_FLD_ENC_7BIT*/ /** 8bit encoding.*/ @@ -121,10 +121,10 @@ typedef enum { /** UUEncode encoding.*/ MCOEncodingUUEncode = -1 -} MCOEncoding; +}; /** It's the information to fetch for a given message in the IMAP FETCH request.*/ -typedef enum { +typedef NS_OPTIONS(NSInteger, MCOIMAPMessagesRequestKind) { /** UID of the message.*/ MCOIMAPMessagesRequestKindUid = 0, /** This is the default and it's always fetched*/ /** Flags of the message.*/ @@ -150,20 +150,20 @@ typedef enum { /* Request size of message */ MCOIMAPMessagesRequestKindSize = 1 << 10, -} MCOIMAPMessagesRequestKind; +}; /** It defines the behavior of the STORE flags request.*/ -typedef enum { +typedef NS_ENUM(NSInteger, MCOIMAPStoreFlagsRequestKind) { /** Add the given flags.*/ MCOIMAPStoreFlagsRequestKindAdd, /** Remove the given flags.*/ MCOIMAPStoreFlagsRequestKindRemove, /** Set the given flags.*/ MCOIMAPStoreFlagsRequestKindSet, -} MCOIMAPStoreFlagsRequestKind; +}; /** It's the search type.*/ -typedef enum { +typedef NS_ENUM(NSInteger, MCOIMAPSearchKind) { /** Search All */ MCOIMAPSearchKindAll, /** No search.*/ @@ -180,8 +180,10 @@ typedef enum { MCOIMAPSearchKindRecipient, /** Match subject.*/ MCOIMAPSearchKindSubject, - /** Match content of the message.*/ + /** Match content of the message, including the headers.*/ MCOIMAPSearchKindContent, + /** Match content of the message, excluding the headers.*/ + MCOIMAPSearchKindBody, /** Match uids */ MCOIMAPSearchKindUids, /** Match headers of the message.*/ @@ -234,7 +236,7 @@ typedef enum { MCOIMAPSearchKindAnd, /** Not expression.*/ MCOIMAPSearchKindNot, -} MCOIMAPSearchKind; +}; /** Keys for the namespace dictionary.*/ #define MCOIMAPNamespacePersonal @"IMAPNamespacePersonal" @@ -243,7 +245,7 @@ typedef enum { /** This is the constants for the IMAP capabilities.*/ /** See corresponding RFC for more information.*/ -typedef enum { +typedef NS_ENUM(NSInteger, MCOIMAPCapability) { /** ACL Capability.*/ MCOIMAPCapabilityACL, /** BINARY Capability.*/ @@ -314,13 +316,13 @@ typedef enum { MCOIMAPCapabilityXOAuth2, /** X-GM-EXT-1 Capability.*/ MCOIMAPCapabilityGmail -} MCOIMAPCapability; +}; /** Error domain for mailcore.*/ #define MCOErrorDomain @"MCOErrorDomain" /** Here's the list of errors.*/ -typedef enum { +typedef NS_ENUM(NSInteger, MCOErrorCode) { /** No error occurred.*/ MCOErrorNone, /** An error related to the connection occurred.*/ @@ -402,10 +404,10 @@ typedef enum { MCOErrorNoop, /** The count of all errors */ MCOErrorCodeCount, -} MCOErrorCode; +}; /** Here's the list of connection log types.*/ -typedef enum { +typedef NS_ENUM(NSInteger, MCOConnectionLogType) { /** Received data.*/ MCOConnectionLogTypeReceived, /** Sent data.*/ @@ -418,7 +420,7 @@ typedef enum { MCOConnectionLogTypeErrorReceived, /** Error while sending dataThe data passed to the log will be nil.*/ MCOConnectionLogTypeErrorSent, -} MCOConnectionLogType; +}; /** It's a network traffic logger. diff --git a/src/objc/abstract/MCOHTMLRendererDelegate.h b/src/objc/abstract/MCOHTMLRendererDelegate.h index 5a1296cf..95f55b53 100644 --- a/src/objc/abstract/MCOHTMLRendererDelegate.h +++ b/src/objc/abstract/MCOHTMLRendererDelegate.h @@ -84,6 +84,11 @@ If not, the attachment template will be used.*/ This delegate method returns the template for the header of an embedded message.*/ - (NSString *) MCOAbstractMessage_templateForAttachmentSeparator:(MCOAbstractMessage *)msg; +/** This delegate method cleans HTML content. + For example, it could fix broken tags, add missing <html>, <body> tags. + Default implementation uses HTMLCleaner::cleanHTML to clean HTML content. */ +- (NSString *) MCOAbstractMessage:(MCOAbstractMessage *)msg cleanHTMLForPart:(NSString *)html; + /** @name Filters The following methods will filter the HTML content and may apply some filters to diff --git a/src/objc/abstract/MCOMessageHeader.h b/src/objc/abstract/MCOMessageHeader.h index 11a98c4f..f9bb2229 100644 --- a/src/objc/abstract/MCOMessageHeader.h +++ b/src/objc/abstract/MCOMessageHeader.h @@ -21,6 +21,9 @@ /** Message-ID field.*/ @property (nonatomic, copy) NSString * messageID; +/** Message-ID auto-generated flag.*/ +@property (nonatomic, readonly, getter=isMessageIDAutoGenerated) BOOL messageIDAutoGenerated; + /** References field. It's an array of message-ids.*/ @property (nonatomic, copy) NSArray * /* NSString */ references; diff --git a/src/objc/abstract/MCOMessageHeader.mm b/src/objc/abstract/MCOMessageHeader.mm index e5b085a5..6ce3f27b 100644 --- a/src/objc/abstract/MCOMessageHeader.mm +++ b/src/objc/abstract/MCOMessageHeader.mm @@ -114,6 +114,10 @@ MCO_OBJC_SYNTHESIZE_ARRAY(setReplyTo, replyTo) MCO_OBJC_SYNTHESIZE_STRING(setSubject, subject) MCO_OBJC_SYNTHESIZE_STRING(setUserAgent, userAgent) +- (BOOL)isMessageIDAutoGenerated { + return MCO_NATIVE_INSTANCE->isMessageIDAutoGenerated(); +} + - (void) setExtraHeaderValue:(NSString *)value forName:(NSString *)name { _nativeHeader->setExtraHeader(MCO_FROM_OBJC(mailcore::String, name), MCO_FROM_OBJC(mailcore::String, value)); diff --git a/src/objc/imap/MCOIMAPBaseOperation.h b/src/objc/imap/MCOIMAPBaseOperation.h index 31686f04..82a34378 100644 --- a/src/objc/imap/MCOIMAPBaseOperation.h +++ b/src/objc/imap/MCOIMAPBaseOperation.h @@ -19,6 +19,8 @@ typedef void (^MCOIMAPBaseOperationItemProgressBlock)(unsigned int current); @interface MCOIMAPBaseOperation : MCOOperation +@property (nonatomic, assign, getter=isUrgent) BOOL urgent; + /* Can be overriden by subclasses */ /* diff --git a/src/objc/imap/MCOIMAPBaseOperation.mm b/src/objc/imap/MCOIMAPBaseOperation.mm index fe20da53..70f0d5ff 100644 --- a/src/objc/imap/MCOIMAPBaseOperation.mm +++ b/src/objc/imap/MCOIMAPBaseOperation.mm @@ -13,6 +13,7 @@ #import "MCAsyncIMAP.h" #import "MCOIMAPSession.h" +#import "NSObject+MCO.h" class MCOIMAPBaseOperationIMAPCallback : public mailcore::IMAPOperationCallback { public: @@ -42,6 +43,10 @@ private: MCOIMAPSession * _session; } +#define nativeType mailcore::IMAPOperation + +MCO_OBJC_SYNTHESIZE_SCALAR(BOOL, bool, setUrgent, isUrgent) + - (id) initWithMCOperation:(mailcore::Operation *)op { self = [super initWithMCOperation:op]; diff --git a/src/objc/imap/MCOIMAPFetchMessagesOperation.mm b/src/objc/imap/MCOIMAPFetchMessagesOperation.mm index bd86d99b..83012ca5 100644 --- a/src/objc/imap/MCOIMAPFetchMessagesOperation.mm +++ b/src/objc/imap/MCOIMAPFetchMessagesOperation.mm @@ -17,8 +17,11 @@ typedef void (^CompletionType)(NSError *error, NSArray * messages, MCOIndexSet * @implementation MCOIMAPFetchMessagesOperation { CompletionType _completionBlock; + MCOIMAPBaseOperationItemProgressBlock _progress; } +@synthesize progress = _progress; + #define nativeType mailcore::IMAPFetchMessagesOperation + (void) load diff --git a/src/objc/imap/MCOIMAPFolderInfo.h b/src/objc/imap/MCOIMAPFolderInfo.h index c15c5a37..53ad35b8 100644 --- a/src/objc/imap/MCOIMAPFolderInfo.h +++ b/src/objc/imap/MCOIMAPFolderInfo.h @@ -34,6 +34,9 @@ // first uid of the unseen messages. @property (nonatomic, assign) uint32_t firstUnseenUid; +/** An boolean indicates that this folder or IMAP server allows to add a new permanent flags */ +@property (nonatomic, assign) BOOL allowsNewPermanentFlags; + @end #endif diff --git a/src/objc/imap/MCOIMAPFolderInfo.m b/src/objc/imap/MCOIMAPFolderInfo.m index e39551a4..be1d2c3e 100644 --- a/src/objc/imap/MCOIMAPFolderInfo.m +++ b/src/objc/imap/MCOIMAPFolderInfo.m @@ -14,6 +14,7 @@ uint64_t _modSequenceValue; int _messageCount; uint32_t _firstUnseenUid; + BOOL _allowsNewPermanentFlags; } @synthesize uidNext = _uidNext; @@ -21,6 +22,7 @@ @synthesize modSequenceValue = _modSequenceValue; @synthesize messageCount = _messageCount; @synthesize firstUnseenUid = _firstUnseenUid; +@synthesize allowsNewPermanentFlags = _allowsNewPermanentFlags; + (MCOIMAPFolderInfo *) info { diff --git a/src/objc/imap/MCOIMAPFolderInfoOperation.mm b/src/objc/imap/MCOIMAPFolderInfoOperation.mm index 7ea8e887..f4d322af 100644 --- a/src/objc/imap/MCOIMAPFolderInfoOperation.mm +++ b/src/objc/imap/MCOIMAPFolderInfoOperation.mm @@ -65,6 +65,7 @@ typedef void (^CompletionType)(NSError *error, MCOIMAPFolderInfo *info); [info setModSequenceValue:MCO_NATIVE_INSTANCE->modSequenceValue()]; [info setMessageCount:MCO_NATIVE_INSTANCE->messageCount()]; [info setFirstUnseenUid:MCO_NATIVE_INSTANCE->firstUnseenUid()]; + [info setAllowsNewPermanentFlags:MCO_NATIVE_INSTANCE->allowsNewPermanentFlags()]; _completionBlock(nil, info); } diff --git a/src/objc/imap/MCOIMAPFolderStatus.h b/src/objc/imap/MCOIMAPFolderStatus.h index fedd31a3..bd1ddef3 100644 --- a/src/objc/imap/MCOIMAPFolderStatus.h +++ b/src/objc/imap/MCOIMAPFolderStatus.h @@ -32,7 +32,7 @@ @property (nonatomic, assign) uint32_t messageCount; /** Highest modification sequence value for this folder. See CONDSTORE RFC 4551. */ -@property (nonatomic, assign) uint64_t setHighestModSeqValue; +@property (nonatomic, assign) uint64_t highestModSeqValue; @end diff --git a/src/objc/imap/MCOIMAPSearchExpression.h b/src/objc/imap/MCOIMAPSearchExpression.h index fbffb8f3..51688dc2 100644 --- a/src/objc/imap/MCOIMAPSearchExpression.h +++ b/src/objc/imap/MCOIMAPSearchExpression.h @@ -82,7 +82,7 @@ + (MCOIMAPSearchExpression *) searchSubject:(NSString *)value; /** - Creates a search expression that matches the content of an email. + Creates a search expression that matches the content of an email, including the headers. Example: @@ -91,6 +91,15 @@ + (MCOIMAPSearchExpression *) searchContent:(NSString *)value; /** + Creates a search expression that matches the content of an email, excluding the headers. + + Example: + + MCOIMAPSearchExpression * expr = [MCOIMAPSearchExpression searchBody:@"building"] + */ ++ (MCOIMAPSearchExpression *) searchBody:(NSString *)value; + +/** Creates a search expression that matches the uids specified. Example: diff --git a/src/objc/imap/MCOIMAPSearchExpression.mm b/src/objc/imap/MCOIMAPSearchExpression.mm index f395596c..57ae8455 100644 --- a/src/objc/imap/MCOIMAPSearchExpression.mm +++ b/src/objc/imap/MCOIMAPSearchExpression.mm @@ -96,6 +96,11 @@ return MCO_TO_OBJC(mailcore::IMAPSearchExpression::searchContent([value mco_mcString])); } ++ (MCOIMAPSearchExpression *) searchBody:(NSString *)value +{ + return MCO_TO_OBJC(mailcore::IMAPSearchExpression::searchBody([value mco_mcString])); +} + + (MCOIMAPSearchExpression *) searchUIDs:(MCOIndexSet *) uids { return MCO_TO_OBJC(mailcore::IMAPSearchExpression::searchUIDs(MCO_FROM_OBJC(mailcore::IndexSet, uids))); diff --git a/src/objc/nntp/MCONNTP.h b/src/objc/nntp/MCONNTP.h new file mode 100644 index 00000000..980d0c39 --- /dev/null +++ b/src/objc/nntp/MCONNTP.h @@ -0,0 +1,21 @@ +// +// MCONNTP.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCONNTP_H + +#define MAILCORE_MCONNTP_H + +#include <MailCore/MCONNTPSession.h> +#include <MailCore/MCONNTPOperation.h> +#include <MailCore/MCONNTPFetchHeaderOperation.h> +#include <MailCore/MCONNTPFetchArticleOperation.h> +#include <MailCore/MCONNTPFetchArticlesOperation.h> +#include <MailCore/MCONNTPListNewsgroupsOperation.h> +#include <MailCore/MCONNTPGroupInfo.h> + +#endif diff --git a/src/objc/nntp/MCONNTPDisconnectOperation.h b/src/objc/nntp/MCONNTPDisconnectOperation.h new file mode 100644 index 00000000..7d8986bb --- /dev/null +++ b/src/objc/nntp/MCONNTPDisconnectOperation.h @@ -0,0 +1,21 @@ +// +// MCONNTPDisconnectOperation.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCONNTPDICONNECTOPERATION_H + +#define MAILCORE_MCONNTPDICONNECTOPERATION_H + +#import <Foundation/Foundation.h> +#import <MailCore/MCONNTPOperation.h> + +/* The class is used to perform a disconnect operation. */ +@interface MCONNTPDisconnectOperation : NSObject + +@end + +#endif diff --git a/src/objc/nntp/MCONNTPDisconnectOperation.mm b/src/objc/nntp/MCONNTPDisconnectOperation.mm new file mode 100644 index 00000000..2c8290e3 --- /dev/null +++ b/src/objc/nntp/MCONNTPDisconnectOperation.mm @@ -0,0 +1,31 @@ +// +// MCONNTPDisconnectOperation.m +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#import "MCONNTPDisconnectOperation.h" + +#import "MCOOperation+Private.h" +#import "MCOUtils.h" + +#include "MCNNTPDisconnectOperation.h" + +@implementation MCONNTPDisconnectOperation + +#define nativeType mailcore::NNTPDisconnectOperation + ++ (void) load +{ + MCORegisterClass(self, &typeid(nativeType)); +} + ++ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object +{ + nativeType * op = (nativeType *) object; + return [[[self alloc] initWithMCOperation:op] autorelease]; +} + +@end diff --git a/src/objc/nntp/MCONNTPFetchArticleOperation.h b/src/objc/nntp/MCONNTPFetchArticleOperation.h new file mode 100644 index 00000000..b8bffcb0 --- /dev/null +++ b/src/objc/nntp/MCONNTPFetchArticleOperation.h @@ -0,0 +1,39 @@ +// +// MCONNTPFetchArticleOperation.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCONNTPFETCHARTICLEOPERATION_H + +#define MAILCORE_MCONNTPFETCHARTICLEOPERATION_H + +#import <Foundation/Foundation.h> +#import <MailCore/MCONNTPOperation.h> + +/** Fetch a message from NNTP3 */ + +typedef void (^MCONNTPOperationProgressBlock)(unsigned int current, unsigned int maximum); + +@interface MCONNTPFetchArticleOperation : MCONNTPOperation + +/** This block will be called as data is downloaded from the network */ +@property (nonatomic, copy) MCONNTPOperationProgressBlock progress; + +/** + Starts the asynchronous fetch operation. + + @param completionBlock Called when the operation is finished. + + - On success `error` will be nil and `data` will contain the message data + + - On failure, `error` will be set with `MCOErrorDomain` as domain and an + error code available in MCOConstants.h, `data` will be nil + */ +- (void) start:(void (^)(NSError * error, NSData * messageData))completionBlock; + +@end + +#endif diff --git a/src/objc/nntp/MCONNTPFetchArticleOperation.mm b/src/objc/nntp/MCONNTPFetchArticleOperation.mm new file mode 100644 index 00000000..1d43d1b6 --- /dev/null +++ b/src/objc/nntp/MCONNTPFetchArticleOperation.mm @@ -0,0 +1,116 @@ +// +// MCONNTPFetchArticleOperation.m +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#import "MCONNTPFetchArticleOperation.h" + +#import "MCAsyncNNTP.h" + +#import "MCOUtils.h" +#import "MCOOperation+Private.h" + +#define nativeType mailcore::NNTPFetchArticleOperation + +typedef void (^CompletionType)(NSError *error, NSData * messageData); + +@interface MCONNTPFetchArticleOperation () + +- (void) bodyProgress:(unsigned int)current maximum:(unsigned int)maximum; + +@end + +class MCONNTPFetchArticleOperationCallback : public mailcore::NNTPOperationCallback { +public: + MCONNTPFetchArticleOperationCallback(MCONNTPFetchArticleOperation * op) + { + mOperation = op; + } + virtual ~MCONNTPFetchArticleOperationCallback() + { + } + + virtual void bodyProgress(mailcore::NNTPOperation * session, unsigned int current, unsigned int maximum) { + [mOperation bodyProgress:current maximum:maximum]; + } + +private: + MCONNTPFetchArticleOperation * mOperation; +}; + +@implementation MCONNTPFetchArticleOperation { + CompletionType _completionBlock; + MCONNTPFetchArticleOperationCallback * _popCallback; + MCONNTPOperationProgressBlock _progress; +} + +@synthesize progress = _progress; + ++ (void) load +{ + MCORegisterClass(self, &typeid(nativeType)); +} + ++ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object +{ + nativeType * op = (nativeType *) object; + return [[[self alloc] initWithMCOperation:op] autorelease]; +} + +- (id)initWithMCOperation:(mailcore::Operation *)op +{ + self = [super initWithMCOperation:op]; + + _popCallback = new MCONNTPFetchArticleOperationCallback(self); + ((mailcore::NNTPOperation *) op)->setNNTPCallback(_popCallback); + + return self; +} + +- (void) dealloc +{ + [_progress release]; + [_completionBlock release]; + delete _popCallback; + [super dealloc]; +} + +- (void) start:(void (^)(NSError *error, NSData * messageData))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, MCO_TO_OBJC(op->data())); + } else { + _completionBlock([NSError mco_errorWithErrorCode:op->error()], nil); + } + [_completionBlock release]; + _completionBlock = nil; +} + +- (void) bodyProgress:(unsigned int)current maximum:(unsigned int)maximum +{ + if (_progress != NULL) { + _progress(current, maximum); + } +} + +@end diff --git a/src/objc/nntp/MCONNTPFetchArticlesOperation.h b/src/objc/nntp/MCONNTPFetchArticlesOperation.h new file mode 100644 index 00000000..35a0889d --- /dev/null +++ b/src/objc/nntp/MCONNTPFetchArticlesOperation.h @@ -0,0 +1,35 @@ +// +// MCONNTPFetchArticlesOperation.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCONNTPFETCHARTICLESOPERATION_H + +#define MAILCORE_MCONNTPFETCHARTICLESOPERATION_H + +#import <Foundation/Foundation.h> +#import <MailCore/MCONNTPOperation.h> + +@class MCOIndexSet; + +/** This is an asynchronous operation that will fetch the list of a messages on the NNTP server. */ +@interface MCONNTPFetchArticlesOperation : MCONNTPOperation + +/** + Starts the asynchronous fetch operation. + + @param completionBlock Called when the operation is finished. + + - On success `error` will be nil and `articles` will be an index set of article numbers. + + - On failure, `error` will be set with `MCOErrorDomain` as domain and an + error code available in MCOConstants.h, `messages` will be null + */ +- (void) start:(void (^)(NSError * error, MCOIndexSet * articles))completionBlock; + +@end + +#endif diff --git a/src/objc/nntp/MCONNTPFetchArticlesOperation.mm b/src/objc/nntp/MCONNTPFetchArticlesOperation.mm new file mode 100644 index 00000000..6e13a5d2 --- /dev/null +++ b/src/objc/nntp/MCONNTPFetchArticlesOperation.mm @@ -0,0 +1,70 @@ +// +// MCONNTPFetchArticlesOperation.m +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#import "MCONNTPFetchArticlesOperation.h" + +#include "MCAsyncNNTP.h" + +#import "MCOOperation+Private.h" +#import "MCOUtils.h" + +typedef void (^CompletionType)(NSError *error, MCOIndexSet * articles); + +@implementation MCONNTPFetchArticlesOperation { + CompletionType _completionBlock; +} + +#define nativeType mailcore::MCNNTPFetchArticlesOperation + ++ (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, MCOIndexSet * articles))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, MCO_TO_OBJC(op->articles())); + } else { + _completionBlock([NSError mco_errorWithErrorCode:op->error()], nil); + } + [_completionBlock release]; + _completionBlock = nil; +} + + +@end diff --git a/src/objc/nntp/MCONNTPFetchHeaderOperation.h b/src/objc/nntp/MCONNTPFetchHeaderOperation.h new file mode 100644 index 00000000..63ce7677 --- /dev/null +++ b/src/objc/nntp/MCONNTPFetchHeaderOperation.h @@ -0,0 +1,39 @@ +// +// MCONNTPFetchHeaderOperation.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCONNTPFETCHHEADEROPERATION_H + +#define MAILCORE_MCONNTPFETCHHEADEROPERATION_H + +#import <Foundation/Foundation.h> +#import <MailCore/MCONNTPOperation.h> + +/** + This is an asynchronous operation that will fetch the header of a message. + @See MCONNTPSession + */ + +@class MCOMessageHeader; + +@interface MCONNTPFetchHeaderOperation : MCONNTPOperation + +/** + Starts the asynchronous fetch operation. + + @param completionBlock Called when the operation is finished. + + - On success `error` will be nil and `header` will contain the message header + + - On failure, `error` will be set with `MCOErrorDomain` as domain and an + error code available in MCOConstants.h, `header` will be null + */ +- (void) start:(void (^)(NSError * error, MCOMessageHeader * header))completionBlock; + +@end + +#endif diff --git a/src/objc/nntp/MCONNTPFetchHeaderOperation.mm b/src/objc/nntp/MCONNTPFetchHeaderOperation.mm new file mode 100644 index 00000000..c74f6b26 --- /dev/null +++ b/src/objc/nntp/MCONNTPFetchHeaderOperation.mm @@ -0,0 +1,69 @@ +// +// MCONNTPFetchHeaderOperation.m +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#import "MCONNTPFetchHeaderOperation.h" + +#include "MCAsyncNNTP.h" + +#import "MCOUtils.h" +#import "MCOOperation+Private.h" + +typedef void (^CompletionType)(NSError *error, MCOMessageHeader * header); + +@implementation MCONNTPFetchHeaderOperation { + CompletionType _completionBlock; +} + +#define nativeType mailcore::NNTPFetchHeaderOperation + ++ (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, MCOMessageHeader * header))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, MCO_TO_OBJC(op->header())); + } else { + _completionBlock([NSError mco_errorWithErrorCode:op->error()], nil); + } + [_completionBlock release]; + _completionBlock = nil; +} + +@end diff --git a/src/objc/nntp/MCONNTPGroupInfo.h b/src/objc/nntp/MCONNTPGroupInfo.h new file mode 100644 index 00000000..e34445a9 --- /dev/null +++ b/src/objc/nntp/MCONNTPGroupInfo.h @@ -0,0 +1,27 @@ +// +// MCONNTPGroupInfo.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCONNTPGROUPINFO_H + +#define MAILCORE_MCONNTPGROUPINFO_H + +#import <Foundation/Foundation.h> + +/** This is information of a message fetched by MCONNTPListNewsgroupsOperation.*/ + +@interface MCONNTPGroupInfo : NSObject <NSCopying> + +/** The name of the news group. */ +@property (nonatomic, copy) NSString *name; + +/** The number of messages in the news group. */ +@property (nonatomic, assign) unsigned int messageCount; + +@end + +#endif diff --git a/src/objc/nntp/MCONNTPGroupInfo.mm b/src/objc/nntp/MCONNTPGroupInfo.mm new file mode 100644 index 00000000..342192f2 --- /dev/null +++ b/src/objc/nntp/MCONNTPGroupInfo.mm @@ -0,0 +1,70 @@ +// +// MCONNTPGroupInfo.m +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#import "MCONNTPGroupInfo.h" + +#include "MCAsyncNNTP.h" +#include "MCNNTP.h" + +#import "MCOUtils.h" + +@implementation MCONNTPGroupInfo { + mailcore::NNTPGroupInfo * _nativeInfo; +} + +#define nativeType mailcore::NNTPGroupInfo + ++ (void) load +{ + MCORegisterClass(self, &typeid(nativeType)); +} + +- (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]; +} + ++ (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object +{ + mailcore::NNTPGroupInfo * groupInfo = (mailcore::NNTPGroupInfo *) object; + return [[[self alloc] initWithMCNNTPGroupInfo:groupInfo] autorelease]; +} + +- (mailcore::Object *) mco_mcObject +{ + return _nativeInfo; +} + +- (NSString *) description +{ + return MCO_OBJC_BRIDGE_GET(description); +} + +- (id) initWithMCNNTPGroupInfo:(mailcore::NNTPGroupInfo *)info +{ + self = [super init]; + + _nativeInfo = info; + _nativeInfo->retain(); + + return self; +} + +- (void) dealloc +{ + MC_SAFE_RELEASE(_nativeInfo); + [super dealloc]; +} + +MCO_OBJC_SYNTHESIZE_STRING(setName, name) +MCO_OBJC_SYNTHESIZE_SCALAR(unsigned int, unsigned int, setMessageCount, messageCount) + +@end diff --git a/src/objc/nntp/MCONNTPListNewsgroupsOperation.h b/src/objc/nntp/MCONNTPListNewsgroupsOperation.h new file mode 100644 index 00000000..ea702b75 --- /dev/null +++ b/src/objc/nntp/MCONNTPListNewsgroupsOperation.h @@ -0,0 +1,32 @@ +// +// MCONNTPListNewsgroupsOperation.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCONNTPLISTNEWSGROUPSOPERATION_H + +#define MAILCORE_MCONNTPLISTNEWSGROUPSOPERATION_H + +#import <Foundation/Foundation.h> +#import <MailCore/MCONNTPOperation.h> + +@interface MCONNTPListNewsgroupsOperation : MCONNTPOperation + +/** + Starts the asynchronous fetch operation. + + @param completionBlock Called when the operation is finished. + + - On success `error` will be nil and `messages` will be an array of MCONNTPGroupInfo + + - On failure, `error` will be set with `MCOErrorDomain` as domain and an + error code available in MCOConstants.h, `messages` will be null + */ +- (void) start:(void (^)(NSError * error, NSArray * /* MCONNTPGroupInfo */ messages))completionBlock; + +@end + +#endif diff --git a/src/objc/nntp/MCONNTPListNewsgroupsOperation.mm b/src/objc/nntp/MCONNTPListNewsgroupsOperation.mm new file mode 100644 index 00000000..155a93a3 --- /dev/null +++ b/src/objc/nntp/MCONNTPListNewsgroupsOperation.mm @@ -0,0 +1,69 @@ +// +// MCONNTPListNewsgroupsOperation.m +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#import "MCONNTPListNewsgroupsOperation.h" + +#include "MCAsyncNNTP.h" + +#import "MCOUtils.h" +#import "MCOOperation+Private.h" + +typedef void (^CompletionType)(NSError *error, NSArray * groups); + +@implementation MCONNTPListNewsgroupsOperation { + CompletionType _completionBlock; +} + +#define nativeType mailcore::NNTPListNewsgroupsOperation + ++ (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, NSArray * groups))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, MCO_TO_OBJC(op->groups())); + } else { + _completionBlock([NSError mco_errorWithErrorCode:op->error()], nil); + } + [_completionBlock release]; + _completionBlock = nil; +} + +@end diff --git a/src/objc/nntp/MCONNTPOperation+Private.h b/src/objc/nntp/MCONNTPOperation+Private.h new file mode 100644 index 00000000..2ab429f2 --- /dev/null +++ b/src/objc/nntp/MCONNTPOperation+Private.h @@ -0,0 +1,20 @@ +// +// MCONNTPOperation_Private.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCONNTPOPERATION_PRIVATE_H +#define MAILCORE_MCONNTPOPERATION_PRIVATE_H + +@class MCONNTPSession; + +@interface MCONNTPOperation (Private) + +@property (nonatomic, retain) MCONNTPSession * session; + +@end + +#endif diff --git a/src/objc/nntp/MCONNTPOperation.h b/src/objc/nntp/MCONNTPOperation.h new file mode 100644 index 00000000..9d4e2fcf --- /dev/null +++ b/src/objc/nntp/MCONNTPOperation.h @@ -0,0 +1,37 @@ +// +// MCONNTPOperation.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#ifndef MAILCORE_MCONNTPOPERATION_H + +#define MAILCORE_MCONNTPOPERATION_H + +#import <Foundation/Foundation.h> +#import <MailCore/MCOOperation.h> + +/** + This is a generic asynchronous NNTP3 operation. + @see MCONNTPSession + */ + +@interface MCONNTPOperation : MCOOperation + +/** + Starts the asynchronous operation. + + @param completionBlock Called when the operation is finished. + + - On success `error` will be nil + + - On failure, `error` will be set with `MCOErrorDomain` as domain and an + error code available in MCOConstants.h, + */ +- (void) start:(void (^)(NSError * error))completionBlock; + +@end + +#endif diff --git a/src/objc/nntp/MCONNTPOperation.mm b/src/objc/nntp/MCONNTPOperation.mm new file mode 100644 index 00000000..862b5259 --- /dev/null +++ b/src/objc/nntp/MCONNTPOperation.mm @@ -0,0 +1,59 @@ +// +// MCONNTPOperation.m +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#import "MCONNTPOperation.h" + +#include "MCAsyncNNTP.h" + +#import "MCOUtils.h" +#import "MCOOperation+Private.h" +#import "MCONNTPSession.h" + +typedef void (^CompletionType)(NSError *error); + +@implementation MCONNTPOperation { + CompletionType _completionBlock; + MCONNTPSession * _session; +} + +#define nativeType mailcore::NNTPOperation + +- (void) dealloc +{ + [_session release]; + [_completionBlock release]; + [super dealloc]; +} + +- (void)start:(void (^)(NSError *error))completionBlock { + _completionBlock = [completionBlock copy]; + [self start]; +} + +- (void)operationCompleted { + if (_completionBlock == NULL) + return; + + NSError * error = [NSError mco_errorWithErrorCode:MCO_NATIVE_INSTANCE->error()]; + _completionBlock(error); + [_completionBlock release]; + _completionBlock = nil; +} + +- (void) setSession:(MCONNTPSession *)session +{ + [_session release]; + _session = [session retain]; +} + +- (MCONNTPSession *) session +{ + return _session; +} + +@end diff --git a/src/objc/nntp/MCONNTPSession.h b/src/objc/nntp/MCONNTPSession.h new file mode 100644 index 00000000..6712d9e4 --- /dev/null +++ b/src/objc/nntp/MCONNTPSession.h @@ -0,0 +1,137 @@ +// +// MCONNTPSession.h +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#import <Foundation/Foundation.h> + +#ifndef MAILCORE_MCONNTPSESSION_H + +#define MAILCORE_MCONNTPSESSION_H + +#import <Foundation/Foundation.h> + +#import <MailCore/MCOConstants.h> + +@class MCONNTPFetchArticlesOperation; +@class MCONNTPFetchHeaderOperation; +@class MCONNTPFetchArticleOperation; +@class MCONNTPListNewsgroupsOperation; +@class MCONNTPOperation; + +/** This class implements asynchronous access to the NNTP protocol.*/ + +@interface MCONNTPSession : NSObject + +/** This is the hostname of the NNTP server to connect to.*/ +@property (nonatomic, copy) NSString * hostname; + +/** This is the port of the NNTP server to connect to.*/ +@property (nonatomic, assign) unsigned int port; + +/** This is the username of the account.*/ +@property (nonatomic, copy) NSString * username; + +/** This is the password of the account.*/ +@property (nonatomic, copy) NSString * password; + +/** This is the encryption type to use. + See MCOConnectionType for more information.*/ +@property (nonatomic, assign) MCOConnectionType connectionType; + +/** This is the timeout of the connection.*/ +@property (nonatomic, assign) NSTimeInterval timeout; + +/** When set to YES, the connection will fail if the certificate is incorrect.*/ +@property (nonatomic, assign, getter=isCheckCertificateEnabled) BOOL checkCertificateEnabled; + +/** + Sets logger callback. The network traffic will be sent to this block. + + [session setConnectionLogger:^(void * connectionID, MCOConnectionLogType type, NSData * data) { + ... + }]; + */ +@property (nonatomic, copy) MCOConnectionLogger connectionLogger; + +/** This property provides some hints to MCONNTPSession about where it's called from. + It will make MCONNTPSession safe. It will also set all the callbacks of operations to run on this given queue. + Defaults to the main queue. + This property should be used only if there's performance issue using MCONNTPSession in the main thread. */ +@property (nonatomic, assign) dispatch_queue_t dispatchQueue; + +/** @name Operations */ + +/** + Returns an operation that will fetch the list of article numbers. + + MCONNTPFetchArticlesOperation * op = [session fetchArticlesOperation]; + [op start:^(NSError * error, MCOIndexSet * articles) { + }]; + */ +- (MCONNTPFetchArticlesOperation *) fetchArticlesOperation:(NSString *)group; + +/** + Returns an operation that will fetch the header of the given message. + + MCONNTPFetchHeaderOperation * op = [session fetchHeaderOperationWithIndex:idx inGroup:@"Group"]; + [op start:^(NSError * error, MCOMessageHeader * header) { + // header is the parsed header of the message. + }]; + */ +- (MCONNTPFetchHeaderOperation *) fetchHeaderOperationWithIndex:(unsigned int)index inGroup:(NSString *)group; + +/** + Returns an operation that will fetch the content of the given message. + + MCONNTPFetchArticleOperation * op = [session fetchArticleOperationWithIndex:idx inGroup:@"Group"]; + [op start:^(NSError * error, NSData * messageData) { + // messageData is the RFC 822 formatted message data. + }]; + */ +- (MCONNTPFetchArticleOperation *) fetchArticleOperationWithIndex:(unsigned int)index inGroup:(NSString *)group; + +/** + Returns an operation that will list all available newsgroups. + + MCONNTPListNewsgroupsOperation * op = [session listAllNewsgroupsOperation]; + [op start:^(NSError * error, NSArray * subscribedGroups) { + }]; + */ +- (MCONNTPListNewsgroupsOperation *) listAllNewsgroupsOperation; + +/** + Returns an operation that will list all newsgroups subscribed to by the user. + + MCONNTPListNewsgroupsOperation * op = [session listSubscribedNewsgroupsOperation]; + [op start:^(NSError * error, NSArray * subscribedGroups) { + }]; + */ +- (MCONNTPListNewsgroupsOperation *) listSubscribedNewsgroupsOperation; + +/** + Returns an operation that will disconnect the session. + + MCONNTPOperation * op = [session disconnectOperation]; + [op start:^(NSError * error) { + ... + }]; + */ +- (MCONNTPOperation *) disconnectOperation; + +/** + Returns an operation that will check whether the NNTP account is valid. + + MCONNTPOperation * op = [session checkAccountOperation]; + [op start:^(NSError * error) { + ... + }]; + */ +- (MCONNTPOperation *) checkAccountOperation; + +@end + +#endif diff --git a/src/objc/nntp/MCONNTPSession.mm b/src/objc/nntp/MCONNTPSession.mm new file mode 100644 index 00000000..e661eb65 --- /dev/null +++ b/src/objc/nntp/MCONNTPSession.mm @@ -0,0 +1,169 @@ +// +// MCONNTPSession.m +// mailcore2 +// +// Created by Robert Widmann on 8/13/14. +// Copyright (c) 2014 MailCore. All rights reserved. +// + +#import "MCONNTPSession.h" + +#include "MCAsyncNNTP.h" + +#import "MCOUtils.h" +#import "MCONNTPOperation.h" +#import "MCOOperation+Private.h" +#import "MCONNTPFetchArticlesOperation.h" +#import "MCONNTPOperation+Private.h" + +using namespace mailcore; + +@interface MCONNTPSession () + +- (void) _logWithSender:(void *)sender connectionType:(MCOConnectionLogType)logType data:(NSData *)data; + +@end + +class MCONNTPConnectionLoggerBridge : public Object, public ConnectionLogger { +public: + MCONNTPConnectionLoggerBridge(MCONNTPSession * session) + { + mSession = session; + } + + virtual void log(void * sender, ConnectionLogType logType, Data * data) + { + [mSession _logWithSender:sender connectionType:(MCOConnectionLogType)logType data:MCO_TO_OBJC(data)]; + } + +private: + MCONNTPSession * mSession; +}; + +@implementation MCONNTPSession { + mailcore::NNTPAsyncSession * _session; + MCOConnectionLogger _connectionLogger; + MCONNTPConnectionLoggerBridge * _loggerBridge; +} + +#define nativeType mailcore::NNTPAsyncSession + +- (mailcore::Object *) mco_mcObject +{ + return _session; +} + +- (NSString *) description +{ + return MCO_OBJC_BRIDGE_GET(description); +} + +- (id)init { + self = [super init]; + + _session = new mailcore::NNTPAsyncSession(); + _loggerBridge = new MCONNTPConnectionLoggerBridge(self); + + return self; +} + +- (void)dealloc { + MC_SAFE_RELEASE(_loggerBridge); + [_connectionLogger release]; + _session->release(); + [super dealloc]; +} + +MCO_OBJC_SYNTHESIZE_STRING(setHostname, hostname) +MCO_OBJC_SYNTHESIZE_SCALAR(unsigned int, unsigned int, setPort, port) +MCO_OBJC_SYNTHESIZE_STRING(setUsername, username) +MCO_OBJC_SYNTHESIZE_STRING(setPassword, password) +MCO_OBJC_SYNTHESIZE_SCALAR(MCOConnectionType, mailcore::ConnectionType, setConnectionType, connectionType) +MCO_OBJC_SYNTHESIZE_SCALAR(NSTimeInterval, time_t, setTimeout, timeout) +MCO_OBJC_SYNTHESIZE_BOOL(setCheckCertificateEnabled, isCheckCertificateEnabled) +MCO_OBJC_SYNTHESIZE_SCALAR(dispatch_queue_t, dispatch_queue_t, setDispatchQueue, dispatchQueue); + +- (void) setConnectionLogger:(MCOConnectionLogger)connectionLogger +{ + [_connectionLogger release]; + _connectionLogger = [connectionLogger copy]; + + if (_connectionLogger != nil) { + _session->setConnectionLogger(_loggerBridge); + } + else { + _session->setConnectionLogger(NULL); + } +} + +- (MCOConnectionLogger) connectionLogger +{ + return _connectionLogger; +} + +#pragma mark - Operations + + +#define MCO_TO_OBJC_OP(op) [self _objcOperationFromNativeOp:op]; +#define OPAQUE_OPERATION(op) [self _objcOpaqueOperationFromNativeOp:op] + +- (id) _objcOperationFromNativeOp:(mailcore::NNTPOperation *)op +{ + MCONNTPOperation * result = MCO_TO_OBJC(op); + [result setSession:self]; + return result; +} + +- (id) _objcOpaqueOperationFromNativeOp:(mailcore::NNTPOperation *)op +{ + MCONNTPOperation * result = [[[MCONNTPOperation alloc] initWithMCOperation:op] autorelease]; + [result setSession:self]; + return result; +} + +- (MCONNTPFetchArticlesOperation *) fetchArticlesOperation:(NSString *)group +{ + mailcore::MCNNTPFetchArticlesOperation * coreOp = MCO_NATIVE_INSTANCE->fetchArticlesOperation(MCO_FROM_OBJC(mailcore::String, group)); + return MCO_TO_OBJC_OP(coreOp); +} + +- (MCONNTPFetchHeaderOperation *) fetchHeaderOperationWithIndex:(unsigned int)index inGroup:(NSString *)group +{ + mailcore::NNTPFetchHeaderOperation * coreOp = MCO_NATIVE_INSTANCE->fetchHeaderOperation(MCO_FROM_OBJC(mailcore::String, group), index); + return MCO_TO_OBJC_OP(coreOp); +} + +- (MCONNTPFetchArticleOperation *) fetchArticleOperationWithIndex:(unsigned int)index inGroup:(NSString *)group +{ + mailcore::NNTPFetchArticleOperation * coreOp = MCO_NATIVE_INSTANCE->fetchArticleOperation(MCO_FROM_OBJC(mailcore::String, group), index); + return MCO_TO_OBJC_OP(coreOp); +} + +- (MCONNTPListNewsgroupsOperation *) listAllNewsgroupsOperation { + mailcore::NNTPListNewsgroupsOperation * coreOp = MCO_NATIVE_INSTANCE->listAllNewsgroupsOperation(); + return MCO_TO_OBJC_OP(coreOp); +} + +- (MCONNTPListNewsgroupsOperation *) listSubscribedNewsgroupsOperation { + mailcore::NNTPListNewsgroupsOperation * coreOp = MCO_NATIVE_INSTANCE->listSubscribedNewsgroupsOperation(); + return MCO_TO_OBJC_OP(coreOp); +} + +- (MCONNTPOperation *) disconnectOperation +{ + mailcore::NNTPOperation * coreOp = MCO_NATIVE_INSTANCE->disconnectOperation(); + return OPAQUE_OPERATION(coreOp); +} + +- (MCONNTPOperation *) checkAccountOperation +{ + mailcore::NNTPOperation * coreOp = MCO_NATIVE_INSTANCE->checkAccountOperation(); + return OPAQUE_OPERATION(coreOp); +} + +- (void) _logWithSender:(void *)sender connectionType:(MCOConnectionLogType)logType data:(NSData *)data +{ + _connectionLogger(sender, logType, data); +} + +@end diff --git a/src/objc/pop/MCOPOPSession.h b/src/objc/pop/MCOPOPSession.h index 719b65b7..260fe5d9 100644 --- a/src/objc/pop/MCOPOPSession.h +++ b/src/objc/pop/MCOPOPSession.h @@ -92,7 +92,7 @@ See MCOConnectionType for more information.*/ [op start:^(NSError * error, MCOMessageHeader * header) { // header is the parsed header of the message. }]; -*/ +*/ - (MCOPOPFetchHeaderOperation *) fetchHeaderOperationWithIndex:(unsigned int)index; /** diff --git a/src/objc/rfc822/MCOAttachment.h b/src/objc/rfc822/MCOAttachment.h index 8094d474..954a825c 100644 --- a/src/objc/rfc822/MCOAttachment.h +++ b/src/objc/rfc822/MCOAttachment.h @@ -41,7 +41,19 @@ /** Returns string representation according to charset*/ - (NSString *) decodedString; - + +/** Adds a content type parameter.*/ +- (void) setContentTypeParameterValue:(NSString *)value forName:(NSString *)name; + +/** Remove a given content type parameter.*/ +- (void) removeContentTypeParameterForName:(NSString *)name; + +/** Returns the value of a given content type parameter.*/ +- (NSString *) contentTypeParameterValueForName:(NSString *)name; + +/** Returns an array with the names of all content type parameters.*/ +- (NSArray * /* NSString */) allContentTypeParametersNames; + @end #endif diff --git a/src/objc/rfc822/MCOAttachment.mm b/src/objc/rfc822/MCOAttachment.mm index afaf96af..18c13693 100644 --- a/src/objc/rfc822/MCOAttachment.mm +++ b/src/objc/rfc822/MCOAttachment.mm @@ -90,4 +90,23 @@ MCO_OBJC_SYNTHESIZE_DATA(setData, data) return [NSString mco_stringWithMCString:result]; } +- (void) setContentTypeParameterValue:(NSString *)value forName:(NSString *)name +{ + MCO_NATIVE_INSTANCE->setContentTypeParameter(MCO_FROM_OBJC(mailcore::String, name), MCO_FROM_OBJC(mailcore::String, value)); +} + +- (NSString *) contentTypeParameterValueForName:(NSString *)name +{ + return MCO_TO_OBJC(MCO_NATIVE_INSTANCE->contentTypeParameterValueForName((MCO_FROM_OBJC(mailcore::String, name)))); +} +- (void) removeContentTypeParameterForName:(NSString *)name +{ + MCO_NATIVE_INSTANCE->removeContentTypeParameter(MCO_FROM_OBJC(mailcore::String, name)); +} + +- (NSArray * /* NSString */) allContentTypeParametersNames +{ + return MCO_TO_OBJC(MCO_NATIVE_INSTANCE->allContentTypeParametersNames()); +} + @end diff --git a/src/objc/smtp/MCOSMTPSession.h b/src/objc/smtp/MCOSMTPSession.h index 5c616244..286cd7c3 100644 --- a/src/objc/smtp/MCOSMTPSession.h +++ b/src/objc/smtp/MCOSMTPSession.h @@ -30,7 +30,7 @@ /** This is the hostname of the SMTP server to connect to. */ @property (nonatomic, copy) NSString * hostname; -/** This is the port of the POP3 server to connect to. */ +/** This is the port of the SMTP server to connect to. */ @property (nonatomic, assign) unsigned int port; /** This is the username of the account. */ @@ -95,7 +95,7 @@ Generate RFC 822 data using MCOMessageBuilder - MCOPOPOperation * op = [session sendOperationWithData:rfc822Data]; + MCOSMTPOperation * op = [session sendOperationWithData:rfc822Data]; [op start:^(NSError * error) { ... }]; @@ -109,7 +109,7 @@ Generate RFC 822 data using MCOMessageBuilder - MCOPOPOperation * op = [session sendOperationWithData:rfc822Data + MCOSMTPOperation * op = [session sendOperationWithData:rfc822Data from:[MCOAddress addressWithMailbox:@"hoa@etpan.org"] recipients:[NSArray arrayWithObject:[MCOAddress addressWithMailbox:@"laura@etpan.org"]]]; [op start:^(NSError * error) { @@ -123,7 +123,7 @@ /** Returns an operation that will check whether the SMTP account is valid. - MCOPOPOperation * op = [session checkAccountOperationWithFrom:[MCOAddress addressWithMailbox:@"hoa@etpan.org"]]; + MCOSMTPOperation * op = [session checkAccountOperationWithFrom:[MCOAddress addressWithMailbox:@"hoa@etpan.org"]]; [op start:^(NSError * error) { ... }]; @@ -133,7 +133,7 @@ /** Returns an operation that will perform a No-Op. - MCOPOPOperation * op = [session noopOperation]; + MCOSMTPOperation * op = [session noopOperation]; [op start:^(NSError * error) { ... }]; diff --git a/src/objc/utils/NSError+MCO.mm b/src/objc/utils/NSError+MCO.mm index 6d49e4bb..09482d6b 100644 --- a/src/objc/utils/NSError+MCO.mm +++ b/src/objc/utils/NSError+MCO.mm @@ -57,7 +57,7 @@ static NSString * MCOLocalizedDescriptionTable[] = { } NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] init]; - if (code < MCOErrorCodeCount) { + if ((NSInteger) code < MCOErrorCodeCount) { NSString * localizedString = NSLocalizedStringFromTable(MCOLocalizedDescriptionTable[code], @"description of errors of mailcore", @"MailCore"); [userInfo setObject:localizedString forKey:NSLocalizedDescriptionKey]; } diff --git a/tests/test-all.mm b/tests/test-all.mm index 4c81a697..0f93b779 100644 --- a/tests/test-all.mm +++ b/tests/test-all.mm @@ -19,17 +19,17 @@ static mailcore::String * displayName = NULL; static mailcore::String * email = NULL; class TestOperation : public mailcore::Operation { - void main() - { - MCLog("coin %p", this); - } + void main() + { + MCLog("coin %p", this); + } }; class TestCallback : public mailcore::Object, public mailcore::OperationCallback { - virtual void operationFinished(mailcore::Operation * op) - { - MCLog("callback coin %p %p %s", this, op, MCUTF8DESC(this)); - } + virtual void operationFinished(mailcore::Operation * op) + { + MCLog("callback coin %p %p %s", this, op, MCUTF8DESC(this)); + } }; static mailcore::Data * testMessageBuilder() @@ -146,15 +146,35 @@ static void testPOP() session->release(); } +static void testNNTP() +{ + mailcore::NNTPSession * session; + mailcore::ErrorCode error; + + session = new mailcore::NNTPSession(); + session->setHostname(MCSTR("news.gmane.org.")); + session->setPort(119); +// session->setUsername(email); +// session->setPassword(password); + session->setConnectionType(mailcore::ConnectionTypeClear); + + session->checkAccount(&error); + mailcore::Array * messages = session->listAllNewsgroups(&error); + MCLog("%s", MCUTF8DESC(messages)); + + session->release(); + +} + static void testOperationQueue() { mailcore::OperationQueue * queue = new mailcore::OperationQueue(); - TestCallback * callback = new TestCallback(); - + TestCallback * callback = new TestCallback(); + for(unsigned int i = 0 ; i < 100 ; i ++) { mailcore::Operation * op = new TestOperation(); - op->setCallback(callback); + op->setCallback(callback); queue->addOperation(op); op->release(); } @@ -165,14 +185,14 @@ static void testOperationQueue() } class TestSMTPCallback : public mailcore::Object, public mailcore::OperationCallback, public mailcore::SMTPOperationCallback { - virtual void operationFinished(mailcore::Operation * op) - { - MCLog("callback %s %s", MCUTF8DESC(op), MCUTF8DESC(this)); - } + virtual void operationFinished(mailcore::Operation * op) + { + MCLog("callback %s %s", MCUTF8DESC(op), MCUTF8DESC(this)); + } virtual void bodyProgress(mailcore::SMTPOperation * op, unsigned int current, unsigned int maximum) { - MCLog("progress %s %s %i/%i", MCUTF8DESC(op), MCUTF8DESC(this), current, maximum); + MCLog("progress %s %s %i/%i", MCUTF8DESC(op), MCUTF8DESC(this), current, maximum); } }; @@ -200,20 +220,20 @@ static void testAsyncSMTP(mailcore::Data * data) } class TestIMAPCallback : public mailcore::Object, public mailcore::OperationCallback, public mailcore::IMAPOperationCallback { - virtual void operationFinished(mailcore::Operation * op) - { + virtual void operationFinished(mailcore::Operation * op) + { mailcore::IMAPFetchMessagesOperation * fetchOp = (mailcore::IMAPFetchMessagesOperation *) op; - //MCLog("callback %s %s %s", MCUTF8DESC(op), MCUTF8DESC(fetchOp->messages()), MCUTF8DESC(this)); - } + //MCLog("callback %s %s %s", MCUTF8DESC(op), MCUTF8DESC(fetchOp->messages()), MCUTF8DESC(this)); + } virtual void bodyProgress(mailcore::IMAPOperation * op, unsigned int current, unsigned int maximum) { - MCLog("progress %s %s %i/%i", MCUTF8DESC(op), MCUTF8DESC(this), current, maximum); + MCLog("progress %s %s %i/%i", MCUTF8DESC(op), MCUTF8DESC(this), current, maximum); } virtual void itemProgress(mailcore::IMAPOperation * op, unsigned int current, unsigned int maximum) { - MCLog("item progress %s %s %i/%i", MCUTF8DESC(op), MCUTF8DESC(this), current, maximum); + MCLog("item progress %s %s %i/%i", MCUTF8DESC(op), MCUTF8DESC(this), current, maximum); } }; @@ -244,15 +264,15 @@ static void testAsyncIMAP() } class TestPOPCallback : public mailcore::Object, public mailcore::OperationCallback, public mailcore::POPOperationCallback { - virtual void operationFinished(mailcore::Operation * op) - { + virtual void operationFinished(mailcore::Operation * op) + { mailcore::POPFetchMessagesOperation * fetchOp = (mailcore::POPFetchMessagesOperation *) op; - MCLog("callback %s %s", MCUTF8DESC(fetchOp->messages()), MCUTF8DESC(this)); - } + MCLog("callback %s %s", MCUTF8DESC(fetchOp->messages()), MCUTF8DESC(this)); + } virtual void bodyProgress(mailcore::IMAPOperation * op, unsigned int current, unsigned int maximum) { - MCLog("progress %s %s %i/%i", MCUTF8DESC(op), MCUTF8DESC(this), current, maximum); + MCLog("progress %s %s %i/%i", MCUTF8DESC(op), MCUTF8DESC(this), current, maximum); } }; @@ -281,30 +301,30 @@ static void testAsyncPOP() static void testAddresses() { - mailcore::Address *addr = mailcore::Address::addressWithNonEncodedRFC822String(MCSTR("DINH Viêt Hoà <hoa@etpan.org>")); + mailcore::Address *addr = mailcore::Address::addressWithNonEncodedRFC822String(MCSTR("DINH Viêt Hoà <hoa@etpan.org>")); MCLog("%s %s", MCUTF8DESC(addr->nonEncodedRFC822String()), MCUTF8DESC(addr->RFC822String())); - - mailcore::Array *addresses = mailcore::Address::addressesWithNonEncodedRFC822String(MCSTR("My Email1 <email1@gmail.com>, DINH Viêt Hoà <hoa@etpan.org>,\"Email3, My\" <my.email@gmail.com>")); + + mailcore::Array *addresses = mailcore::Address::addressesWithNonEncodedRFC822String(MCSTR("My Email1 <email1@gmail.com>, DINH Viêt Hoà <hoa@etpan.org>,\"Email3, My\" <my.email@gmail.com>")); MCLog("%s", MCUTF8DESC(addresses)); - mailcore::String *str = mailcore::Address::nonEncodedRFC822StringForAddresses(addresses); + mailcore::String *str = mailcore::Address::nonEncodedRFC822StringForAddresses(addresses); MCLog("%s", MCUTF8DESC(str)); - str = mailcore::Address::RFC822StringForAddresses(addresses); + str = mailcore::Address::RFC822StringForAddresses(addresses); MCLog("%s", MCUTF8DESC(str)); } static void testProviders() { - NSString *filename = [[NSBundle bundleForClass:[MCOMessageBuilder class]] pathForResource:@"providers" ofType:@"json"]; - mailcore::MailProvidersManager::sharedManager()->registerProvidersWithFilename(filename.mco_mcString); - - NSLog(@"Providers: %s", MCUTF8DESC(mailcore::MailProvidersManager::sharedManager()->providerForEmail(MCSTR("email1@gmail.com")))); + NSString *filename = [[NSBundle bundleForClass:[MCOMessageBuilder class]] pathForResource:@"providers" ofType:@"json"]; + mailcore::MailProvidersManager::sharedManager()->registerProvidersWithFilename(filename.mco_mcString); + + NSLog(@"Providers: %s", MCUTF8DESC(mailcore::MailProvidersManager::sharedManager()->providerForEmail(MCSTR("email1@gmail.com")))); } static void testAttachments() { - mailcore::Attachment *attachment = mailcore::Attachment::attachmentWithText(MCSTR("Hello World")); - attachment->setCharset(NULL); - mailcore::String * str = attachment->decodedString(); - MCLog("%s", MCUTF8DESC(str)); + mailcore::Attachment *attachment = mailcore::Attachment::attachmentWithText(MCSTR("Hello World")); + attachment->setCharset(NULL); + mailcore::String * str = attachment->decodedString(); + MCLog("%s", MCUTF8DESC(str)); } void testObjC() @@ -346,7 +366,7 @@ void testObjC() void testAll() { mailcore::setICUDataDirectory(MCSTR("/usr/local/share/icu")); - + email = MCSTR("email@gmail.com"); password = MCSTR("MyP4ssw0rd"); displayName = MCSTR("My Email"); @@ -360,12 +380,13 @@ void testAll() //testSMTP(data); //testIMAP(); //testPOP(); + //testNNTP(); //testAsyncSMTP(data); //testAsyncIMAP(); //testAsyncPOP(); //testAddresses(); - //testAttachments(); - //testProviders(); + //testAttachments(); + //testProviders(); //testObjC(); MCLog("pool release"); |