diff options
53 files changed, 3298 insertions, 44 deletions
diff --git a/build-mac/mailcore2.xcodeproj/project.pbxproj b/build-mac/mailcore2.xcodeproj/project.pbxproj index 1755556c..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 */, ); 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/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/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/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/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/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/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"); |