diff options
author | CodaFi <devteam.codafi@gmail.com> | 2014-08-16 12:11:02 -0600 |
---|---|---|
committer | CodaFi <devteam.codafi@gmail.com> | 2014-08-16 12:11:02 -0600 |
commit | 4958054e3cd65fe734e94d64d0ca1b8f8a36fe76 (patch) | |
tree | 3ea329a6b05c13400b96130f538a196e037c311f | |
parent | a55de9f78bfdc1e93fdf98b55d61669c867232b0 (diff) |
Tests
-rwxr-xr-x | build-mac/mailcore2.xcodeproj/project.pbxproj | 50 | ||||
-rw-r--r-- | src/async/nntp/MCNNTPAsyncSession.cc | 4 | ||||
-rw-r--r-- | src/async/nntp/MCNNTPAsyncSession.h | 6 | ||||
-rw-r--r-- | src/async/nntp/MCNNTPFetchArticlesOperation.h | 4 | ||||
-rw-r--r-- | src/core/MCCore.h | 1 | ||||
-rw-r--r-- | src/core/nntp/MCNNTP.h | 2 | ||||
-rw-r--r-- | src/core/nntp/MCNNTPArticleInfo.cc (renamed from src/core/nntp/MCNNTPMessageInfo.cc) | 34 | ||||
-rw-r--r-- | src/core/nntp/MCNNTPArticleInfo.h (renamed from src/core/nntp/MCNNTPMessageInfo.h) | 12 | ||||
-rw-r--r-- | src/core/nntp/MCNNTPSession.cc | 70 | ||||
-rw-r--r-- | src/core/nntp/MCNNTPSession.h | 8 | ||||
-rw-r--r-- | src/objc/nntp/MCONNTP.h | 2 | ||||
-rw-r--r-- | src/objc/nntp/MCONNTPArticleInfo.h (renamed from src/objc/nntp/MCONNTPMessageInfo.h) | 8 | ||||
-rw-r--r-- | src/objc/nntp/MCONNTPArticleInfo.mm (renamed from src/objc/nntp/MCONNTPMessageInfo.mm) | 16 | ||||
-rw-r--r-- | src/objc/nntp/MCONNTPFetchArticlesOperation.h | 4 | ||||
-rw-r--r-- | src/objc/nntp/MCONNTPSession.h | 2 | ||||
-rw-r--r-- | tests/test-all.mm | 107 |
16 files changed, 177 insertions, 153 deletions
diff --git a/build-mac/mailcore2.xcodeproj/project.pbxproj b/build-mac/mailcore2.xcodeproj/project.pbxproj index 8d26974e..87a95b2c 100755 --- a/build-mac/mailcore2.xcodeproj/project.pbxproj +++ b/build-mac/mailcore2.xcodeproj/project.pbxproj @@ -25,12 +25,13 @@ 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 */; }; - 849189A718C9477F002063A3 /* MCNNTPMessageInfo.cc in Sources */ = {isa = PBXBuildFile; fileRef = 849189A518C9477F002063A3 /* MCNNTPMessageInfo.cc */; }; - 849189A818C9477F002063A3 /* MCNNTPMessageInfo.cc in Sources */ = {isa = PBXBuildFile; fileRef = 849189A518C9477F002063A3 /* MCNNTPMessageInfo.cc */; }; + 849189A718C9477F002063A3 /* MCNNTPArticleInfo.cc in Sources */ = {isa = PBXBuildFile; fileRef = 849189A518C9477F002063A3 /* MCNNTPArticleInfo.cc */; }; + 849189A818C9477F002063A3 /* MCNNTPArticleInfo.cc in Sources */ = {isa = PBXBuildFile; fileRef = 849189A518C9477F002063A3 /* MCNNTPArticleInfo.cc */; }; 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 */; }; @@ -96,8 +97,8 @@ 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 */; }; - 84D73779199C00C9005124E5 /* MCONNTPMessageInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D73778199C00C9005124E5 /* MCONNTPMessageInfo.mm */; }; - 84D7377A199C00C9005124E5 /* MCONNTPMessageInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D73778199C00C9005124E5 /* MCONNTPMessageInfo.mm */; }; + 84D73779199C00C9005124E5 /* MCONNTPArticleInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D73778199C00C9005124E5 /* MCONNTPArticleInfo.mm */; }; + 84D7377A199C00C9005124E5 /* MCONNTPArticleInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84D73778199C00C9005124E5 /* MCONNTPArticleInfo.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 */; }; @@ -106,20 +107,20 @@ 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 */; }; - 84D73783199C010C005124E5 /* MCONNTPMessageInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73777199C00C9005124E5 /* MCONNTPMessageInfo.h */; }; + 84D73783199C010C005124E5 /* MCONNTPArticleInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73777199C00C9005124E5 /* MCONNTPArticleInfo.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 */; }; - 84D73788199C011C005124E5 /* MCONNTPMessageInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73777199C00C9005124E5 /* MCONNTPMessageInfo.h */; }; + 84D73788199C011C005124E5 /* MCONNTPArticleInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D73777199C00C9005124E5 /* MCONNTPArticleInfo.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 */; }; - 84E65531199BE10F00EC8CC4 /* MCNNTPMessageInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 849189A618C9477F002063A3 /* MCNNTPMessageInfo.h */; }; - 84E65532199BE11800EC8CC4 /* MCNNTPMessageInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 849189A618C9477F002063A3 /* MCNNTPMessageInfo.h */; }; + 84E65531199BE10F00EC8CC4 /* MCNNTPArticleInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 849189A618C9477F002063A3 /* MCNNTPArticleInfo.h */; }; + 84E65532199BE11800EC8CC4 /* MCNNTPArticleInfo.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 849189A618C9477F002063A3 /* MCNNTPArticleInfo.h */; }; 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 */; }; @@ -872,7 +873,7 @@ files = ( 849189A318C94023002063A3 /* MCNNTP.h in CopyFiles */, 849189A418C94023002063A3 /* MCNNTPSession.h in CopyFiles */, - 84E65531199BE10F00EC8CC4 /* MCNNTPMessageInfo.h in CopyFiles */, + 84E65531199BE10F00EC8CC4 /* MCNNTPArticleInfo.h in CopyFiles */, 84B639F317F2839C003B5BA2 /* MCOPOPNoopOperation.h in CopyFiles */, 84B639F417F2839C003B5BA2 /* MCIMAPNoopOperation.h in CopyFiles */, 84D7377B199C00F5005124E5 /* MCONNTP.h in CopyFiles */, @@ -941,7 +942,7 @@ C6F61FA0170187B80073032E /* MCOIMAPFolderInfoOperation.h in CopyFiles */, C6F61FA4170187C30073032E /* MCOIMAPFetchMessagesOperation.h in CopyFiles */, 84D73781199C010A005124E5 /* MCONNTPFetchArticleOperation.h in CopyFiles */, - 84D73783199C010C005124E5 /* MCONNTPMessageInfo.h in CopyFiles */, + 84D73783199C010C005124E5 /* MCONNTPArticleInfo.h in CopyFiles */, 84D73782199C010B005124E5 /* MCONNTPFetchArticlesOperation.h in CopyFiles */, C6F61FA3170187BD0073032E /* MCOIMAPCopyMessagesOperation.h in CopyFiles */, C6D6F95A171E5D60006F5B28 /* MCJSON.h in CopyFiles */, @@ -1095,9 +1096,10 @@ files = ( 849F53D817F28443002D417F /* MCOPOPNoopOperation.h in CopyFiles */, 849F53D917F28443002D417F /* MCIMAPNoopOperation.h in CopyFiles */, - 84E65532199BE11800EC8CC4 /* MCNNTPMessageInfo.h in CopyFiles */, + 84E65532199BE11800EC8CC4 /* MCNNTPArticleInfo.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 */, @@ -1110,7 +1112,7 @@ 84D73787199C011A005124E5 /* MCONNTPFetchArticlesOperation.h in CopyFiles */, 84391344199C3AB200FEFCDD /* MCONNTPDisconnectOperation.h in CopyFiles */, 84391343199C3AAA00FEFCDD /* MCONNTPListNewsgroupsOperation.h in CopyFiles */, - 84D73788199C011C005124E5 /* MCONNTPMessageInfo.h in CopyFiles */, + 84D73788199C011C005124E5 /* MCONNTPArticleInfo.h in CopyFiles */, 84D73786199C0118005124E5 /* MCONNTPFetchArticleOperation.h in CopyFiles */, 84391347199C3ABD00FEFCDD /* MCONNTPGroupInfo.h in CopyFiles */, 84D73749199BFACF005124E5 /* MCNNTPAsyncSession.h in CopyFiles */, @@ -1314,8 +1316,8 @@ 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>"; }; - 849189A518C9477F002063A3 /* MCNNTPMessageInfo.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MCNNTPMessageInfo.cc; path = nntp/MCNNTPMessageInfo.cc; sourceTree = "<group>"; }; - 849189A618C9477F002063A3 /* MCNNTPMessageInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MCNNTPMessageInfo.h; path = nntp/MCNNTPMessageInfo.h; sourceTree = "<group>"; }; + 849189A518C9477F002063A3 /* MCNNTPArticleInfo.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MCNNTPArticleInfo.cc; path = nntp/MCNNTPArticleInfo.cc; sourceTree = "<group>"; }; + 849189A618C9477F002063A3 /* MCNNTPArticleInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MCNNTPArticleInfo.h; path = nntp/MCNNTPArticleInfo.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>"; }; @@ -1358,8 +1360,8 @@ 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>"; }; - 84D73777199C00C9005124E5 /* MCONNTPMessageInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCONNTPMessageInfo.h; sourceTree = "<group>"; }; - 84D73778199C00C9005124E5 /* MCONNTPMessageInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCONNTPMessageInfo.mm; sourceTree = "<group>"; }; + 84D73777199C00C9005124E5 /* MCONNTPArticleInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCONNTPArticleInfo.h; sourceTree = "<group>"; }; + 84D73778199C00C9005124E5 /* MCONNTPArticleInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCONNTPArticleInfo.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>"; }; @@ -1841,8 +1843,8 @@ isa = PBXGroup; children = ( 8491899C18C93F92002063A3 /* MCNNTP.h */, - 849189A518C9477F002063A3 /* MCNNTPMessageInfo.cc */, - 849189A618C9477F002063A3 /* MCNNTPMessageInfo.h */, + 849189A518C9477F002063A3 /* MCNNTPArticleInfo.cc */, + 849189A618C9477F002063A3 /* MCNNTPArticleInfo.h */, 849189A918C94986002063A3 /* MCNNTPGroupInfo.cc */, 849189AA18C94986002063A3 /* MCNNTPGroupInfo.h */, 84D73732199BF754005124E5 /* MCNNTPProgressCallback.h */, @@ -1924,8 +1926,8 @@ 84D73774199C00AB005124E5 /* MCONNTPFetchArticlesOperation.mm */, 84D7378D199C02A8005124E5 /* MCONNTPDisconnectOperation.h */, 84D7378E199C02A8005124E5 /* MCONNTPDisconnectOperation.mm */, - 84D73777199C00C9005124E5 /* MCONNTPMessageInfo.h */, - 84D73778199C00C9005124E5 /* MCONNTPMessageInfo.mm */, + 84D73777199C00C9005124E5 /* MCONNTPArticleInfo.h */, + 84D73778199C00C9005124E5 /* MCONNTPArticleInfo.mm */, 84D73791199C0511005124E5 /* MCONNTPGroupInfo.h */, 84D73792199C0511005124E5 /* MCONNTPGroupInfo.mm */, ); @@ -2831,7 +2833,7 @@ C64EA71D169E847800778456 /* MCOperation.cc in Sources */, C64EA720169E847800778456 /* MCOperationQueue.cc in Sources */, C64EA723169E847800778456 /* MCIMAPFolder.cc in Sources */, - 84D73779199C00C9005124E5 /* MCONNTPMessageInfo.mm in Sources */, + 84D73779199C00C9005124E5 /* MCONNTPArticleInfo.mm in Sources */, C64EA725169E847800778456 /* MCIMAPMessage.cc in Sources */, C64EA727169E847800778456 /* MCIMAPMessagePart.cc in Sources */, 84D73775199C00AB005124E5 /* MCONNTPFetchArticlesOperation.mm in Sources */, @@ -2955,7 +2957,7 @@ C6F61F8717016AD60073032E /* MCOIMAPFetchContentOperation.mm in Sources */, C6F61F8A17016AE60073032E /* MCOIMAPSearchOperation.mm in Sources */, C6F61F8D17016AFB0073032E /* MCOIMAPIdleOperation.mm in Sources */, - 849189A718C9477F002063A3 /* MCNNTPMessageInfo.cc in Sources */, + 849189A718C9477F002063A3 /* MCNNTPArticleInfo.cc in Sources */, C6F61F9017016B0A0073032E /* MCOIMAPFetchNamespaceOperation.mm in Sources */, C6F61F9317016B250073032E /* MCOIMAPIdentityOperation.mm in Sources */, C6F61F9617016B310073032E /* MCOIMAPCapabilityOperation.mm in Sources */, @@ -3057,7 +3059,7 @@ C6BA2BAC1705F4E6003F0E9E /* MCOperation.cc in Sources */, C6BA2BAD1705F4E6003F0E9E /* MCOperationQueue.cc in Sources */, C6BA2BAE1705F4E6003F0E9E /* MCIMAPFolder.cc in Sources */, - 84D7377A199C00C9005124E5 /* MCONNTPMessageInfo.mm in Sources */, + 84D7377A199C00C9005124E5 /* MCONNTPArticleInfo.mm in Sources */, C6BA2BAF1705F4E6003F0E9E /* MCIMAPMessage.cc in Sources */, C6BA2BB01705F4E6003F0E9E /* MCIMAPMessagePart.cc in Sources */, 84D73776199C00AB005124E5 /* MCONNTPFetchArticlesOperation.mm in Sources */, @@ -3181,7 +3183,7 @@ C6BA2C0C1705F4E6003F0E9E /* MCOIMAPFetchContentOperation.mm in Sources */, C6BA2C0D1705F4E6003F0E9E /* MCOIMAPSearchOperation.mm in Sources */, C6BA2C0E1705F4E6003F0E9E /* MCOIMAPIdleOperation.mm in Sources */, - 849189A818C9477F002063A3 /* MCNNTPMessageInfo.cc in Sources */, + 849189A818C9477F002063A3 /* MCNNTPArticleInfo.cc in Sources */, C6BA2C0F1705F4E6003F0E9E /* MCOIMAPFetchNamespaceOperation.mm in Sources */, C6BA2C101705F4E6003F0E9E /* MCOIMAPIdentityOperation.mm in Sources */, C6BA2C111705F4E6003F0E9E /* MCOIMAPCapabilityOperation.mm in Sources */, diff --git a/src/async/nntp/MCNNTPAsyncSession.cc b/src/async/nntp/MCNNTPAsyncSession.cc index 84b5f318..fec7b31b 100644 --- a/src/async/nntp/MCNNTPAsyncSession.cc +++ b/src/async/nntp/MCNNTPAsyncSession.cc @@ -172,7 +172,7 @@ NNTPFetchHeaderOperation * NNTPAsyncSession::fetchHeaderOperation(String * group return op; } -NNTPFetchHeaderOperation * NNTPAsyncSession::fetchHeaderOperation(String * groupName, NNTPMessageInfo * msg) +NNTPFetchHeaderOperation * NNTPAsyncSession::fetchHeaderOperation(String * groupName, NNTPArticleInfo * msg) { return fetchHeaderOperation(groupName, msg->index()); } @@ -187,7 +187,7 @@ NNTPFetchArticleOperation * NNTPAsyncSession::fetchArticleOperation(String * gro return op; } -NNTPFetchArticleOperation * NNTPAsyncSession::fetchArticleOperation(String *groupName, NNTPMessageInfo * msg) +NNTPFetchArticleOperation * NNTPAsyncSession::fetchArticleOperation(String *groupName, NNTPArticleInfo * msg) { return fetchArticleOperation(groupName, msg->index()); } diff --git a/src/async/nntp/MCNNTPAsyncSession.h b/src/async/nntp/MCNNTPAsyncSession.h index 501985bc..90557326 100644 --- a/src/async/nntp/MCNNTPAsyncSession.h +++ b/src/async/nntp/MCNNTPAsyncSession.h @@ -9,7 +9,7 @@ namespace mailcore { class NNTPOperation; - class NNTPMessageInfo; + class NNTPArticleInfo; class NNTPSession; class NNTPFetchHeaderOperation; class NNTPFetchArticleOperation; @@ -55,10 +55,10 @@ namespace mailcore { virtual MCNNTPFetchArticlesOperation * fetchArticlesOperation(String * group); virtual NNTPFetchHeaderOperation * fetchHeaderOperation(String * groupName, unsigned int index); - virtual NNTPFetchHeaderOperation * fetchHeaderOperation(String * groupName, NNTPMessageInfo * msg); + virtual NNTPFetchHeaderOperation * fetchHeaderOperation(String * groupName, NNTPArticleInfo * msg); virtual NNTPFetchArticleOperation * fetchArticleOperation(String *groupName, unsigned int index); - virtual NNTPFetchArticleOperation * fetchArticleOperation(String *groupName, NNTPMessageInfo * msg); + virtual NNTPFetchArticleOperation * fetchArticleOperation(String *groupName, NNTPArticleInfo * msg); virtual NNTPListNewsgroupsOperation * listAllNewsgroupsOperation(); virtual NNTPListNewsgroupsOperation * listSubscribedNewsgroupsOperation(); diff --git a/src/async/nntp/MCNNTPFetchArticlesOperation.h b/src/async/nntp/MCNNTPFetchArticlesOperation.h index 9fe6fd1b..28f326ab 100644 --- a/src/async/nntp/MCNNTPFetchArticlesOperation.h +++ b/src/async/nntp/MCNNTPFetchArticlesOperation.h @@ -24,14 +24,14 @@ namespace mailcore { virtual void setGroupName(String * groupName); virtual String * groupName(); - virtual Array * /* NNTPMessageInfo */ messages(); + virtual Array * /* NNTPArticleInfo */ messages(); public: // subclass behavior virtual void main(); private: String * mGroupName; - Array * /* NNTPMessageInfo */ mMessages; + Array * /* NNTPArticleInfo */ mMessages; }; } 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/nntp/MCNNTP.h b/src/core/nntp/MCNNTP.h index beec18bb..dd18a961 100644 --- a/src/core/nntp/MCNNTP.h +++ b/src/core/nntp/MCNNTP.h @@ -3,7 +3,7 @@ #define MAILCORE_MCNNTP_H #include <MailCore/MCNNTPGroupInfo.h> -#include <MailCore/MCNNTPMessageInfo.h> +#include <MailCore/MCNNTPArticleInfo.h> #include <MailCore/MCNNTPProgressCallback.h> #include <MailCore/MCNNTPSession.h> diff --git a/src/core/nntp/MCNNTPMessageInfo.cc b/src/core/nntp/MCNNTPArticleInfo.cc index 474de9b3..e3f05998 100644 --- a/src/core/nntp/MCNNTPMessageInfo.cc +++ b/src/core/nntp/MCNNTPArticleInfo.cc @@ -1,23 +1,29 @@ // -// MCNNTPMessageInfo.cpp +// MCNNTPArticleInfo.cpp // mailcore2 // // Created by Robert Widmann on 3/6/14. // Copyright (c) 2014 MailCore. All rights reserved. // -#include "MCNNTPMessageInfo.h" +#include "MCNNTPArticleInfo.h" using namespace mailcore; -void NNTPMessageInfo::init() + +void NNTPArticleInfo::init() { mIndex = 0; mSize = 0; mUid = NULL; } -NNTPMessageInfo::NNTPMessageInfo(NNTPMessageInfo * other) +NNTPArticleInfo::NNTPArticleInfo() +{ + init(); +} + +NNTPArticleInfo::NNTPArticleInfo(NNTPArticleInfo * other) { init(); mIndex = other->mIndex; @@ -25,48 +31,48 @@ NNTPMessageInfo::NNTPMessageInfo(NNTPMessageInfo * other) MC_SAFE_REPLACE_COPY(String, mUid, other->mUid); } -NNTPMessageInfo::~NNTPMessageInfo() +NNTPArticleInfo::~NNTPArticleInfo() { MC_SAFE_RELEASE(mUid); } -String * NNTPMessageInfo::description() +String * NNTPArticleInfo::description() { return String::stringWithUTF8Format("<%s:%p %u %s %u>", MCUTF8(className()), this, mIndex, MCUTF8(mUid), mSize); } -Object * NNTPMessageInfo::copy() +Object * NNTPArticleInfo::copy() { - return new NNTPMessageInfo(this); + return new NNTPArticleInfo(this); } -void NNTPMessageInfo::setIndex(unsigned int index) +void NNTPArticleInfo::setIndex(unsigned int index) { mIndex = index; } -unsigned int NNTPMessageInfo::index() +unsigned int NNTPArticleInfo::index() { return mIndex; } -void NNTPMessageInfo::setSize(unsigned int size) +void NNTPArticleInfo::setSize(unsigned int size) { mSize = size; } -unsigned int NNTPMessageInfo::size() +unsigned int NNTPArticleInfo::size() { return mSize; } -void NNTPMessageInfo::setUid(String * uid) +void NNTPArticleInfo::setUid(String * uid) { MC_SAFE_REPLACE_COPY(String, mUid, uid); } -String * NNTPMessageInfo::uid() +String * NNTPArticleInfo::uid() { return mUid; } diff --git a/src/core/nntp/MCNNTPMessageInfo.h b/src/core/nntp/MCNNTPArticleInfo.h index 8522dd0b..7fa90e19 100644 --- a/src/core/nntp/MCNNTPMessageInfo.h +++ b/src/core/nntp/MCNNTPArticleInfo.h @@ -1,6 +1,6 @@ -#ifndef MAILCORE_MCNNTPMESSAGEINFO_H +#ifndef MAILCORE_MCNNTPARTICLEINFO_H -#define MAILCORE_MCNNTPMESSAGEINFO_H +#define MAILCORE_MCNNTPARTICLEINFO_H #include <MailCore/MCBaseTypes.h> @@ -8,10 +8,10 @@ namespace mailcore { - class NNTPMessageInfo : public Object { + class NNTPArticleInfo : public Object { public: - NNTPMessageInfo(); - virtual ~NNTPMessageInfo(); + NNTPArticleInfo(); + virtual ~NNTPArticleInfo(); virtual void setIndex(unsigned int index); virtual unsigned int index(); @@ -23,7 +23,7 @@ namespace mailcore { virtual String * uid(); public: // subclass behavior - NNTPMessageInfo(NNTPMessageInfo * other); + NNTPArticleInfo(NNTPArticleInfo * other); virtual String * description(); virtual Object * copy(); diff --git a/src/core/nntp/MCNNTPSession.cc b/src/core/nntp/MCNNTPSession.cc index a31abb1d..d8cf2632 100644 --- a/src/core/nntp/MCNNTPSession.cc +++ b/src/core/nntp/MCNNTPSession.cc @@ -11,7 +11,7 @@ #include <string.h> #include <libetpan/libetpan.h> -#include "MCNNTPMessageInfo.h" +#include "MCNNTPArticleInfo.h" #include "MCNNTPGroupInfo.h" #include "MCMessageHeader.h" #include "MCConnectionLoggerUtils.h" @@ -175,8 +175,9 @@ void NNTPSession::unsetup() void NNTPSession::loginIfNeeded(ErrorCode * pError) { connectIfNeeded(pError); - if (* pError != ErrorNone) + if (* pError != ErrorNone) { return; + } if (mState == STATE_CONNECTED) { login(pError); @@ -203,38 +204,30 @@ void NNTPSession::readerIfNeeded(ErrorCode * pError) void NNTPSession::login(ErrorCode * pError) { int r; - const char * utf8username; - const char * utf8password; - - utf8username = MCUTF8(username()); - utf8password = MCUTF8(password()); - if (utf8username == NULL) { - utf8username = ""; - } - if (utf8password == NULL) { - utf8password = ""; - } - - r = newsnntp_authinfo_username(mNNTP, utf8username); - if (r == NEWSNNTP_ERROR_STREAM) { - * pError = ErrorConnection; - return; - } - else if (r != NEWSNNTP_NO_ERROR) { - * pError = ErrorAuthentication; - return; - } - - r = newsnntp_authinfo_password(mNNTP, utf8password); - if (r == NEWSNNTP_ERROR_STREAM) { - * pError = ErrorConnection; - return; + + 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; + } } - 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; } @@ -388,7 +381,8 @@ Array * NNTPSession::listSubscribedNewsgroups(ErrorCode * pError) grp_info = (struct newsnntp_group_info *) clist_content(iter); - name = String::stringWithUTF8Characters(grp_info->grp_name); + name = String::stringWithUTF8Characters(strdup(grp_info->grp_name)); + name->retain(); NNTPGroupInfo * info = new NNTPGroupInfo(); info->setName(name); @@ -437,7 +431,7 @@ MessageHeader * NNTPSession::fetchHeader(String *groupName, unsigned int index, return result; } -MessageHeader * NNTPSession::fetchHeader(String *groupName, NNTPMessageInfo * msg, ErrorCode * pError) +MessageHeader * NNTPSession::fetchHeader(String *groupName, NNTPArticleInfo * msg, ErrorCode * pError) { return fetchHeader(groupName, msg->index(), pError); } @@ -478,7 +472,7 @@ Data * NNTPSession::fetchArticle(String *groupName, unsigned int index, NNTPProg return result; } -Data * NNTPSession::fetchArticle(String *groupName, NNTPMessageInfo * msg, NNTPProgressCallback * callback, ErrorCode * pError) +Data * NNTPSession::fetchArticle(String *groupName, NNTPArticleInfo * msg, NNTPProgressCallback * callback, ErrorCode * pError) { return fetchArticle(groupName, msg->index(), callback, pError); } @@ -494,11 +488,11 @@ Array * NNTPSession::fetchArticles(String * groupName, ErrorCode * pError) } r = newsnntp_listgroup(mNNTP, groupName->UTF8Characters(), &msg_list); - if (r == MAILPOP3_ERROR_STREAM) { + if (r == NEWSNNTP_ERROR_STREAM) { * pError = ErrorConnection; return NULL; } - else if (r != MAILPOP3_NO_ERROR) { + else if (r != NEWSNNTP_NO_ERROR) { * pError = ErrorFetchMessageList; return NULL; } @@ -513,7 +507,7 @@ Array * NNTPSession::fetchArticles(String * groupName, ErrorCode * pError) continue; } - NNTPMessageInfo * info = new NNTPMessageInfo(); + NNTPArticleInfo * info = new NNTPArticleInfo(); info->setIndex(*msg_info); result->addObject(info); info->release(); diff --git a/src/core/nntp/MCNNTPSession.h b/src/core/nntp/MCNNTPSession.h index d166354c..bdeb3bc1 100644 --- a/src/core/nntp/MCNNTPSession.h +++ b/src/core/nntp/MCNNTPSession.h @@ -8,7 +8,7 @@ namespace mailcore { - class NNTPMessageInfo; + class NNTPArticleInfo; class NNTPProgressCallback; class MessageHeader; @@ -49,12 +49,12 @@ namespace mailcore { virtual Array * listSubscribedNewsgroups(ErrorCode * pError); virtual MessageHeader * fetchHeader(String *groupName, unsigned int index, ErrorCode * pError); - virtual MessageHeader * fetchHeader(String *groupName, NNTPMessageInfo * msg, ErrorCode * pError); + virtual MessageHeader * fetchHeader(String *groupName, NNTPArticleInfo * msg, ErrorCode * pError); - virtual Array * /* NNTPMessageInfo */ fetchArticles(String * groupname, ErrorCode * pError); + virtual Array * /* NNTPArticleInfo */ fetchArticles(String * groupname, ErrorCode * pError); Data * fetchArticle(String *groupName, unsigned int index, NNTPProgressCallback * callback, ErrorCode * pError); - Data * fetchArticle(String *groupName, NNTPMessageInfo * msg, NNTPProgressCallback * callback, ErrorCode * pError); + Data * fetchArticle(String *groupName, NNTPArticleInfo * msg, NNTPProgressCallback * callback, ErrorCode * pError); virtual void setConnectionLogger(ConnectionLogger * logger); virtual ConnectionLogger * connectionLogger(); diff --git a/src/objc/nntp/MCONNTP.h b/src/objc/nntp/MCONNTP.h index 20eb035b..a1328166 100644 --- a/src/objc/nntp/MCONNTP.h +++ b/src/objc/nntp/MCONNTP.h @@ -16,7 +16,7 @@ #include <MailCore/MCONNTPFetchArticleOperation.h> #include <MailCore/MCONNTPFetchArticlesOperation.h> #include <MailCore/MCONNTPListNewsgroupsOperation.h> -#include <MailCore/MCONNTPMessageInfo.h> +#include <MailCore/MCONNTPArticleInfo.h> #include <MailCore/MCONNTPGroupInfo.h> #endif diff --git a/src/objc/nntp/MCONNTPMessageInfo.h b/src/objc/nntp/MCONNTPArticleInfo.h index d4f06b04..5e2a6887 100644 --- a/src/objc/nntp/MCONNTPMessageInfo.h +++ b/src/objc/nntp/MCONNTPArticleInfo.h @@ -1,20 +1,20 @@ // -// MCONNTPMessageInfo.h +// MCONNTPArticleInfo.h // mailcore2 // // Created by Robert Widmann on 8/13/14. // Copyright (c) 2014 MailCore. All rights reserved. // -#ifndef MAILCORE_MCONNTPMESSAGEINFO_H +#ifndef MAILCORE_MCONNTPARTICLEINFO_H -#define MAILCORE_MCONNTPMESSAGEINFO_H +#define MAILCORE_MCONNTPARTICLEINFO_H #import <Foundation/Foundation.h> /** This is information of a message fetched by MCONNTPFetchArticlesOperation.*/ -@interface MCONNTPMessageInfo : NSObject <NSCopying> +@interface MCONNTPArticleInfo : NSObject <NSCopying> /** This is the index of a given message.*/ @property (nonatomic, assign) unsigned int index; diff --git a/src/objc/nntp/MCONNTPMessageInfo.mm b/src/objc/nntp/MCONNTPArticleInfo.mm index f69267ab..61f226f8 100644 --- a/src/objc/nntp/MCONNTPMessageInfo.mm +++ b/src/objc/nntp/MCONNTPArticleInfo.mm @@ -1,23 +1,23 @@ // -// MCONNTPMessageInfo.m +// MCONNTPArticleInfo.m // mailcore2 // // Created by Robert Widmann on 8/13/14. // Copyright (c) 2014 MailCore. All rights reserved. // -#import "MCONNTPMessageInfo.h" +#import "MCONNTPArticleInfo.h" #include "MCAsyncNNTP.h" #include "MCNNTP.h" #import "MCOUtils.h" -@implementation MCONNTPMessageInfo { - mailcore::NNTPMessageInfo * _nativeInfo; +@implementation MCONNTPArticleInfo { + mailcore::NNTPArticleInfo * _nativeInfo; } -#define nativeType mailcore::NNTPMessageInfo +#define nativeType mailcore::NNTPArticleInfo + (void) load { @@ -34,8 +34,8 @@ + (NSObject *) mco_objectWithMCObject:(mailcore::Object *)object { - mailcore::NNTPMessageInfo * folder = (mailcore::NNTPMessageInfo *) object; - return [[[self alloc] initWithMCNNTPMessageInfo:folder] autorelease]; + mailcore::NNTPArticleInfo * folder = (mailcore::NNTPArticleInfo *) object; + return [[[self alloc] initWithMCNNTPArticleInfo:folder] autorelease]; } - (mailcore::Object *) mco_mcObject @@ -48,7 +48,7 @@ return MCO_OBJC_BRIDGE_GET(description); } -- (id) initWithMCNNTPMessageInfo:(mailcore::NNTPMessageInfo *)info +- (id) initWithMCNNTPArticleInfo:(mailcore::NNTPArticleInfo *)info { self = [super init]; diff --git a/src/objc/nntp/MCONNTPFetchArticlesOperation.h b/src/objc/nntp/MCONNTPFetchArticlesOperation.h index bd28d99d..6d2a9dab 100644 --- a/src/objc/nntp/MCONNTPFetchArticlesOperation.h +++ b/src/objc/nntp/MCONNTPFetchArticlesOperation.h @@ -22,12 +22,12 @@ @param completionBlock Called when the operation is finished. - - On success `error` will be nil and `messages` will be an array of MCONNTPMessageInfo + - On success `error` will be nil and `messages` will be an array of MCONNTPArticleInfo - 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 * /* MCONNTPMessageInfo */ messages))completionBlock; +- (void) start:(void (^)(NSError * error, NSArray * /* MCONNTPArticleInfo */ messages))completionBlock; @end diff --git a/src/objc/nntp/MCONNTPSession.h b/src/objc/nntp/MCONNTPSession.h index 6d6ea26f..89795087 100644 --- a/src/objc/nntp/MCONNTPSession.h +++ b/src/objc/nntp/MCONNTPSession.h @@ -70,7 +70,7 @@ MCONNTPFetchArticlesOperation * op = [session fetchMessagesOperation]; [op start:^(NSError * error, NSArray * messages) { - // messages is an array of MCONNTPMessageInfo + // messages is an array of MCONNTPArticleInfo // [info index] can be used as reference for a given message in the other operations. }]; */ 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"); |