EmailScheduler Start.
This commit is contained in:
commit
3f0bc2ba58
431
EmailScheduler.xcodeproj/project.pbxproj
Normal file
431
EmailScheduler.xcodeproj/project.pbxproj
Normal file
@ -0,0 +1,431 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXAggregateTarget section */
|
||||
2A452C8119C476C30095EEF6 /* Build Directory */ = {
|
||||
isa = PBXAggregateTarget;
|
||||
buildConfigurationList = 2A452C8219C476C30095EEF6 /* Build configuration list for PBXAggregateTarget "Build Directory" */;
|
||||
buildPhases = (
|
||||
2A452C8519C476C60095EEF6 /* ShellScript */,
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "Build Directory";
|
||||
productName = "Build Directory";
|
||||
};
|
||||
/* End PBXAggregateTarget section */
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
2A452C7019C475790095EEF6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A452C6F19C475790095EEF6 /* Foundation.framework */; };
|
||||
2A452C7319C475790095EEF6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A452C7219C475790095EEF6 /* main.m */; };
|
||||
2A452C7719C475790095EEF6 /* EmailScheduler.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2A452C7619C475790095EEF6 /* EmailScheduler.1 */; };
|
||||
2A452C7E19C476900095EEF6 /* MailCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A452C7D19C476900095EEF6 /* MailCore.framework */; };
|
||||
2A452C8019C476A40095EEF6 /* MailCore.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2A452C7D19C476900095EEF6 /* MailCore.framework */; };
|
||||
2A452C8A19C4776A0095EEF6 /* MGMController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A452C8919C4776A0095EEF6 /* MGMController.m */; };
|
||||
2A452C9719C479030095EEF6 /* MGMHTTPAddons.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A452C8D19C479030095EEF6 /* MGMHTTPAddons.m */; };
|
||||
2A452C9819C479030095EEF6 /* MGMHTTPClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A452C8F19C479030095EEF6 /* MGMHTTPClient.m */; };
|
||||
2A452C9A19C479030095EEF6 /* MGMHTTPResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A452C9419C479030095EEF6 /* MGMHTTPResponse.m */; };
|
||||
2A452C9B19C479030095EEF6 /* MGMHTTPServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A452C9619C479030095EEF6 /* MGMHTTPServer.m */; };
|
||||
2A452C9E19C47A160095EEF6 /* AsyncSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A452C9D19C47A160095EEF6 /* AsyncSocket.m */; };
|
||||
2A452CA119C47B7D0095EEF6 /* MGMHTTPClientClass.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A452CA019C47B7D0095EEF6 /* MGMHTTPClientClass.m */; };
|
||||
2A452CA519C481C70095EEF6 /* MGMJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A452CA419C481C70095EEF6 /* MGMJSON.m */; };
|
||||
2A452CA819C4850A0095EEF6 /* MGMEmail.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A452CA719C4850A0095EEF6 /* MGMEmail.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
2A452C8619C476D70095EEF6 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 2A452C6419C475790095EEF6 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 2A452C8119C476C30095EEF6;
|
||||
remoteInfo = "Build Directory";
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
2A452C6A19C475790095EEF6 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
2A452C7719C475790095EEF6 /* EmailScheduler.1 in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
2A452C7F19C4769D0095EEF6 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
2A452C8019C476A40095EEF6 /* MailCore.framework in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
2A452C6C19C475790095EEF6 /* EmailScheduler */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = EmailScheduler; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2A452C6F19C475790095EEF6 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
2A452C7219C475790095EEF6 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
2A452C7519C475790095EEF6 /* EmailScheduler-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "EmailScheduler-Prefix.pch"; sourceTree = "<group>"; };
|
||||
2A452C7619C475790095EEF6 /* EmailScheduler.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = EmailScheduler.1; sourceTree = "<group>"; };
|
||||
2A452C7D19C476900095EEF6 /* MailCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = MailCore.framework; sourceTree = "<group>"; };
|
||||
2A452C8819C4776A0095EEF6 /* MGMController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGMController.h; sourceTree = "<group>"; };
|
||||
2A452C8919C4776A0095EEF6 /* MGMController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGMController.m; sourceTree = "<group>"; };
|
||||
2A452C8C19C479030095EEF6 /* MGMHTTPAddons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGMHTTPAddons.h; sourceTree = "<group>"; };
|
||||
2A452C8D19C479030095EEF6 /* MGMHTTPAddons.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGMHTTPAddons.m; sourceTree = "<group>"; };
|
||||
2A452C8E19C479030095EEF6 /* MGMHTTPClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGMHTTPClient.h; sourceTree = "<group>"; };
|
||||
2A452C8F19C479030095EEF6 /* MGMHTTPClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGMHTTPClient.m; sourceTree = "<group>"; };
|
||||
2A452C9219C479030095EEF6 /* MGMHTTPDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGMHTTPDefines.h; sourceTree = "<group>"; };
|
||||
2A452C9319C479030095EEF6 /* MGMHTTPResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGMHTTPResponse.h; sourceTree = "<group>"; };
|
||||
2A452C9419C479030095EEF6 /* MGMHTTPResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGMHTTPResponse.m; sourceTree = "<group>"; };
|
||||
2A452C9519C479030095EEF6 /* MGMHTTPServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGMHTTPServer.h; sourceTree = "<group>"; };
|
||||
2A452C9619C479030095EEF6 /* MGMHTTPServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGMHTTPServer.m; sourceTree = "<group>"; };
|
||||
2A452C9C19C47A160095EEF6 /* AsyncSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncSocket.h; sourceTree = "<group>"; };
|
||||
2A452C9D19C47A160095EEF6 /* AsyncSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AsyncSocket.m; sourceTree = "<group>"; };
|
||||
2A452C9F19C47B7D0095EEF6 /* MGMHTTPClientClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGMHTTPClientClass.h; sourceTree = "<group>"; };
|
||||
2A452CA019C47B7D0095EEF6 /* MGMHTTPClientClass.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGMHTTPClientClass.m; sourceTree = "<group>"; };
|
||||
2A452CA319C481C70095EEF6 /* MGMJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGMJSON.h; sourceTree = "<group>"; };
|
||||
2A452CA419C481C70095EEF6 /* MGMJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGMJSON.m; sourceTree = "<group>"; };
|
||||
2A452CA619C4850A0095EEF6 /* MGMEmail.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGMEmail.h; sourceTree = "<group>"; };
|
||||
2A452CA719C4850A0095EEF6 /* MGMEmail.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGMEmail.m; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
2A452C6919C475790095EEF6 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2A452C7E19C476900095EEF6 /* MailCore.framework in Frameworks */,
|
||||
2A452C7019C475790095EEF6 /* Foundation.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
2A452C6319C475790095EEF6 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2A452C7D19C476900095EEF6 /* MailCore.framework */,
|
||||
2A452C7119C475790095EEF6 /* EmailScheduler */,
|
||||
2A452C6E19C475790095EEF6 /* Frameworks */,
|
||||
2A452C6D19C475790095EEF6 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2A452C6D19C475790095EEF6 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2A452C6C19C475790095EEF6 /* EmailScheduler */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2A452C6E19C475790095EEF6 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2A452C6F19C475790095EEF6 /* Foundation.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2A452C7119C475790095EEF6 /* EmailScheduler */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2A452C7219C475790095EEF6 /* main.m */,
|
||||
2A452C7619C475790095EEF6 /* EmailScheduler.1 */,
|
||||
2A452C7419C475790095EEF6 /* Supporting Files */,
|
||||
2A452CA219C481C70095EEF6 /* JSON */,
|
||||
2A452C8B19C479030095EEF6 /* MGMHTTP */,
|
||||
2A452C8819C4776A0095EEF6 /* MGMController.h */,
|
||||
2A452C8919C4776A0095EEF6 /* MGMController.m */,
|
||||
2A452C9F19C47B7D0095EEF6 /* MGMHTTPClientClass.h */,
|
||||
2A452CA019C47B7D0095EEF6 /* MGMHTTPClientClass.m */,
|
||||
2A452CA619C4850A0095EEF6 /* MGMEmail.h */,
|
||||
2A452CA719C4850A0095EEF6 /* MGMEmail.m */,
|
||||
);
|
||||
path = EmailScheduler;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2A452C7419C475790095EEF6 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2A452C7519C475790095EEF6 /* EmailScheduler-Prefix.pch */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2A452C8B19C479030095EEF6 /* MGMHTTP */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2A452C9C19C47A160095EEF6 /* AsyncSocket.h */,
|
||||
2A452C9D19C47A160095EEF6 /* AsyncSocket.m */,
|
||||
2A452C8C19C479030095EEF6 /* MGMHTTPAddons.h */,
|
||||
2A452C8D19C479030095EEF6 /* MGMHTTPAddons.m */,
|
||||
2A452C8E19C479030095EEF6 /* MGMHTTPClient.h */,
|
||||
2A452C8F19C479030095EEF6 /* MGMHTTPClient.m */,
|
||||
2A452C9219C479030095EEF6 /* MGMHTTPDefines.h */,
|
||||
2A452C9319C479030095EEF6 /* MGMHTTPResponse.h */,
|
||||
2A452C9419C479030095EEF6 /* MGMHTTPResponse.m */,
|
||||
2A452C9519C479030095EEF6 /* MGMHTTPServer.h */,
|
||||
2A452C9619C479030095EEF6 /* MGMHTTPServer.m */,
|
||||
);
|
||||
path = MGMHTTP;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2A452CA219C481C70095EEF6 /* JSON */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2A452CA319C481C70095EEF6 /* MGMJSON.h */,
|
||||
2A452CA419C481C70095EEF6 /* MGMJSON.m */,
|
||||
);
|
||||
path = JSON;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
2A452C6B19C475790095EEF6 /* EmailScheduler */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 2A452C7A19C475790095EEF6 /* Build configuration list for PBXNativeTarget "EmailScheduler" */;
|
||||
buildPhases = (
|
||||
2A452C6819C475790095EEF6 /* Sources */,
|
||||
2A452C6919C475790095EEF6 /* Frameworks */,
|
||||
2A452C6A19C475790095EEF6 /* CopyFiles */,
|
||||
2A452C7F19C4769D0095EEF6 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
2A452C8719C476D70095EEF6 /* PBXTargetDependency */,
|
||||
);
|
||||
name = EmailScheduler;
|
||||
productName = EmailScheduler;
|
||||
productReference = 2A452C6C19C475790095EEF6 /* EmailScheduler */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
2A452C6419C475790095EEF6 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0510;
|
||||
ORGANIZATIONNAME = "Mr. Gecko's Media";
|
||||
};
|
||||
buildConfigurationList = 2A452C6719C475790095EEF6 /* Build configuration list for PBXProject "EmailScheduler" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 2A452C6319C475790095EEF6;
|
||||
productRefGroup = 2A452C6D19C475790095EEF6 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
2A452C6B19C475790095EEF6 /* EmailScheduler */,
|
||||
2A452C8119C476C30095EEF6 /* Build Directory */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
2A452C8519C476C60095EEF6 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "#!/bin/bash\n#\n# Build Directory\n#\n# Created by Mr. Gecko <GRMrGecko@gmail.com> on 4/21/11.\n# No Copyright Claimed. Public Domain.\n#\n# DISCLAIMER: This script is provided as-is. I am not responsible if this script somehow causes harm to you or your system in any way, I am providing this for free in hope that it will of use to someone. I WILL NOT pay you any amount of money if anything happen to your data or you because of the changes this script makes nor am I obligated to help you fix issues this causes.\n#\n\nif [ \"$SRCROOT/build\" != \"$SYMROOT\" ]; then\n if [ -d \"$SRCROOT/build\" ]; then\n /bin/rm -Rf \"$SRCROOT/build\"\n fi\n /bin/ln -fs \"$SYMROOT\" \"$SRCROOT/build\"\nfi";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
2A452C6819C475790095EEF6 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2A452C9A19C479030095EEF6 /* MGMHTTPResponse.m in Sources */,
|
||||
2A452C7319C475790095EEF6 /* main.m in Sources */,
|
||||
2A452CA819C4850A0095EEF6 /* MGMEmail.m in Sources */,
|
||||
2A452C9B19C479030095EEF6 /* MGMHTTPServer.m in Sources */,
|
||||
2A452C8A19C4776A0095EEF6 /* MGMController.m in Sources */,
|
||||
2A452C9819C479030095EEF6 /* MGMHTTPClient.m in Sources */,
|
||||
2A452CA519C481C70095EEF6 /* MGMJSON.m in Sources */,
|
||||
2A452CA119C47B7D0095EEF6 /* MGMHTTPClientClass.m in Sources */,
|
||||
2A452C9719C479030095EEF6 /* MGMHTTPAddons.m in Sources */,
|
||||
2A452C9E19C47A160095EEF6 /* AsyncSocket.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
2A452C8719C476D70095EEF6 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 2A452C8119C476C30095EEF6 /* Build Directory */;
|
||||
targetProxy = 2A452C8619C476D70095EEF6 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
2A452C7819C475790095EEF6 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
2A452C7919C475790095EEF6 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
2A452C7B19C475790095EEF6 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_OBJC_ARC = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "EmailScheduler/EmailScheduler-Prefix.pch";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
2A452C7C19C475790095EEF6 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_OBJC_ARC = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "EmailScheduler/EmailScheduler-Prefix.pch";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
2A452C8319C476C30095EEF6 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
2A452C8419C476C30095EEF6 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
2A452C6719C475790095EEF6 /* Build configuration list for PBXProject "EmailScheduler" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
2A452C7819C475790095EEF6 /* Debug */,
|
||||
2A452C7919C475790095EEF6 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
2A452C7A19C475790095EEF6 /* Build configuration list for PBXNativeTarget "EmailScheduler" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
2A452C7B19C475790095EEF6 /* Debug */,
|
||||
2A452C7C19C475790095EEF6 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
2A452C8219C476C30095EEF6 /* Build configuration list for PBXAggregateTarget "Build Directory" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
2A452C8319C476C30095EEF6 /* Debug */,
|
||||
2A452C8419C476C30095EEF6 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 2A452C6419C475790095EEF6 /* Project object */;
|
||||
}
|
7
EmailScheduler.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
EmailScheduler.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:EmailScheduler.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
Binary file not shown.
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2A452C8119C476C30095EEF6"
|
||||
BuildableName = "Build Directory"
|
||||
BlueprintName = "Build Directory"
|
||||
ReferencedContainer = "container:EmailScheduler.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
allowLocationSimulation = "YES">
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2A452C6B19C475790095EEF6"
|
||||
BuildableName = "EmailScheduler"
|
||||
BlueprintName = "EmailScheduler"
|
||||
ReferencedContainer = "container:EmailScheduler.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2A452C6B19C475790095EEF6"
|
||||
BuildableName = "EmailScheduler"
|
||||
BlueprintName = "EmailScheduler"
|
||||
ReferencedContainer = "container:EmailScheduler.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2A452C6B19C475790095EEF6"
|
||||
BuildableName = "EmailScheduler"
|
||||
BlueprintName = "EmailScheduler"
|
||||
ReferencedContainer = "container:EmailScheduler.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2A452C6B19C475790095EEF6"
|
||||
BuildableName = "EmailScheduler"
|
||||
BlueprintName = "EmailScheduler"
|
||||
ReferencedContainer = "container:EmailScheduler.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>Build Directory.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>EmailScheduler.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
<dict>
|
||||
<key>2A452C6B19C475790095EEF6</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>2A452C8119C476C30095EEF6</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
9
EmailScheduler/EmailScheduler-Prefix.pch
Normal file
9
EmailScheduler/EmailScheduler-Prefix.pch
Normal file
@ -0,0 +1,9 @@
|
||||
//
|
||||
// Prefix header
|
||||
//
|
||||
// The contents of this file are implicitly included at the beginning of every source file.
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
79
EmailScheduler/EmailScheduler.1
Normal file
79
EmailScheduler/EmailScheduler.1
Normal file
@ -0,0 +1,79 @@
|
||||
.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
|
||||
.\"See Also:
|
||||
.\"man mdoc.samples for a complete listing of options
|
||||
.\"man mdoc for the short list of editing options
|
||||
.\"/usr/share/misc/mdoc.template
|
||||
.Dd 9/13/14 \" DATE
|
||||
.Dt EmailScheduler 1 \" Program name and manual section number
|
||||
.Os Darwin
|
||||
.Sh NAME \" Section Header - required - don't modify
|
||||
.Nm EmailScheduler,
|
||||
.\" The following lines are read in generating the apropos(man -k) database. Use only key
|
||||
.\" words here as the database is built based on the words here and in the .ND line.
|
||||
.Nm Other_name_for_same_program(),
|
||||
.Nm Yet another name for the same program.
|
||||
.\" Use .Nm macro to designate other names for the documented program.
|
||||
.Nd This line parsed for whatis database.
|
||||
.Sh SYNOPSIS \" Section Header - required - don't modify
|
||||
.Nm
|
||||
.Op Fl abcd \" [-abcd]
|
||||
.Op Fl a Ar path \" [-a path]
|
||||
.Op Ar file \" [file]
|
||||
.Op Ar \" [file ...]
|
||||
.Ar arg0 \" Underlined argument - use .Ar anywhere to underline
|
||||
arg2 ... \" Arguments
|
||||
.Sh DESCRIPTION \" Section Header - required - don't modify
|
||||
Use the .Nm macro to refer to your program throughout the man page like such:
|
||||
.Nm
|
||||
Underlining is accomplished with the .Ar macro like this:
|
||||
.Ar underlined text .
|
||||
.Pp \" Inserts a space
|
||||
A list of items with descriptions:
|
||||
.Bl -tag -width -indent \" Begins a tagged list
|
||||
.It item a \" Each item preceded by .It macro
|
||||
Description of item a
|
||||
.It item b
|
||||
Description of item b
|
||||
.El \" Ends the list
|
||||
.Pp
|
||||
A list of flags and their descriptions:
|
||||
.Bl -tag -width -indent \" Differs from above in tag removed
|
||||
.It Fl a \"-a flag as a list item
|
||||
Description of -a flag
|
||||
.It Fl b
|
||||
Description of -b flag
|
||||
.El \" Ends the list
|
||||
.Pp
|
||||
.\" .Sh ENVIRONMENT \" May not be needed
|
||||
.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1
|
||||
.\" .It Ev ENV_VAR_1
|
||||
.\" Description of ENV_VAR_1
|
||||
.\" .It Ev ENV_VAR_2
|
||||
.\" Description of ENV_VAR_2
|
||||
.\" .El
|
||||
.Sh FILES \" File used or created by the topic of the man page
|
||||
.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
|
||||
.It Pa /usr/share/file_name
|
||||
FILE_1 description
|
||||
.It Pa /Users/joeuser/Library/really_long_file_name
|
||||
FILE_2 description
|
||||
.El \" Ends the list
|
||||
.\" .Sh DIAGNOSTICS \" May not be needed
|
||||
.\" .Bl -diag
|
||||
.\" .It Diagnostic Tag
|
||||
.\" Diagnostic informtion here.
|
||||
.\" .It Diagnostic Tag
|
||||
.\" Diagnostic informtion here.
|
||||
.\" .El
|
||||
.Sh SEE ALSO
|
||||
.\" List links in ascending order by section, alphabetically within a section.
|
||||
.\" Please do not reference files that do not exist without filing a bug report
|
||||
.Xr a 1 ,
|
||||
.Xr b 1 ,
|
||||
.Xr c 1 ,
|
||||
.Xr a 2 ,
|
||||
.Xr b 2 ,
|
||||
.Xr a 3 ,
|
||||
.Xr b 3
|
||||
.\" .Sh BUGS \" Document known, unremedied bugs
|
||||
.\" .Sh HISTORY \" Document history if command behaves in a unique manner
|
76
EmailScheduler/JSON/MGMJSON.h
Normal file
76
EmailScheduler/JSON/MGMJSON.h
Normal file
@ -0,0 +1,76 @@
|
||||
//
|
||||
// MGMJSON.h
|
||||
// MGMUsers
|
||||
//
|
||||
// Created by Mr. Gecko on 7/31/10.
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSString (MGMJSON)
|
||||
- (id)parseJSON;
|
||||
- (NSString *)JSONValue;
|
||||
@end
|
||||
@interface NSData (MGMJSON)
|
||||
- (id)parseJSON;
|
||||
@end
|
||||
@interface NSNumber (MGMJSON)
|
||||
- (NSString *)JSONValue;
|
||||
@end
|
||||
@interface NSNull (MGMJSON)
|
||||
- (NSString *)JSONValue;
|
||||
@end
|
||||
@interface NSDictionary (MGMJSON)
|
||||
- (NSString *)JSONValue;
|
||||
@end
|
||||
@interface NSArray (MGMJSON)
|
||||
- (NSString *)JSONValue;
|
||||
@end
|
||||
|
||||
@interface MGMJSON : NSObject {
|
||||
@private
|
||||
NSMutableCharacterSet *escapeSet;
|
||||
NSString *JSONString;
|
||||
unsigned long position;
|
||||
unsigned long length;
|
||||
}
|
||||
- (id)initWithString:(NSString *)theString;
|
||||
- (id)parse;
|
||||
- (void)skipWhitespace;
|
||||
- (void)skipDigits;
|
||||
- (id)parseForObject;
|
||||
- (NSDictionary *)parseForDictionary;
|
||||
- (NSArray *)parseForArray;
|
||||
- (NSString *)parseForString;
|
||||
- (unichar)parseForUnicodeChar;
|
||||
- (NSNumber *)parseForYES;
|
||||
- (id)parseForNONULL;
|
||||
- (NSNumber *)parseForNumber;
|
||||
|
||||
- (NSString *)convert:(id)theObject;
|
||||
- (NSString *)writeString:(NSString *)theString;
|
||||
- (NSString *)writeNumber:(NSNumber *)theNumber;
|
||||
- (NSString *)writeBool:(NSNumber *)theNumber;
|
||||
- (NSString *)writeNull:(NSNull *)theNull;
|
||||
- (NSString *)writeDictionary:(NSDictionary *)theDictionary;
|
||||
- (NSString *)writeArray:(NSArray *)theArray;
|
||||
@end
|
542
EmailScheduler/JSON/MGMJSON.m
Normal file
542
EmailScheduler/JSON/MGMJSON.m
Normal file
@ -0,0 +1,542 @@
|
||||
//
|
||||
// MGMJSON.m
|
||||
// MGMUsers
|
||||
//
|
||||
// Created by Mr. Gecko on 7/31/10.
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import "MGMJSON.h"
|
||||
|
||||
@implementation NSString (MGMJSON)
|
||||
- (id)parseJSON {
|
||||
MGMJSON *parser = [[MGMJSON alloc] initWithString:self];
|
||||
id object = [parser parse];
|
||||
[parser release];
|
||||
return object;
|
||||
}
|
||||
- (NSString *)JSONValue {
|
||||
MGMJSON *writer = [[MGMJSON alloc] init];
|
||||
NSString *value = [writer convert:self];
|
||||
[writer release];
|
||||
return value;
|
||||
}
|
||||
@end
|
||||
@implementation NSData (MGMJSON)
|
||||
- (id)parseJSON {
|
||||
NSString *string = [[NSString alloc] initWithData:self encoding:NSUTF8StringEncoding];
|
||||
MGMJSON *parser = [[MGMJSON alloc] initWithString:string];
|
||||
[string release];
|
||||
id object = [parser parse];
|
||||
[parser release];
|
||||
return object;
|
||||
}
|
||||
@end
|
||||
@implementation NSNumber (MGMJSON)
|
||||
- (NSString *)JSONValue {
|
||||
MGMJSON *writer = [[MGMJSON alloc] init];
|
||||
NSString *value = [writer convert:self];
|
||||
[writer release];
|
||||
return value;
|
||||
}
|
||||
@end
|
||||
@implementation NSNull (MGMJSON)
|
||||
- (NSString *)JSONValue {
|
||||
MGMJSON *writer = [[MGMJSON alloc] init];
|
||||
NSString *value = [writer convert:self];
|
||||
[writer release];
|
||||
return value;
|
||||
}
|
||||
@end
|
||||
@implementation NSDictionary (MGMJSON)
|
||||
- (NSString *)JSONValue {
|
||||
MGMJSON *writer = [[MGMJSON alloc] init];
|
||||
NSString *value = [writer convert:self];
|
||||
[writer release];
|
||||
return value;
|
||||
}
|
||||
@end
|
||||
@implementation NSArray (MGMJSON)
|
||||
- (NSString *)JSONValue {
|
||||
MGMJSON *writer = [[MGMJSON alloc] init];
|
||||
NSString *value = [writer convert:self];
|
||||
[writer release];
|
||||
return value;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation MGMJSON
|
||||
- (id)init {
|
||||
if ((self = [super init])) {
|
||||
escapeSet = [[NSMutableCharacterSet characterSetWithRange:NSMakeRange(0,32)] retain];
|
||||
[escapeSet addCharactersInString:@"\"\\"];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (id)initWithString:(NSString *)theString {
|
||||
if ((self = [super init])) {
|
||||
JSONString = [theString retain];
|
||||
length = [JSONString length];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (void)dealloc {
|
||||
[escapeSet release];
|
||||
[JSONString release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)parse {
|
||||
position = 0;
|
||||
if ([JSONString isEqual:@""])
|
||||
return nil;
|
||||
return [self parseForObject];
|
||||
}
|
||||
- (void)skipWhitespace {
|
||||
NSCharacterSet *set = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||
while (position<length && [set characterIsMember:[JSONString characterAtIndex:position]]) {
|
||||
position++;
|
||||
}
|
||||
}
|
||||
- (void)skipDigits {
|
||||
NSCharacterSet *set = [NSCharacterSet decimalDigitCharacterSet];
|
||||
while (position<length && [set characterIsMember:[JSONString characterAtIndex:position]]) {
|
||||
position++;
|
||||
}
|
||||
}
|
||||
- (id)parseForObject {
|
||||
[self skipWhitespace];
|
||||
switch ([JSONString characterAtIndex:position]) {
|
||||
case '{':
|
||||
return [self parseForDictionary];
|
||||
break;
|
||||
case '[':
|
||||
return [self parseForArray];
|
||||
break;
|
||||
case '"':
|
||||
case '\'':
|
||||
return [self parseForString];
|
||||
break;
|
||||
case 'T':
|
||||
case 't':
|
||||
case 'Y':
|
||||
case 'y':
|
||||
return [self parseForYES];
|
||||
break;
|
||||
case 'F':
|
||||
case 'f':
|
||||
case 'N':
|
||||
case 'n':
|
||||
return [self parseForNONULL];
|
||||
break;
|
||||
case '-':
|
||||
case '0'...'9':
|
||||
return [self parseForNumber];
|
||||
break;
|
||||
case 0x0:
|
||||
NSLog(@"JSON: Unexpected end of string.");
|
||||
break;
|
||||
default:
|
||||
NSLog(@"JSON: Unknown character %c", [JSONString characterAtIndex:position]);
|
||||
break;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
- (NSDictionary *)parseForDictionary {
|
||||
position++;
|
||||
[self skipWhitespace];
|
||||
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
|
||||
while (position<length) {
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
if ([JSONString characterAtIndex:position]=='}') {
|
||||
[pool drain];
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
NSString *key = nil;
|
||||
if ([JSONString characterAtIndex:position]=='"' || [JSONString characterAtIndex:position]=='\'') {
|
||||
key = [self parseForString];
|
||||
}
|
||||
if (key==nil) {
|
||||
NSLog(@"JSON: No key found for Dictionary.");
|
||||
[pool drain];
|
||||
return nil;
|
||||
}
|
||||
position++;
|
||||
|
||||
[self skipWhitespace];
|
||||
if ([JSONString characterAtIndex:position]!=':') {
|
||||
NSLog(@"JSON: Expected \":\" in Dictionary.");
|
||||
[pool drain];
|
||||
return nil;
|
||||
}
|
||||
position++;
|
||||
|
||||
id object = [self parseForObject];
|
||||
if (object!=nil) {
|
||||
[dictionary setObject:object forKey:key];
|
||||
} else {
|
||||
NSLog(@"JSON: Found no object for Dictionary.");
|
||||
[pool drain];
|
||||
return nil;
|
||||
}
|
||||
position++;
|
||||
|
||||
[self skipWhitespace];
|
||||
if ([JSONString characterAtIndex:position]==',') {
|
||||
position++;
|
||||
[self skipWhitespace];
|
||||
if ([JSONString characterAtIndex:position]=='}') {
|
||||
NSLog(@"JSON: Unexpected end of Dictionary.");
|
||||
[pool drain];
|
||||
return dictionary;
|
||||
}
|
||||
}
|
||||
[pool drain];
|
||||
}
|
||||
NSLog(@"JSON: Unexpected end of input for Dictionary.");
|
||||
return dictionary;
|
||||
}
|
||||
- (NSArray *)parseForArray {
|
||||
position++;
|
||||
[self skipWhitespace];
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
while (position<length) {
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
if ([JSONString characterAtIndex:position]==']') {
|
||||
[pool drain];
|
||||
return array;
|
||||
}
|
||||
|
||||
id object = [self parseForObject];
|
||||
if (object!=nil) {
|
||||
[array addObject:object];
|
||||
} else {
|
||||
NSLog(@"JSON: Found no object for Array.");
|
||||
[pool drain];
|
||||
return nil;
|
||||
}
|
||||
position++;
|
||||
|
||||
[self skipWhitespace];
|
||||
if ([JSONString characterAtIndex:position]==',') {
|
||||
position++;
|
||||
[self skipWhitespace];
|
||||
if ([JSONString characterAtIndex:position]==']') {
|
||||
NSLog(@"JSON: Unexpected end of Array.");
|
||||
[pool drain];
|
||||
return array;
|
||||
}
|
||||
}
|
||||
[pool drain];
|
||||
}
|
||||
NSLog(@"JSON: Unexpected end of input for Array.");
|
||||
return array;
|
||||
}
|
||||
- (NSString *)parseForString {
|
||||
unichar quote = [JSONString characterAtIndex:position];
|
||||
position++;
|
||||
NSMutableString *string = [NSMutableString string];
|
||||
NSCharacterSet *set = [NSCharacterSet characterSetWithCharactersInString:[NSString stringWithFormat:@"%C\\", quote]];
|
||||
do {
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSString *currentString = [[[JSONString substringFromIndex:position] copy] autorelease];
|
||||
NSRange range = [currentString rangeOfCharacterFromSet:set];
|
||||
if (range.location==NSNotFound) {
|
||||
NSLog(@"JSON: Range not found for String.");
|
||||
[pool drain];
|
||||
return nil;
|
||||
}
|
||||
[string appendString:[currentString substringWithRange:NSMakeRange(0, range.location)]];
|
||||
position += range.location;
|
||||
if ([JSONString characterAtIndex:position]==quote) {
|
||||
[pool drain];
|
||||
return string;
|
||||
} else if ([JSONString characterAtIndex:position]=='\\') {
|
||||
position++;
|
||||
unichar character = [JSONString characterAtIndex:position];
|
||||
switch (character) {
|
||||
case '\\':
|
||||
case '/':
|
||||
case '"':
|
||||
case '\'':
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
case 'u':
|
||||
position++;
|
||||
character = [self parseForUnicodeChar];
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
character = '\b';
|
||||
break;
|
||||
case 'f':
|
||||
character = '\f';
|
||||
break;
|
||||
case 'n':
|
||||
character = '\n';
|
||||
break;
|
||||
case 'r':
|
||||
character = '\r';
|
||||
break;
|
||||
case 't':
|
||||
character = '\t';
|
||||
break;
|
||||
default:
|
||||
NSLog(@"JSON: Illegal escape \"0x%x\"", character);
|
||||
[pool drain];
|
||||
return nil;
|
||||
break;
|
||||
}
|
||||
if (character==0x0) {
|
||||
NSLog(@"JSON: Received NULL when expecting character.");
|
||||
[pool drain];
|
||||
return nil;
|
||||
}
|
||||
CFStringAppendCharacters((CFMutableStringRef)string, &character, 1);
|
||||
position++;
|
||||
}
|
||||
[pool drain];
|
||||
} while (position<length);
|
||||
NSLog(@"JSON: Unexpected end of input for String.");
|
||||
return [[string copy] autorelease];
|
||||
}
|
||||
- (unichar)parseForUnicodeChar {
|
||||
NSCharacterSet *set = [NSCharacterSet characterSetWithCharactersInString:@"0123456789aAbBcCdDeEfF"];
|
||||
unsigned long toPosition = position + 4;
|
||||
if (toPosition>length) {
|
||||
NSLog(@"JSON: Unexpected end of input.");
|
||||
return 0x0;
|
||||
}
|
||||
int len = 0;
|
||||
NSMutableString *hexValue = [NSMutableString string];
|
||||
[hexValue appendString:@"0x"];
|
||||
while (position<toPosition && [set characterIsMember:[JSONString characterAtIndex:position]]) {
|
||||
[hexValue appendFormat:@"%c", [JSONString characterAtIndex:position]];
|
||||
len++;
|
||||
position++;
|
||||
}
|
||||
if (len!=4) {
|
||||
NSLog(@"JSON: Unicode Character invaild.");
|
||||
return 0x0;
|
||||
}
|
||||
position--;
|
||||
NSScanner *scanner = [NSScanner scannerWithString: hexValue];
|
||||
unsigned int returnValue;
|
||||
if ([scanner scanHexInt:&returnValue]) {
|
||||
return returnValue;
|
||||
}
|
||||
NSLog(@"JSON: Failed to scan hex.");
|
||||
return 0x0;
|
||||
}
|
||||
- (NSNumber *)parseForYES {
|
||||
if ([JSONString characterAtIndex:position]=='T' || [JSONString characterAtIndex:position]=='t') {
|
||||
if ([[[JSONString substringWithRange:NSMakeRange(position, 4)] lowercaseString] isEqual:@"true"]) {
|
||||
position += 3;
|
||||
return [NSNumber numberWithBool:YES];
|
||||
}
|
||||
} else if ([JSONString characterAtIndex:position]=='Y' || [JSONString characterAtIndex:position]=='y') {
|
||||
if ([[[JSONString substringWithRange:NSMakeRange(position, 3)] lowercaseString] isEqual:@"yes"]) {
|
||||
position += 2;
|
||||
return [NSNumber numberWithBool:YES];
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
- (id)parseForNONULL {
|
||||
if ([JSONString characterAtIndex:position]=='F' || [JSONString characterAtIndex:position]=='f') {
|
||||
if ([[[JSONString substringWithRange:NSMakeRange(position, 5)] lowercaseString] isEqual:@"false"]) {
|
||||
position += 4;
|
||||
return [NSNumber numberWithBool:NO];
|
||||
}
|
||||
} else if ([JSONString characterAtIndex:position]=='N' || [JSONString characterAtIndex:position]=='n') {
|
||||
if ([[[JSONString substringWithRange:NSMakeRange(position, 2)] lowercaseString] isEqual:@"no"]) {
|
||||
position += 1;
|
||||
return [NSNumber numberWithBool:NO];
|
||||
} else if ([[[JSONString substringWithRange:NSMakeRange(position, 4)] lowercaseString] isEqual:@"null"]) {
|
||||
position += 3;
|
||||
return [NSNull null];
|
||||
} else if ([[[JSONString substringWithRange:NSMakeRange(position, 3)] lowercaseString] isEqual:@"nil"]) {
|
||||
position += 2;
|
||||
return [NSNull null];
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
- (NSNumber *)parseForNumber {
|
||||
unsigned long start = position;
|
||||
NSCharacterSet *set = [NSCharacterSet decimalDigitCharacterSet];
|
||||
|
||||
if ([JSONString characterAtIndex:position]=='-') {
|
||||
position++;
|
||||
if (position<length && ![set characterIsMember:[JSONString characterAtIndex:position]]) {
|
||||
NSLog(@"JSON: Expected digit after minus.");
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
if ([JSONString characterAtIndex:position]=='0') {
|
||||
position++;
|
||||
if (position<length && [set characterIsMember:[JSONString characterAtIndex:position]]) {
|
||||
NSLog(@"JSON: Leading zero found.");
|
||||
return nil;
|
||||
}
|
||||
} else {
|
||||
[self skipDigits];
|
||||
}
|
||||
|
||||
if (position<length && [JSONString characterAtIndex:position]=='.') {
|
||||
position++;
|
||||
if (position<length && ![set characterIsMember:[JSONString characterAtIndex:position]]) {
|
||||
NSLog(@"JSON: No digits found after decimal point.");
|
||||
return nil;
|
||||
}
|
||||
[self skipDigits];
|
||||
}
|
||||
|
||||
if (position<length && ([JSONString characterAtIndex:position]=='E' || [JSONString characterAtIndex:position]=='e')) {
|
||||
position++;
|
||||
if (position<length && ([JSONString characterAtIndex:position]=='-' || [JSONString characterAtIndex:position]=='+'))
|
||||
position++;
|
||||
|
||||
if (position<length && ![set characterIsMember:[JSONString characterAtIndex:position]]) {
|
||||
NSLog(@"JSON: No digits found after exponent.");
|
||||
return nil;
|
||||
}
|
||||
[self skipDigits];
|
||||
}
|
||||
|
||||
NSString *numberString = [[[JSONString substringWithRange:NSMakeRange(start, position-start)] copy] autorelease];
|
||||
position--;
|
||||
if (numberString!=nil) {
|
||||
NSNumber *number = [NSDecimalNumber decimalNumberWithString:numberString];
|
||||
if (number!=nil)
|
||||
return number;
|
||||
}
|
||||
NSLog(@"JSON: Couldn't create number.");
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)convert:(id)theObject {
|
||||
if ([theObject isKindOfClass:[NSString class]]) {
|
||||
return [self writeString:theObject];
|
||||
} else if ([NSStringFromClass([theObject class]) isEqual:@"NSCFBoolean"]) {
|
||||
return [self writeBool:theObject];
|
||||
} else if ([theObject isKindOfClass:[NSNumber class]]) {
|
||||
return [self writeNumber:theObject];
|
||||
} else if (theObject==nil || [theObject isKindOfClass:[NSNull class]]) {
|
||||
return [self writeNull:theObject];
|
||||
} else if ([theObject isKindOfClass:[NSDictionary class]]) {
|
||||
return [self writeDictionary:theObject];
|
||||
} else if ([theObject isKindOfClass:[NSArray class]]) {
|
||||
return [self writeArray:theObject];
|
||||
}
|
||||
NSLog(@"JSON: Invalid calss for JSON %@, returning description.", NSStringFromClass([theObject class]));
|
||||
return [self writeString:[theObject description]];
|
||||
}
|
||||
- (NSString *)writeString:(NSString *)theString {
|
||||
NSRange range = [theString rangeOfCharacterFromSet:escapeSet];
|
||||
NSMutableString *string = [NSMutableString string];
|
||||
[string appendString:@"\""];
|
||||
if (range.location==NSNotFound) {
|
||||
[string appendString:theString];
|
||||
} else {
|
||||
unsigned long len = [theString length];
|
||||
for (unsigned long i=0; i<len; i++) {
|
||||
unichar character = [theString characterAtIndex:i];
|
||||
switch (character) {
|
||||
case '"':
|
||||
[string appendString:@"\\\""];
|
||||
break;
|
||||
case '\\':
|
||||
[string appendString:@"\\\\"];
|
||||
break;
|
||||
case '\b':
|
||||
[string appendString:@"\\b"];
|
||||
break;
|
||||
case '\f':
|
||||
[string appendString:@"\\f"];
|
||||
break;
|
||||
case '\n':
|
||||
[string appendString:@"\\n"];
|
||||
break;
|
||||
case '\r':
|
||||
[string appendString:@"\\r"];
|
||||
break;
|
||||
case '\t':
|
||||
[string appendString:@"\\t"];
|
||||
break;
|
||||
default:
|
||||
if (character<0x20) {
|
||||
[string appendFormat:@"\\u%04x", character];
|
||||
} else {
|
||||
CFStringAppendCharacters((CFMutableStringRef)string, &character, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
[string appendString:@"\""];
|
||||
return string;
|
||||
}
|
||||
- (NSString *)writeNumber:(NSNumber *)theNumber {
|
||||
return [theNumber stringValue];
|
||||
}
|
||||
- (NSString *)writeBool:(NSNumber *)theNumber {
|
||||
return [theNumber boolValue] ? @"true" : @"false";
|
||||
}
|
||||
- (NSString *)writeNull:(NSNull *)theNull {
|
||||
return @"null";
|
||||
}
|
||||
- (NSString *)writeDictionary:(NSDictionary *)theDictionary {
|
||||
NSMutableString *string = [NSMutableString string];
|
||||
[string appendString:@"{"];
|
||||
NSArray *keys = [theDictionary allKeys];
|
||||
for (int i=0; i<[keys count]; i++) {
|
||||
if (i!=0) {
|
||||
[string appendString:@", "];
|
||||
}
|
||||
NSString *value = [self convert:[theDictionary objectForKey:[keys objectAtIndex:i]]];
|
||||
if (value!=nil) {
|
||||
[string appendFormat:@"%@: ", [self writeString:[keys objectAtIndex:i]]];
|
||||
[string appendString:value];
|
||||
}
|
||||
}
|
||||
[string appendString:@"}"];
|
||||
return string;
|
||||
}
|
||||
- (NSString *)writeArray:(NSArray *)theArray {
|
||||
NSMutableString *string = [NSMutableString string];
|
||||
[string appendString:@"["];
|
||||
for (int i=0; i<[theArray count]; i++) {
|
||||
if (i!=0) {
|
||||
[string appendString:@", "];
|
||||
}
|
||||
NSString *value = [self convert:[theArray objectAtIndex:i]];
|
||||
if (value!=nil)
|
||||
[string appendString:value];
|
||||
}
|
||||
[string appendString:@"]"];
|
||||
return string;
|
||||
}
|
||||
@end
|
40
EmailScheduler/MGMController.h
Normal file
40
EmailScheduler/MGMController.h
Normal file
@ -0,0 +1,40 @@
|
||||
//
|
||||
// MGMController.h
|
||||
// EmailScheduler
|
||||
//
|
||||
// Created by James Coleman on 9/13/14.
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class MGMHTTPServer, MGMEmail;
|
||||
|
||||
@interface MGMController : NSObject {
|
||||
MGMHTTPServer *server;
|
||||
NSDictionary *emailAddresses;
|
||||
NSMutableArray *queue;
|
||||
BOOL sendingEmail;
|
||||
}
|
||||
+ (id)sharedController;
|
||||
- (NSDictionary *)emailAddresses;
|
||||
- (void)addToQueue:(MGMEmail *)email;
|
||||
@end
|
137
EmailScheduler/MGMController.m
Normal file
137
EmailScheduler/MGMController.m
Normal file
@ -0,0 +1,137 @@
|
||||
//
|
||||
// MGMController.m
|
||||
// EmailScheduler
|
||||
//
|
||||
// Created by James Coleman on 9/13/14.
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import "MGMController.h"
|
||||
#import "MGMHTTP/MGMHTTPServer.h"
|
||||
#import "MGMHTTP/MGMHTTPClient.h"
|
||||
#import "MGMHTTP/MGMHTTPResponse.h"
|
||||
#import "MGMHTTPClientClass.h"
|
||||
#import "MGMEmail.h"
|
||||
#import <MailCore/MailCore.h>
|
||||
|
||||
static MGMController *controller;
|
||||
|
||||
@implementation MGMController
|
||||
- (id)init {
|
||||
if ((self = [super init])) {
|
||||
controller = self;
|
||||
server = [[MGMHTTPServer serverWithPort:28001 delegate:self] retain];
|
||||
[server setHTTPClientClass:[MGMHTTPClientClass class]];
|
||||
NSError *error = nil;
|
||||
if (![server start:&error]) {
|
||||
NSLog(@"Error: %@", error);
|
||||
}
|
||||
emailAddresses = [[NSDictionary dictionaryWithObjectsAndKeys:nil] retain];
|
||||
|
||||
queue = [NSMutableArray new];
|
||||
sendingEmail = NO;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
+ (id)sharedController {
|
||||
return controller;
|
||||
}
|
||||
- (NSDictionary *)emailAddresses {
|
||||
return emailAddresses;
|
||||
}
|
||||
- (void)addToQueue:(MGMEmail *)email {
|
||||
@synchronized(queue) {
|
||||
[queue addObject:email];
|
||||
if (!sendingEmail) {
|
||||
sendingEmail = YES;
|
||||
[NSThread detachNewThreadSelector:@selector(sendNextEmail) toTarget:self withObject:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
- (void)sendNextEmail {
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
MGMEmail *email = nil;
|
||||
@synchronized(queue) {
|
||||
email = [queue objectAtIndex:0];
|
||||
}
|
||||
|
||||
MCOSMTPSession *smtpSession = [email session];
|
||||
MCOSMTPSendOperation *sendOperation = [smtpSession sendOperationWithData:[email rfc822Data]];
|
||||
[sendOperation start:^(NSError *error) {
|
||||
if(error) {
|
||||
NSLog(@"Error sending email: %@", error);
|
||||
} else {
|
||||
NSLog(@"Successfully sent email!");
|
||||
}
|
||||
}];
|
||||
|
||||
if ([[email eamilAddress] isEqual:@"password@birdim.com"]) {//Email address to automatically delete email for. Make sure gmail has a filter to move sent email to trash.
|
||||
MCOIMAPSession *session = [email imapSession];
|
||||
|
||||
MCOIndexSet *uidSet = [MCOIndexSet indexSetWithRange:MCORangeMake(1,UINT64_MAX)];
|
||||
MCOIMAPFetchMessagesOperation *fetchOp = [session fetchMessagesByUIDOperationWithFolder:@"[Gmail]/Trash"
|
||||
requestKind:MCOIMAPMessagesRequestKindHeaders
|
||||
uids:uidSet];
|
||||
|
||||
[fetchOp start:^(NSError *err, NSArray *msgs, MCOIndexSet *vanished) {
|
||||
for (MCOIMAPMessage *message in msgs) {
|
||||
MCOMessageFlag flags = MCOMessageFlagDeleted;
|
||||
BOOL deleted = flags & MCOMessageFlagDeleted;
|
||||
|
||||
MCOIMAPOperation *op = [session storeFlagsOperationWithFolder:@"[Gmail]/Trash"
|
||||
uids:[MCOIndexSet indexSetWithIndex:[message gmailThreadID]]
|
||||
kind:MCOIMAPStoreFlagsRequestKindSet
|
||||
flags:flags];
|
||||
[op start:^(NSError * error) {
|
||||
if(!error) {
|
||||
NSLog(@"Updated flags!");
|
||||
} else {
|
||||
NSLog(@"Error updating flags: %@", error);
|
||||
}
|
||||
|
||||
if(deleted) {
|
||||
MCOIMAPOperation *deleteOp = [session expungeOperation:@"[Gmail]/Trash"];
|
||||
[deleteOp start:^(NSError *error) {
|
||||
if(error) {
|
||||
NSLog(@"Error expunging folder: %@", error);
|
||||
} else {
|
||||
NSLog(@"Successfully expunged folder");
|
||||
}
|
||||
}];
|
||||
}
|
||||
}];
|
||||
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
@synchronized(queue) {
|
||||
[queue removeObjectAtIndex:0];
|
||||
if ([queue count]!=0) {
|
||||
[NSThread detachNewThreadSelector:@selector(sendNextEmail) toTarget:self withObject:nil];
|
||||
} else {
|
||||
sendingEmail = NO;
|
||||
}
|
||||
}
|
||||
|
||||
[pool drain];
|
||||
}
|
||||
@end
|
41
EmailScheduler/MGMEmail.h
Normal file
41
EmailScheduler/MGMEmail.h
Normal file
@ -0,0 +1,41 @@
|
||||
//
|
||||
// MGMEmail.h
|
||||
// EmailScheduler
|
||||
//
|
||||
// Created by James Coleman on 9/13/14.
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class MCOSMTPSession, MCOIMAPSession;
|
||||
|
||||
@interface MGMEmail : NSObject {
|
||||
NSString *emailAddress;
|
||||
NSData *rfc822Data;
|
||||
}
|
||||
- (void)setEmailAddress:(NSString *)email;
|
||||
- (NSString *)eamilAddress;
|
||||
- (MCOSMTPSession *)session;
|
||||
- (MCOIMAPSession *)imapSession;
|
||||
- (void)setRFC822Data:(NSData *)data;
|
||||
- (NSData *)rfc822Data;
|
||||
@end
|
68
EmailScheduler/MGMEmail.m
Normal file
68
EmailScheduler/MGMEmail.m
Normal file
@ -0,0 +1,68 @@
|
||||
//
|
||||
// MGMEmail.m
|
||||
// EmailScheduler
|
||||
//
|
||||
// Created by James Coleman on 9/13/14.
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import "MGMEmail.h"
|
||||
#import "MGMController.h"
|
||||
#import <MailCore/MailCore.h>
|
||||
|
||||
@implementation MGMEmail
|
||||
- (void)setEmailAddress:(NSString *)email {
|
||||
[emailAddress autorelease];
|
||||
emailAddress = [email retain];
|
||||
}
|
||||
- (NSString *)eamilAddress {
|
||||
return emailAddress;
|
||||
}
|
||||
- (MCOSMTPSession *)session {
|
||||
MGMController *controller = [MGMController sharedController];
|
||||
MCOSMTPSession *smtpSession = [[[MCOSMTPSession alloc] init] autorelease];
|
||||
smtpSession.hostname = @"smtp.gmail.com";
|
||||
smtpSession.port = 465;
|
||||
smtpSession.username = emailAddress;
|
||||
smtpSession.password = [[controller emailAddresses] objectForKey:emailAddress];
|
||||
smtpSession.authType = MCOAuthTypeSASLPlain;
|
||||
smtpSession.connectionType = MCOConnectionTypeTLS;
|
||||
return smtpSession;
|
||||
}
|
||||
- (MCOIMAPSession *)imapSession {
|
||||
MGMController *controller = [MGMController sharedController];
|
||||
MCOIMAPSession *session = [[[MCOIMAPSession alloc] init] autorelease];
|
||||
session.hostname = @"imap.gmail.com";
|
||||
session.port = 993;
|
||||
session.username = emailAddress;
|
||||
session.password = [[controller emailAddresses] objectForKey:emailAddress];
|
||||
session.connectionType = MCOConnectionTypeTLS;
|
||||
return session;
|
||||
}
|
||||
|
||||
- (void)setRFC822Data:(NSData *)data {
|
||||
[rfc822Data autorelease];
|
||||
rfc822Data = [data retain];
|
||||
}
|
||||
- (NSData *)rfc822Data {
|
||||
return rfc822Data;
|
||||
}
|
||||
@end
|
659
EmailScheduler/MGMHTTP/AsyncSocket.h
Normal file
659
EmailScheduler/MGMHTTP/AsyncSocket.h
Normal file
@ -0,0 +1,659 @@
|
||||
//
|
||||
// AsyncSocket.h
|
||||
//
|
||||
// This class is in the public domain.
|
||||
// Originally created by Dustin Voss on Wed Jan 29 2003.
|
||||
// Updated and maintained by Deusty Designs and the Mac development community.
|
||||
//
|
||||
// http://code.google.com/p/cocoaasyncsocket/
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class AsyncSocket;
|
||||
@class AsyncReadPacket;
|
||||
@class AsyncWritePacket;
|
||||
|
||||
extern NSString *const AsyncSocketException;
|
||||
extern NSString *const AsyncSocketErrorDomain;
|
||||
|
||||
enum AsyncSocketError
|
||||
{
|
||||
AsyncSocketCFSocketError = kCFSocketError, // From CFSocketError enum.
|
||||
AsyncSocketNoError = 0, // Never used.
|
||||
AsyncSocketCanceledError, // onSocketWillConnect: returned NO.
|
||||
AsyncSocketConnectTimeoutError,
|
||||
AsyncSocketReadMaxedOutError, // Reached set maxLength without completing
|
||||
AsyncSocketReadTimeoutError,
|
||||
AsyncSocketWriteTimeoutError
|
||||
};
|
||||
typedef enum AsyncSocketError AsyncSocketError;
|
||||
|
||||
@protocol AsyncSocketDelegate
|
||||
@optional
|
||||
|
||||
/**
|
||||
* In the event of an error, the socket is closed.
|
||||
* You may call "unreadData" during this call-back to get the last bit of data off the socket.
|
||||
* When connecting, this delegate method may be called
|
||||
* before"onSocket:didAcceptNewSocket:" or "onSocket:didConnectToHost:".
|
||||
**/
|
||||
- (void)onSocket:(AsyncSocket *)sock willDisconnectWithError:(NSError *)err;
|
||||
|
||||
/**
|
||||
* Called when a socket disconnects with or without error. If you want to release a socket after it disconnects,
|
||||
* do so here. It is not safe to do that during "onSocket:willDisconnectWithError:".
|
||||
*
|
||||
* If you call the disconnect method, and the socket wasn't already disconnected,
|
||||
* this delegate method will be called before the disconnect method returns.
|
||||
**/
|
||||
- (void)onSocketDidDisconnect:(AsyncSocket *)sock;
|
||||
|
||||
/**
|
||||
* Called when a socket accepts a connection. Another socket is spawned to handle it. The new socket will have
|
||||
* the same delegate and will call "onSocket:didConnectToHost:port:".
|
||||
**/
|
||||
- (void)onSocket:(AsyncSocket *)sock didAcceptNewSocket:(AsyncSocket *)newSocket;
|
||||
|
||||
/**
|
||||
* Called when a new socket is spawned to handle a connection. This method should return the run-loop of the
|
||||
* thread on which the new socket and its delegate should operate. If omitted, [NSRunLoop currentRunLoop] is used.
|
||||
**/
|
||||
- (NSRunLoop *)onSocket:(AsyncSocket *)sock wantsRunLoopForNewSocket:(AsyncSocket *)newSocket;
|
||||
|
||||
/**
|
||||
* Called when a socket is about to connect. This method should return YES to continue, or NO to abort.
|
||||
* If aborted, will result in AsyncSocketCanceledError.
|
||||
*
|
||||
* If the connectToHost:onPort:error: method was called, the delegate will be able to access and configure the
|
||||
* CFReadStream and CFWriteStream as desired prior to connection.
|
||||
*
|
||||
* If the connectToAddress:error: method was called, the delegate will be able to access and configure the
|
||||
* CFSocket and CFSocketNativeHandle (BSD socket) as desired prior to connection. You will be able to access and
|
||||
* configure the CFReadStream and CFWriteStream in the onSocket:didConnectToHost:port: method.
|
||||
**/
|
||||
- (BOOL)onSocketWillConnect:(AsyncSocket *)sock;
|
||||
|
||||
/**
|
||||
* Called when a socket connects and is ready for reading and writing.
|
||||
* The host parameter will be an IP address, not a DNS name.
|
||||
**/
|
||||
- (void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port;
|
||||
|
||||
/**
|
||||
* Called when a socket has completed reading the requested data into memory.
|
||||
* Not called if there is an error.
|
||||
**/
|
||||
- (void)onSocket:(AsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag;
|
||||
|
||||
/**
|
||||
* Called when a socket has read in data, but has not yet completed the read.
|
||||
* This would occur if using readToData: or readToLength: methods.
|
||||
* It may be used to for things such as updating progress bars.
|
||||
**/
|
||||
- (void)onSocket:(AsyncSocket *)sock didReadPartialDataOfLength:(NSUInteger)partialLength tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Called when a socket has completed writing the requested data. Not called if there is an error.
|
||||
**/
|
||||
- (void)onSocket:(AsyncSocket *)sock didWriteDataWithTag:(long)tag;
|
||||
|
||||
/**
|
||||
* Called when a socket has written some data, but has not yet completed the entire write.
|
||||
* It may be used to for things such as updating progress bars.
|
||||
**/
|
||||
- (void)onSocket:(AsyncSocket *)sock didWritePartialDataOfLength:(NSUInteger)partialLength tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Called if a read operation has reached its timeout without completing.
|
||||
* This method allows you to optionally extend the timeout.
|
||||
* If you return a positive time interval (> 0) the read's timeout will be extended by the given amount.
|
||||
* If you don't implement this method, or return a non-positive time interval (<= 0) the read will timeout as usual.
|
||||
*
|
||||
* The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method.
|
||||
* The length parameter is the number of bytes that have been read so far for the read operation.
|
||||
*
|
||||
* Note that this method may be called multiple times for a single read if you return positive numbers.
|
||||
**/
|
||||
- (NSTimeInterval)onSocket:(AsyncSocket *)sock
|
||||
shouldTimeoutReadWithTag:(long)tag
|
||||
elapsed:(NSTimeInterval)elapsed
|
||||
bytesDone:(NSUInteger)length;
|
||||
|
||||
/**
|
||||
* Called if a write operation has reached its timeout without completing.
|
||||
* This method allows you to optionally extend the timeout.
|
||||
* If you return a positive time interval (> 0) the write's timeout will be extended by the given amount.
|
||||
* If you don't implement this method, or return a non-positive time interval (<= 0) the write will timeout as usual.
|
||||
*
|
||||
* The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method.
|
||||
* The length parameter is the number of bytes that have been written so far for the write operation.
|
||||
*
|
||||
* Note that this method may be called multiple times for a single write if you return positive numbers.
|
||||
**/
|
||||
- (NSTimeInterval)onSocket:(AsyncSocket *)sock
|
||||
shouldTimeoutWriteWithTag:(long)tag
|
||||
elapsed:(NSTimeInterval)elapsed
|
||||
bytesDone:(NSUInteger)length;
|
||||
|
||||
/**
|
||||
* Called after the socket has successfully completed SSL/TLS negotiation.
|
||||
* This method is not called unless you use the provided startTLS method.
|
||||
*
|
||||
* If a SSL/TLS negotiation fails (invalid certificate, etc) then the socket will immediately close,
|
||||
* and the onSocket:willDisconnectWithError: delegate method will be called with the specific SSL error code.
|
||||
**/
|
||||
- (void)onSocketDidSecure:(AsyncSocket *)sock;
|
||||
|
||||
@end
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@interface AsyncSocket : NSObject
|
||||
{
|
||||
CFSocketNativeHandle theNativeSocket4;
|
||||
CFSocketNativeHandle theNativeSocket6;
|
||||
|
||||
CFSocketRef theSocket4; // IPv4 accept or connect socket
|
||||
CFSocketRef theSocket6; // IPv6 accept or connect socket
|
||||
|
||||
CFReadStreamRef theReadStream;
|
||||
CFWriteStreamRef theWriteStream;
|
||||
|
||||
CFRunLoopSourceRef theSource4; // For theSocket4
|
||||
CFRunLoopSourceRef theSource6; // For theSocket6
|
||||
CFRunLoopRef theRunLoop;
|
||||
CFSocketContext theContext;
|
||||
NSArray *theRunLoopModes;
|
||||
|
||||
NSTimer *theConnectTimer;
|
||||
|
||||
NSMutableArray *theReadQueue;
|
||||
AsyncReadPacket *theCurrentRead;
|
||||
NSTimer *theReadTimer;
|
||||
NSMutableData *partialReadBuffer;
|
||||
|
||||
NSMutableArray *theWriteQueue;
|
||||
AsyncWritePacket *theCurrentWrite;
|
||||
NSTimer *theWriteTimer;
|
||||
|
||||
id theDelegate;
|
||||
UInt16 theFlags;
|
||||
|
||||
long theUserData;
|
||||
}
|
||||
|
||||
- (id)init;
|
||||
- (id)initWithDelegate:(id)delegate;
|
||||
- (id)initWithDelegate:(id)delegate userData:(long)userData;
|
||||
|
||||
/* String representation is long but has no "\n". */
|
||||
- (NSString *)description;
|
||||
|
||||
/**
|
||||
* Use "canSafelySetDelegate" to see if there is any pending business (reads and writes) with the current delegate
|
||||
* before changing it. It is, of course, safe to change the delegate before connecting or accepting connections.
|
||||
**/
|
||||
- (id)delegate;
|
||||
- (BOOL)canSafelySetDelegate;
|
||||
- (void)setDelegate:(id)delegate;
|
||||
|
||||
/* User data can be a long, or an id or void * cast to a long. */
|
||||
- (long)userData;
|
||||
- (void)setUserData:(long)userData;
|
||||
|
||||
/* Don't use these to read or write. And don't close them either! */
|
||||
- (CFSocketRef)getCFSocket;
|
||||
- (CFReadStreamRef)getCFReadStream;
|
||||
- (CFWriteStreamRef)getCFWriteStream;
|
||||
|
||||
// Once one of the accept or connect methods are called, the AsyncSocket instance is locked in
|
||||
// and the other accept/connect methods can't be called without disconnecting the socket first.
|
||||
// If the attempt fails or times out, these methods either return NO or
|
||||
// call "onSocket:willDisconnectWithError:" and "onSockedDidDisconnect:".
|
||||
|
||||
// When an incoming connection is accepted, AsyncSocket invokes several delegate methods.
|
||||
// These methods are (in chronological order):
|
||||
// 1. onSocket:didAcceptNewSocket:
|
||||
// 2. onSocket:wantsRunLoopForNewSocket:
|
||||
// 3. onSocketWillConnect:
|
||||
//
|
||||
// Your server code will need to retain the accepted socket (if you want to accept it).
|
||||
// The best place to do this is probably in the onSocket:didAcceptNewSocket: method.
|
||||
//
|
||||
// After the read and write streams have been setup for the newly accepted socket,
|
||||
// the onSocket:didConnectToHost:port: method will be called on the proper run loop.
|
||||
//
|
||||
// Multithreading Note: If you're going to be moving the newly accepted socket to another run
|
||||
// loop by implementing onSocket:wantsRunLoopForNewSocket:, then you should wait until the
|
||||
// onSocket:didConnectToHost:port: method before calling read, write, or startTLS methods.
|
||||
// Otherwise read/write events are scheduled on the incorrect runloop, and chaos may ensue.
|
||||
|
||||
/**
|
||||
* Tells the socket to begin listening and accepting connections on the given port.
|
||||
* When a connection comes in, the AsyncSocket instance will call the various delegate methods (see above).
|
||||
* The socket will listen on all available interfaces (e.g. wifi, ethernet, etc)
|
||||
**/
|
||||
- (BOOL)acceptOnPort:(UInt16)port error:(NSError **)errPtr;
|
||||
|
||||
/**
|
||||
* This method is the same as acceptOnPort:error: with the additional option
|
||||
* of specifying which interface to listen on. So, for example, if you were writing code for a server that
|
||||
* has multiple IP addresses, you could specify which address you wanted to listen on. Or you could use it
|
||||
* to specify that the socket should only accept connections over ethernet, and not other interfaces such as wifi.
|
||||
* You may also use the special strings "localhost" or "loopback" to specify that
|
||||
* the socket only accept connections from the local machine.
|
||||
*
|
||||
* To accept connections on any interface pass nil, or simply use the acceptOnPort:error: method.
|
||||
**/
|
||||
- (BOOL)acceptOnInterface:(NSString *)interface port:(UInt16)port error:(NSError **)errPtr;
|
||||
|
||||
/**
|
||||
* Connects to the given host and port.
|
||||
* The host may be a domain name (e.g. "deusty.com") or an IP address string (e.g. "192.168.0.2")
|
||||
**/
|
||||
- (BOOL)connectToHost:(NSString *)hostname onPort:(UInt16)port error:(NSError **)errPtr;
|
||||
|
||||
/**
|
||||
* This method is the same as connectToHost:onPort:error: with an additional timeout option.
|
||||
* To not time out use a negative time interval, or simply use the connectToHost:onPort:error: method.
|
||||
**/
|
||||
- (BOOL)connectToHost:(NSString *)hostname
|
||||
onPort:(UInt16)port
|
||||
withTimeout:(NSTimeInterval)timeout
|
||||
error:(NSError **)errPtr;
|
||||
|
||||
/**
|
||||
* Connects to the given address, specified as a sockaddr structure wrapped in a NSData object.
|
||||
* For example, a NSData object returned from NSNetservice's addresses method.
|
||||
*
|
||||
* If you have an existing struct sockaddr you can convert it to a NSData object like so:
|
||||
* struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len];
|
||||
* struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len];
|
||||
**/
|
||||
- (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr;
|
||||
|
||||
/**
|
||||
* This method is the same as connectToAddress:error: with an additional timeout option.
|
||||
* To not time out use a negative time interval, or simply use the connectToAddress:error: method.
|
||||
**/
|
||||
- (BOOL)connectToAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr;
|
||||
|
||||
- (BOOL)connectToAddress:(NSData *)remoteAddr
|
||||
viaInterfaceAddress:(NSData *)interfaceAddr
|
||||
withTimeout:(NSTimeInterval)timeout
|
||||
error:(NSError **)errPtr;
|
||||
|
||||
/**
|
||||
* Disconnects immediately. Any pending reads or writes are dropped.
|
||||
* If the socket is not already disconnected, the onSocketDidDisconnect delegate method
|
||||
* will be called immediately, before this method returns.
|
||||
*
|
||||
* Please note the recommended way of releasing an AsyncSocket instance (e.g. in a dealloc method)
|
||||
* [asyncSocket setDelegate:nil];
|
||||
* [asyncSocket disconnect];
|
||||
* [asyncSocket release];
|
||||
**/
|
||||
- (void)disconnect;
|
||||
|
||||
/**
|
||||
* Disconnects after all pending reads have completed.
|
||||
* After calling this, the read and write methods will do nothing.
|
||||
* The socket will disconnect even if there are still pending writes.
|
||||
**/
|
||||
- (void)disconnectAfterReading;
|
||||
|
||||
/**
|
||||
* Disconnects after all pending writes have completed.
|
||||
* After calling this, the read and write methods will do nothing.
|
||||
* The socket will disconnect even if there are still pending reads.
|
||||
**/
|
||||
- (void)disconnectAfterWriting;
|
||||
|
||||
/**
|
||||
* Disconnects after all pending reads and writes have completed.
|
||||
* After calling this, the read and write methods will do nothing.
|
||||
**/
|
||||
- (void)disconnectAfterReadingAndWriting;
|
||||
|
||||
/* Returns YES if the socket and streams are open, connected, and ready for reading and writing. */
|
||||
- (BOOL)isConnected;
|
||||
|
||||
/**
|
||||
* Returns the local or remote host and port to which this socket is connected, or nil and 0 if not connected.
|
||||
* The host will be an IP address.
|
||||
**/
|
||||
- (NSString *)connectedHost;
|
||||
- (UInt16)connectedPort;
|
||||
|
||||
- (NSString *)localHost;
|
||||
- (UInt16)localPort;
|
||||
|
||||
/**
|
||||
* Returns the local or remote address to which this socket is connected,
|
||||
* specified as a sockaddr structure wrapped in a NSData object.
|
||||
*
|
||||
* See also the connectedHost, connectedPort, localHost and localPort methods.
|
||||
**/
|
||||
- (NSData *)connectedAddress;
|
||||
- (NSData *)localAddress;
|
||||
|
||||
/**
|
||||
* Returns whether the socket is IPv4 or IPv6.
|
||||
* An accepting socket may be both.
|
||||
**/
|
||||
- (BOOL)isIPv4;
|
||||
- (BOOL)isIPv6;
|
||||
|
||||
// The readData and writeData methods won't block (they are asynchronous).
|
||||
//
|
||||
// When a read is complete the onSocket:didReadData:withTag: delegate method is called.
|
||||
// When a write is complete the onSocket:didWriteDataWithTag: delegate method is called.
|
||||
//
|
||||
// You may optionally set a timeout for any read/write operation. (To not timeout, use a negative time interval.)
|
||||
// If a read/write opertion times out, the corresponding "onSocket:shouldTimeout..." delegate method
|
||||
// is called to optionally allow you to extend the timeout.
|
||||
// Upon a timeout, the "onSocket:willDisconnectWithError:" method is called, followed by "onSocketDidDisconnect".
|
||||
//
|
||||
// The tag is for your convenience.
|
||||
// You can use it as an array index, step number, state id, pointer, etc.
|
||||
|
||||
/**
|
||||
* Reads the first available bytes that become available on the socket.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
**/
|
||||
- (void)readDataWithTimeout:(NSTimeInterval)timeout tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Reads the first available bytes that become available on the socket.
|
||||
* The bytes will be appended to the given byte buffer starting at the given offset.
|
||||
* The given buffer will automatically be increased in size if needed.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
* If the buffer if nil, the socket will create a buffer for you.
|
||||
*
|
||||
* If the bufferOffset is greater than the length of the given buffer,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
*
|
||||
* If you pass a buffer, you must not alter it in any way while AsyncSocket is using it.
|
||||
* After completion, the data returned in onSocket:didReadData:withTag: will be a subset of the given buffer.
|
||||
* That is, it will reference the bytes that were appended to the given buffer.
|
||||
**/
|
||||
- (void)readDataWithTimeout:(NSTimeInterval)timeout
|
||||
buffer:(NSMutableData *)buffer
|
||||
bufferOffset:(NSUInteger)offset
|
||||
tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Reads the first available bytes that become available on the socket.
|
||||
* The bytes will be appended to the given byte buffer starting at the given offset.
|
||||
* The given buffer will automatically be increased in size if needed.
|
||||
* A maximum of length bytes will be read.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
* If the buffer if nil, a buffer will automatically be created for you.
|
||||
* If maxLength is zero, no length restriction is enforced.
|
||||
*
|
||||
* If the bufferOffset is greater than the length of the given buffer,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
*
|
||||
* If you pass a buffer, you must not alter it in any way while AsyncSocket is using it.
|
||||
* After completion, the data returned in onSocket:didReadData:withTag: will be a subset of the given buffer.
|
||||
* That is, it will reference the bytes that were appended to the given buffer.
|
||||
**/
|
||||
- (void)readDataWithTimeout:(NSTimeInterval)timeout
|
||||
buffer:(NSMutableData *)buffer
|
||||
bufferOffset:(NSUInteger)offset
|
||||
maxLength:(NSUInteger)length
|
||||
tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Reads the given number of bytes.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
*
|
||||
* If the length is 0, this method does nothing and the delegate is not called.
|
||||
**/
|
||||
- (void)readDataToLength:(NSUInteger)length withTimeout:(NSTimeInterval)timeout tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Reads the given number of bytes.
|
||||
* The bytes will be appended to the given byte buffer starting at the given offset.
|
||||
* The given buffer will automatically be increased in size if needed.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
* If the buffer if nil, a buffer will automatically be created for you.
|
||||
*
|
||||
* If the length is 0, this method does nothing and the delegate is not called.
|
||||
* If the bufferOffset is greater than the length of the given buffer,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
*
|
||||
* If you pass a buffer, you must not alter it in any way while AsyncSocket is using it.
|
||||
* After completion, the data returned in onSocket:didReadData:withTag: will be a subset of the given buffer.
|
||||
* That is, it will reference the bytes that were appended to the given buffer.
|
||||
**/
|
||||
- (void)readDataToLength:(NSUInteger)length
|
||||
withTimeout:(NSTimeInterval)timeout
|
||||
buffer:(NSMutableData *)buffer
|
||||
bufferOffset:(NSUInteger)offset
|
||||
tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Reads bytes until (and including) the passed "data" parameter, which acts as a separator.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
*
|
||||
* If you pass nil or zero-length data as the "data" parameter,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
*
|
||||
* To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter.
|
||||
* Note that this method is not character-set aware, so if a separator can occur naturally as part of the encoding for
|
||||
* a character, the read will prematurely end.
|
||||
**/
|
||||
- (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Reads bytes until (and including) the passed "data" parameter, which acts as a separator.
|
||||
* The bytes will be appended to the given byte buffer starting at the given offset.
|
||||
* The given buffer will automatically be increased in size if needed.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
* If the buffer if nil, a buffer will automatically be created for you.
|
||||
*
|
||||
* If the bufferOffset is greater than the length of the given buffer,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
*
|
||||
* If you pass a buffer, you must not alter it in any way while AsyncSocket is using it.
|
||||
* After completion, the data returned in onSocket:didReadData:withTag: will be a subset of the given buffer.
|
||||
* That is, it will reference the bytes that were appended to the given buffer.
|
||||
*
|
||||
* To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter.
|
||||
* Note that this method is not character-set aware, so if a separator can occur naturally as part of the encoding for
|
||||
* a character, the read will prematurely end.
|
||||
**/
|
||||
- (void)readDataToData:(NSData *)data
|
||||
withTimeout:(NSTimeInterval)timeout
|
||||
buffer:(NSMutableData *)buffer
|
||||
bufferOffset:(NSUInteger)offset
|
||||
tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Reads bytes until (and including) the passed "data" parameter, which acts as a separator.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
*
|
||||
* If maxLength is zero, no length restriction is enforced.
|
||||
* Otherwise if maxLength bytes are read without completing the read,
|
||||
* it is treated similarly to a timeout - the socket is closed with a AsyncSocketReadMaxedOutError.
|
||||
* The read will complete successfully if exactly maxLength bytes are read and the given data is found at the end.
|
||||
*
|
||||
* If you pass nil or zero-length data as the "data" parameter,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
* If you pass a maxLength parameter that is less than the length of the data parameter,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
*
|
||||
* To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter.
|
||||
* Note that this method is not character-set aware, so if a separator can occur naturally as part of the encoding for
|
||||
* a character, the read will prematurely end.
|
||||
**/
|
||||
- (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout maxLength:(NSUInteger)length tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Reads bytes until (and including) the passed "data" parameter, which acts as a separator.
|
||||
* The bytes will be appended to the given byte buffer starting at the given offset.
|
||||
* The given buffer will automatically be increased in size if needed.
|
||||
* A maximum of length bytes will be read.
|
||||
*
|
||||
* If the timeout value is negative, the read operation will not use a timeout.
|
||||
* If the buffer if nil, a buffer will automatically be created for you.
|
||||
*
|
||||
* If maxLength is zero, no length restriction is enforced.
|
||||
* Otherwise if maxLength bytes are read without completing the read,
|
||||
* it is treated similarly to a timeout - the socket is closed with a AsyncSocketReadMaxedOutError.
|
||||
* The read will complete successfully if exactly maxLength bytes are read and the given data is found at the end.
|
||||
*
|
||||
* If you pass a maxLength parameter that is less than the length of the data parameter,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
* If the bufferOffset is greater than the length of the given buffer,
|
||||
* the method will do nothing, and the delegate will not be called.
|
||||
*
|
||||
* If you pass a buffer, you must not alter it in any way while AsyncSocket is using it.
|
||||
* After completion, the data returned in onSocket:didReadData:withTag: will be a subset of the given buffer.
|
||||
* That is, it will reference the bytes that were appended to the given buffer.
|
||||
*
|
||||
* To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter.
|
||||
* Note that this method is not character-set aware, so if a separator can occur naturally as part of the encoding for
|
||||
* a character, the read will prematurely end.
|
||||
**/
|
||||
- (void)readDataToData:(NSData *)data
|
||||
withTimeout:(NSTimeInterval)timeout
|
||||
buffer:(NSMutableData *)buffer
|
||||
bufferOffset:(NSUInteger)offset
|
||||
maxLength:(NSUInteger)length
|
||||
tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Writes data to the socket, and calls the delegate when finished.
|
||||
*
|
||||
* If you pass in nil or zero-length data, this method does nothing and the delegate will not be called.
|
||||
* If the timeout value is negative, the write operation will not use a timeout.
|
||||
**/
|
||||
- (void)writeData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag;
|
||||
|
||||
/**
|
||||
* Returns progress of current read or write, from 0.0 to 1.0, or NaN if no read/write (use isnan() to check).
|
||||
* "tag", "done" and "total" will be filled in if they aren't NULL.
|
||||
**/
|
||||
- (float)progressOfReadReturningTag:(long *)tag bytesDone:(NSUInteger *)done total:(NSUInteger *)total;
|
||||
- (float)progressOfWriteReturningTag:(long *)tag bytesDone:(NSUInteger *)done total:(NSUInteger *)total;
|
||||
|
||||
/**
|
||||
* Secures the connection using SSL/TLS.
|
||||
*
|
||||
* This method may be called at any time, and the TLS handshake will occur after all pending reads and writes
|
||||
* are finished. This allows one the option of sending a protocol dependent StartTLS message, and queuing
|
||||
* the upgrade to TLS at the same time, without having to wait for the write to finish.
|
||||
* Any reads or writes scheduled after this method is called will occur over the secured connection.
|
||||
*
|
||||
* The possible keys and values for the TLS settings are well documented.
|
||||
* Some possible keys are:
|
||||
* - kCFStreamSSLLevel
|
||||
* - kCFStreamSSLAllowsExpiredCertificates
|
||||
* - kCFStreamSSLAllowsExpiredRoots
|
||||
* - kCFStreamSSLAllowsAnyRoot
|
||||
* - kCFStreamSSLValidatesCertificateChain
|
||||
* - kCFStreamSSLPeerName
|
||||
* - kCFStreamSSLCertificates
|
||||
* - kCFStreamSSLIsServer
|
||||
*
|
||||
* Please refer to Apple's documentation for associated values, as well as other possible keys.
|
||||
*
|
||||
* If you pass in nil or an empty dictionary, the default settings will be used.
|
||||
*
|
||||
* The default settings will check to make sure the remote party's certificate is signed by a
|
||||
* trusted 3rd party certificate agency (e.g. verisign) and that the certificate is not expired.
|
||||
* However it will not verify the name on the certificate unless you
|
||||
* give it a name to verify against via the kCFStreamSSLPeerName key.
|
||||
* The security implications of this are important to understand.
|
||||
* Imagine you are attempting to create a secure connection to MySecureServer.com,
|
||||
* but your socket gets directed to MaliciousServer.com because of a hacked DNS server.
|
||||
* If you simply use the default settings, and MaliciousServer.com has a valid certificate,
|
||||
* the default settings will not detect any problems since the certificate is valid.
|
||||
* To properly secure your connection in this particular scenario you
|
||||
* should set the kCFStreamSSLPeerName property to "MySecureServer.com".
|
||||
* If you do not know the peer name of the remote host in advance (for example, you're not sure
|
||||
* if it will be "domain.com" or "www.domain.com"), then you can use the default settings to validate the
|
||||
* certificate, and then use the X509Certificate class to verify the issuer after the socket has been secured.
|
||||
* The X509Certificate class is part of the CocoaAsyncSocket open source project.
|
||||
**/
|
||||
- (void)startTLS:(NSDictionary *)tlsSettings;
|
||||
|
||||
/**
|
||||
* For handling readDataToData requests, data is necessarily read from the socket in small increments.
|
||||
* The performance can be much improved by allowing AsyncSocket to read larger chunks at a time and
|
||||
* store any overflow in a small internal buffer.
|
||||
* This is termed pre-buffering, as some data may be read for you before you ask for it.
|
||||
* If you use readDataToData a lot, enabling pre-buffering will result in better performance, especially on the iPhone.
|
||||
*
|
||||
* The default pre-buffering state is controlled by the DEFAULT_PREBUFFERING definition.
|
||||
* It is highly recommended one leave this set to YES.
|
||||
*
|
||||
* This method exists in case pre-buffering needs to be disabled by default for some unforeseen reason.
|
||||
* In that case, this method exists to allow one to easily enable pre-buffering when ready.
|
||||
**/
|
||||
- (void)enablePreBuffering;
|
||||
|
||||
/**
|
||||
* When you create an AsyncSocket, it is added to the runloop of the current thread.
|
||||
* So for manually created sockets, it is easiest to simply create the socket on the thread you intend to use it.
|
||||
*
|
||||
* If a new socket is accepted, the delegate method onSocket:wantsRunLoopForNewSocket: is called to
|
||||
* allow you to place the socket on a separate thread. This works best in conjunction with a thread pool design.
|
||||
*
|
||||
* If, however, you need to move the socket to a separate thread at a later time, this
|
||||
* method may be used to accomplish the task.
|
||||
*
|
||||
* This method must be called from the thread/runloop the socket is currently running on.
|
||||
*
|
||||
* Note: After calling this method, all further method calls to this object should be done from the given runloop.
|
||||
* Also, all delegate calls will be sent on the given runloop.
|
||||
**/
|
||||
- (BOOL)moveToRunLoop:(NSRunLoop *)runLoop;
|
||||
|
||||
/**
|
||||
* Allows you to configure which run loop modes the socket uses.
|
||||
* The default set of run loop modes is NSDefaultRunLoopMode.
|
||||
*
|
||||
* If you'd like your socket to continue operation during other modes, you may want to add modes such as
|
||||
* NSModalPanelRunLoopMode or NSEventTrackingRunLoopMode. Or you may simply want to use NSRunLoopCommonModes.
|
||||
*
|
||||
* Accepted sockets will automatically inherit the same run loop modes as the listening socket.
|
||||
*
|
||||
* Note: NSRunLoopCommonModes is defined in 10.5. For previous versions one can use kCFRunLoopCommonModes.
|
||||
**/
|
||||
- (BOOL)setRunLoopModes:(NSArray *)runLoopModes;
|
||||
- (BOOL)addRunLoopMode:(NSString *)runLoopMode;
|
||||
- (BOOL)removeRunLoopMode:(NSString *)runLoopMode;
|
||||
|
||||
/**
|
||||
* Returns the current run loop modes the AsyncSocket instance is operating in.
|
||||
* The default set of run loop modes is NSDefaultRunLoopMode.
|
||||
**/
|
||||
- (NSArray *)runLoopModes;
|
||||
|
||||
/**
|
||||
* In the event of an error, this method may be called during onSocket:willDisconnectWithError: to read
|
||||
* any data that's left on the socket.
|
||||
**/
|
||||
- (NSData *)unreadData;
|
||||
|
||||
/* A few common line separators, for use with the readDataToData:... methods. */
|
||||
+ (NSData *)CRLFData; // 0x0D0A
|
||||
+ (NSData *)CRData; // 0x0D
|
||||
+ (NSData *)LFData; // 0x0A
|
||||
+ (NSData *)ZeroData; // 0x00
|
||||
|
||||
@end
|
4192
EmailScheduler/MGMHTTP/AsyncSocket.m
Normal file
4192
EmailScheduler/MGMHTTP/AsyncSocket.m
Normal file
File diff suppressed because it is too large
Load Diff
38
EmailScheduler/MGMHTTP/MGMHTTPAddons.h
Normal file
38
EmailScheduler/MGMHTTP/MGMHTTPAddons.h
Normal file
@ -0,0 +1,38 @@
|
||||
//
|
||||
// MGMHTTPAddons.h
|
||||
// MGMHTTP
|
||||
//
|
||||
// Created by Mr. Gecko on 8/14/13.
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "MGMHTTPDefines.h"
|
||||
|
||||
@interface NSString (MGMHTTPAddons)
|
||||
- (NSString *)trim;
|
||||
- (NSString *)trimQuotes;
|
||||
- (NSString *)replace:(NSString *)targetString with:(NSString *)replaceString;
|
||||
- (NSString *)urlEncode;
|
||||
- (NSString *)urlDecode;
|
||||
+ (NSString *)stringWithInteger:(MGMInteger)theInteger;
|
||||
+ (NSString *)stringWithDate:(NSDate *)theDate;
|
||||
@end
|
89
EmailScheduler/MGMHTTP/MGMHTTPAddons.m
Normal file
89
EmailScheduler/MGMHTTP/MGMHTTPAddons.m
Normal file
@ -0,0 +1,89 @@
|
||||
//
|
||||
// MGMHTTPAddons.m
|
||||
// MGMHTTP
|
||||
//
|
||||
// Created by Mr. Gecko on 8/14/13.
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import "MGMHTTPAddons.h"
|
||||
|
||||
|
||||
@implementation NSString (MGMHTTPAddons)
|
||||
- (NSString *)trim {
|
||||
return [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
}
|
||||
|
||||
- (NSString *)trimQuotes {
|
||||
return [self stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"\"'`"]];
|
||||
}
|
||||
|
||||
- (NSString *)replace:(NSString *)targetString with:(NSString *)replaceString {
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSMutableString *temp = [[NSMutableString alloc] init];
|
||||
NSRange replaceRange = NSMakeRange(0, [self length]);
|
||||
NSRange rangeInOriginalString = replaceRange;
|
||||
int replaced = 0;
|
||||
|
||||
while (1) {
|
||||
NSRange rangeToCopy;
|
||||
NSRange foundRange = [self rangeOfString:targetString options:0 range:rangeInOriginalString];
|
||||
if (foundRange.length==0) break;
|
||||
rangeToCopy = NSMakeRange(rangeInOriginalString.location, foundRange.location - rangeInOriginalString.location);
|
||||
[temp appendString:[self substringWithRange:rangeToCopy]];
|
||||
[temp appendString:replaceString];
|
||||
rangeInOriginalString.length -= (NSMaxRange(foundRange)-rangeInOriginalString.location);
|
||||
rangeInOriginalString.location = NSMaxRange(foundRange);
|
||||
replaced++;
|
||||
if ((replaced%100)==0) {
|
||||
[pool drain];
|
||||
pool = [NSAutoreleasePool new];
|
||||
}
|
||||
}
|
||||
if (rangeInOriginalString.length>0) [temp appendString:[self substringWithRange:rangeInOriginalString]];
|
||||
[pool release];
|
||||
|
||||
return [temp autorelease];
|
||||
}
|
||||
|
||||
- (NSString *)urlEncode {
|
||||
NSString *result = [self stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
CFStringRef escapedString = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)self, NULL, CFSTR("!*'();:^@&=+$,/?%#[]|"), kCFStringEncodingUTF8);
|
||||
|
||||
if (escapedString!=NULL)
|
||||
result = [(NSString *)escapedString autorelease];
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSString *)urlDecode {
|
||||
return [[self replace:@"+" with:@" "] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
+ (NSString *)stringWithInteger:(MGMInteger)theInteger {
|
||||
return [NSString stringWithFormat:@"%ld", theInteger];
|
||||
}
|
||||
+ (NSString *)stringWithDate:(NSDate *)theDate {
|
||||
NSDateFormatter *formatter = [[NSDateFormatter new] autorelease];
|
||||
[formatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]];
|
||||
[formatter setDateFormat:@"EEE, dd MMM yyyy HH:mm:ss zzz"];
|
||||
return [formatter stringFromDate:theDate];
|
||||
}
|
||||
@end
|
157
EmailScheduler/MGMHTTP/MGMHTTPClient.h
Normal file
157
EmailScheduler/MGMHTTP/MGMHTTPClient.h
Normal file
@ -0,0 +1,157 @@
|
||||
//
|
||||
// MGMHTTPClient.h
|
||||
// MGMHTTP
|
||||
//
|
||||
// Created by Mr. Gecko on 8/14/13.
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "MGMHTTPDefines.h"
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
#import <CFNetwork/CFNetwork.h>
|
||||
#endif
|
||||
|
||||
@class AsyncSocket, MGMHTTPServer, MGMHTTPResponse;
|
||||
|
||||
extern NSString * const MGMClientDisconnectedNotification;
|
||||
|
||||
extern NSString * const MGMRPath;
|
||||
extern NSString * const MGMREncoding;
|
||||
extern NSString * const MGMGatewayInterface;
|
||||
extern NSString * const MGMContentType;
|
||||
extern NSString * const MGMContentLength;
|
||||
extern NSString * const MGMServerProtocol;
|
||||
extern NSString * const MGMRequestMethod;
|
||||
extern NSString * const MGMRequestURI;
|
||||
extern NSString * const MGMScriptName;
|
||||
extern NSString * const MGMRemotePort;
|
||||
extern NSString * const MGMServerAddress;
|
||||
extern NSString * const MGMServerPort;
|
||||
extern NSString * const MGMQueryString;
|
||||
extern NSString * const MGMCookies;
|
||||
extern NSString * const MGMPCRemoteAddress;
|
||||
extern NSString * const MGMRemoteAddress;
|
||||
extern NSString * const MGMClientIP;
|
||||
extern NSString * const MGMForwardedFor;
|
||||
extern NSString * const MGMConnection;
|
||||
extern NSString * const MGMServerHeader;
|
||||
extern NSString * const MGMAcceptRanges;
|
||||
extern NSString * const MGMDate;
|
||||
|
||||
@interface MGMHTTPClient : NSObject {
|
||||
AsyncSocket *clientSocket;
|
||||
MGMHTTPServer *server;
|
||||
#if MGMHTTPThreaded
|
||||
NSRunLoop *threadRunLoop;
|
||||
NSThread *thread;
|
||||
#endif
|
||||
|
||||
CFHTTPMessageRef clientRequest;
|
||||
NSDictionary *requestHeaders;
|
||||
int numHeaders;
|
||||
NSMutableDictionary *headers;
|
||||
NSDictionary *getInputs;
|
||||
NSDictionary *postInputs;
|
||||
NSData *postData;
|
||||
NSMutableDictionary *cookies;
|
||||
NSMutableArray *cookiesToPost;
|
||||
NSDictionary *filesUploaded;
|
||||
BOOL headersPosted;
|
||||
|
||||
//File Upload
|
||||
NSString *fBoundary;
|
||||
char fPutback[1024];
|
||||
int fReadPosition;
|
||||
int fWritePosition;
|
||||
int fOffset;
|
||||
BOOL isMultipart;
|
||||
|
||||
NSString *httpVersion;
|
||||
|
||||
MGMHTTPResponse *httpResponse;
|
||||
BOOL isBufferBased;
|
||||
NSMutableData *responseBuffer;
|
||||
BOOL isBufferSending;
|
||||
|
||||
NSMutableArray *ranges;
|
||||
NSMutableArray *rangesHeaders;
|
||||
NSString *rangesBoundry;
|
||||
int rangeIndex;
|
||||
|
||||
MGMInteger requestContentLengthReceived;
|
||||
|
||||
BOOL isKeepAlive;
|
||||
BOOL clientDisconnected;
|
||||
BOOL disconnecting;
|
||||
}
|
||||
- (AsyncSocket *)clientSocket;
|
||||
#if MGMHTTPThreaded
|
||||
- (NSRunLoop *)runLoop;
|
||||
#endif
|
||||
|
||||
+ (id)clientWithSocket:(AsyncSocket *)theSocket server:(MGMHTTPServer *)theServer;
|
||||
- (id)initWithSocket:(AsyncSocket *)theSocket server:(MGMHTTPServer *)theServer;
|
||||
|
||||
- (void)setHTTPVersion:(NSString *)theVersion;
|
||||
|
||||
- (void)setHTTPResponse:(MGMHTTPResponse *)theResponse;
|
||||
|
||||
- (void)sendErrorNum:(int)theErrorNum description:(NSString *)theDescription returnHTML:(BOOL)hasHTML;
|
||||
|
||||
- (NSString *)requestHeaderWithName:(NSString *)name;
|
||||
- (NSDictionary *)requestHeaders;
|
||||
- (MGMInteger)contentLength;
|
||||
|
||||
- (BOOL)setHeader:(NSString *)header withName:(NSString *)name;
|
||||
- (BOOL)deleteHeaderWithName:(NSString *)name;
|
||||
- (NSString *)headerWithName:(NSString *)name;
|
||||
- (NSDictionary *)headers;
|
||||
|
||||
- (BOOL)setCookie:(NSString *)cookie forName:(NSString *)name expires:(NSDate *)expires domain:(NSString *)domain path:(NSString *)path secure:(BOOL)secure httpOnly:(BOOL)httpOnly;
|
||||
- (BOOL)deleteCookieWithName:(NSString *)name withDomain:(NSString *)domain withPath:(NSString *)path secure:(BOOL)secure httpOnly:(BOOL)httpOnly;
|
||||
- (NSString *)cookieWithName:(NSString *)name;
|
||||
- (NSDictionary *)cookies;
|
||||
|
||||
- (NSString *)getInputWithName:(NSString *)name;
|
||||
- (NSDictionary *)getInputs;
|
||||
- (NSString *)postInputWithName:(NSString *)name;
|
||||
- (NSDictionary *)postInputs;
|
||||
|
||||
- (NSString *)requestWithName:(NSString *)name;
|
||||
- (NSDictionary *)requests;
|
||||
|
||||
- (NSDictionary *)fileWithName:(NSString *)Name;
|
||||
- (NSDictionary *)filesUploaded;
|
||||
|
||||
- (NSString *)userIP;
|
||||
|
||||
- (NSArray *)sslCertificates;
|
||||
- (void)replyToClient;
|
||||
|
||||
- (void)printData:(NSData *)data;
|
||||
- (void)print:(NSString *)format, ...;
|
||||
- (void)printError:(NSString *)format, ...;
|
||||
- (void)flush;
|
||||
|
||||
- (void)disconnect;
|
||||
@end
|
1202
EmailScheduler/MGMHTTP/MGMHTTPClient.m
Normal file
1202
EmailScheduler/MGMHTTP/MGMHTTPClient.m
Normal file
File diff suppressed because it is too large
Load Diff
27
EmailScheduler/MGMHTTP/MGMHTTPDefines.h
Normal file
27
EmailScheduler/MGMHTTP/MGMHTTPDefines.h
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// MGMHTTPDefines.h
|
||||
// MGMHTTP copy
|
||||
//
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
typedef long MGMInteger;
|
||||
typedef unsigned long MGMUInteger;
|
59
EmailScheduler/MGMHTTP/MGMHTTPResponse.h
Normal file
59
EmailScheduler/MGMHTTP/MGMHTTPResponse.h
Normal file
@ -0,0 +1,59 @@
|
||||
//
|
||||
// MGMHTTPResponse.h
|
||||
// MGMHTTP
|
||||
//
|
||||
// Created by Mr. Gecko on 8/14/13.
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "MGMHTTPDefines.h"
|
||||
|
||||
@interface MGMHTTPResponse : NSObject {
|
||||
MGMInteger offset;
|
||||
NSData *data;
|
||||
}
|
||||
+ (id)responseWithData:(NSData *)theData;
|
||||
- (id)initWithData:(NSData *)theData;
|
||||
+ (id)responseWithString:(NSString *)theString;
|
||||
- (id)initWithString:(NSString *)theString;
|
||||
|
||||
- (MGMInteger)contentLength;
|
||||
|
||||
- (MGMInteger)offset;
|
||||
- (void)setOffset:(MGMInteger)theOffset;
|
||||
|
||||
- (NSData *)readDataOfLength:(MGMInteger)theLength;
|
||||
@end
|
||||
|
||||
@interface MGMHTTPFileResponse : MGMHTTPResponse {
|
||||
NSString *filePath;
|
||||
NSFileHandle *fileHandle;
|
||||
}
|
||||
+ (id)responseWithFilePath:(NSString *)thePath;
|
||||
- (id)initWithFilePath:(NSString *)thePath;
|
||||
@end
|
||||
|
||||
@interface MGMHTTPMIME : NSObject {
|
||||
|
||||
}
|
||||
+ (NSString *)mimeForExtension:(NSString *)theExtension;
|
||||
@end
|
131
EmailScheduler/MGMHTTP/MGMHTTPResponse.m
Normal file
131
EmailScheduler/MGMHTTP/MGMHTTPResponse.m
Normal file
@ -0,0 +1,131 @@
|
||||
//
|
||||
// MGMHTTPResponse.m
|
||||
// MGMHTTP
|
||||
//
|
||||
// Created by Mr. Gecko on 8/14/13.
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import "MGMHTTPResponse.h"
|
||||
|
||||
@implementation MGMHTTPResponse
|
||||
+ (id)responseWithData:(NSData *)theData {
|
||||
return [[[self alloc] initWithData:theData] autorelease];
|
||||
}
|
||||
- (id)initWithData:(NSData *)theData {
|
||||
if (self = [super init]) {
|
||||
data = [theData retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
+ (id)responseWithString:(NSString *)theString {
|
||||
return [[[self alloc] initWithString:theString] autorelease];
|
||||
}
|
||||
- (id)initWithString:(NSString *)theString {
|
||||
if (self = [super init]) {
|
||||
data = [[theString dataUsingEncoding:NSUTF8StringEncoding] retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (void)dealloc {
|
||||
[data release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (MGMInteger)contentLength {
|
||||
return [data length];
|
||||
}
|
||||
|
||||
- (MGMInteger)offset {
|
||||
return offset;
|
||||
}
|
||||
- (void)setOffset:(MGMInteger)theOffset {
|
||||
offset = theOffset;
|
||||
}
|
||||
|
||||
- (NSData *)readDataOfLength:(MGMInteger)theLength {
|
||||
MGMInteger remaining = [data length]-offset;
|
||||
MGMInteger length = theLength<remaining ? theLength : remaining;
|
||||
|
||||
NSData *returnData = [data subdataWithRange:NSMakeRange(offset, length)];
|
||||
offset = offset+length;
|
||||
return returnData;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation MGMHTTPFileResponse
|
||||
+ (id)responseWithFilePath:(NSString *)thePath {
|
||||
return [[[self alloc] initWithFilePath:thePath] autorelease];
|
||||
}
|
||||
- (id)initWithFilePath:(NSString *)thePath {
|
||||
if (self = [super init]) {
|
||||
filePath = [thePath retain];
|
||||
fileHandle = [[NSFileHandle fileHandleForReadingAtPath:filePath] retain];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (void)dealloc {
|
||||
[fileHandle release];
|
||||
[filePath release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (MGMInteger)contentLength {
|
||||
NSFileManager *manager = [NSFileManager defaultManager];
|
||||
NSDictionary *fileAttributes = nil;
|
||||
if ([manager respondsToSelector:@selector(fileAttributesAtPath:traverseLink:)]) {
|
||||
fileAttributes = [manager fileAttributesAtPath:filePath traverseLink:YES];
|
||||
} else {
|
||||
fileAttributes = [manager attributesOfItemAtPath:filePath error:nil];
|
||||
}
|
||||
return [[fileAttributes objectForKey:NSFileSize] longValue];
|
||||
}
|
||||
|
||||
- (MGMInteger)offset {
|
||||
return (MGMInteger)[fileHandle offsetInFile];
|
||||
}
|
||||
- (void)setOffset:(MGMInteger)theOffset {
|
||||
[fileHandle seekToFileOffset:theOffset];
|
||||
}
|
||||
|
||||
- (NSData *)readDataOfLength:(MGMInteger)theLength {
|
||||
return [fileHandle readDataOfLength:theLength];
|
||||
}
|
||||
@end
|
||||
|
||||
static NSArray *MGMHTTPMIMEMap = nil;
|
||||
|
||||
@implementation MGMHTTPMIME
|
||||
+ (NSString *)mimeForExtension:(NSString *)theExtension {
|
||||
if (MGMHTTPMIMEMap==nil) {
|
||||
MGMHTTPMIMEMap = [[NSArray arrayWithContentsOfFile:[[[NSBundle bundleForClass:self] resourcePath] stringByAppendingPathComponent:@"mimeTypes.plist"]] retain];
|
||||
}
|
||||
for (unsigned int mimeIndex=0; mimeIndex<[MGMHTTPMIMEMap count]; mimeIndex++) {
|
||||
NSDictionary *mime = [MGMHTTPMIMEMap objectAtIndex:mimeIndex];
|
||||
NSArray *extensions = [mime objectForKey:@"extensions"];
|
||||
for (unsigned int extensionIndex=0; extensionIndex<[extensions count]; extensionIndex++) {
|
||||
if ([[extensions objectAtIndex:extensionIndex] isEqualToString:theExtension])
|
||||
return [mime objectForKey:@"type"];
|
||||
}
|
||||
}
|
||||
return @"text/plain";
|
||||
}
|
||||
@end
|
88
EmailScheduler/MGMHTTP/MGMHTTPServer.h
Normal file
88
EmailScheduler/MGMHTTP/MGMHTTPServer.h
Normal file
@ -0,0 +1,88 @@
|
||||
//
|
||||
// MGMHTTPServer.h
|
||||
// MGMHTTP
|
||||
//
|
||||
// Created by Mr. Gecko on 8/14/13.
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#define MGMHTTPDebug 0
|
||||
#define MGMHTTPThreaded 0
|
||||
|
||||
@class AsyncSocket, MGMHTTPClient, MGMHTTPResponse;
|
||||
|
||||
@protocol MGMHTTPServerDelegate
|
||||
- (Class)httpClientClass;
|
||||
- (MGMHTTPResponse *)httpResponseForClient:(MGMHTTPClient *)theClient;
|
||||
- (void)finnishedSendingResponse:(MGMHTTPClient *)theClient;
|
||||
@end
|
||||
|
||||
@interface MGMHTTPServer : NSObject
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
|
||||
<NSNetServiceDelegate>
|
||||
#endif
|
||||
{
|
||||
AsyncSocket *httpSocket;
|
||||
|
||||
NSObject<MGMHTTPServerDelegate> *delegate;
|
||||
Class clientClass;
|
||||
NSMutableArray *clientConnections;
|
||||
int port;
|
||||
|
||||
NSNetService *bonjour;
|
||||
NSString *bonjourDomain;
|
||||
NSString *bonjourType;
|
||||
NSString *bonjourName;
|
||||
BOOL bonjourEnabled;
|
||||
}
|
||||
+ (id)serverWithPort:(int)thePort delegate:(id)theDelegate;
|
||||
- (id)initServerWithPort:(int)thePort delegate:(id)theDelegate;
|
||||
|
||||
- (AsyncSocket *)httpSocket;
|
||||
- (NSArray *)clientConnections;
|
||||
|
||||
- (id)delegate;
|
||||
- (void)setDelegate:(id)theDelegate;
|
||||
|
||||
- (int)port;
|
||||
- (void)setPort:(int)thePort;
|
||||
|
||||
- (NSString *)bonjourDomain;
|
||||
- (void)setBonjourDomain:(NSString *)theDomain;
|
||||
|
||||
- (NSString *)bonjourType;
|
||||
- (void)setBonjourType:(NSString *)theType;
|
||||
|
||||
- (NSString *)bonjourName;
|
||||
- (NSString *)bonjourPublishedName;
|
||||
- (void)setBonjourName:(NSString *)theName;
|
||||
|
||||
- (BOOL)isBonjourEnabled;
|
||||
- (void)setBonjourEnabled:(BOOL)isEnabled;
|
||||
|
||||
- (Class)httpClientClass;
|
||||
- (void)setHTTPClientClass:(Class)theClientClass;
|
||||
|
||||
- (BOOL)start:(NSError **)error;
|
||||
- (void)stop;
|
||||
@end
|
207
EmailScheduler/MGMHTTP/MGMHTTPServer.m
Normal file
207
EmailScheduler/MGMHTTP/MGMHTTPServer.m
Normal file
@ -0,0 +1,207 @@
|
||||
//
|
||||
// MGMHTTPServer.m
|
||||
// MGMHTTP
|
||||
//
|
||||
// Created by Mr. Gecko on 8/14/13.
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import "MGMHTTPServer.h"
|
||||
#import "MGMHTTPClient.h"
|
||||
#import "AsyncSocket.h"
|
||||
|
||||
@implementation MGMHTTPServer
|
||||
+ (id)serverWithPort:(int)thePort delegate:(id)theDelegate {
|
||||
return [[[self alloc] initServerWithPort:thePort delegate:theDelegate] autorelease];
|
||||
}
|
||||
- (id)initServerWithPort:(int)thePort delegate:(id)theDelegate {
|
||||
if (self = [super init]) {
|
||||
httpSocket = [[AsyncSocket alloc] initWithDelegate:self];
|
||||
port = thePort;
|
||||
delegate = [theDelegate retain];
|
||||
clientClass = [MGMHTTPClient class];
|
||||
|
||||
[self setBonjourDomain:@"local."];
|
||||
[self setBonjourType:@"_http._tcp."];
|
||||
[self setBonjourName:@""];
|
||||
[self setBonjourEnabled:NO];
|
||||
clientConnections = [NSMutableArray new];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clientDisconected:) name:MGMClientDisconnectedNotification object:nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (void)dealloc {
|
||||
[httpSocket disconnect];
|
||||
[httpSocket release];
|
||||
[clientConnections release];
|
||||
[bonjour release];
|
||||
[bonjourDomain release];
|
||||
[bonjourType release];
|
||||
[bonjourName release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (AsyncSocket *)httpSocket {
|
||||
return httpSocket;
|
||||
}
|
||||
- (NSArray *)clientConnections {
|
||||
return clientConnections;
|
||||
}
|
||||
|
||||
- (id)delegate {
|
||||
return delegate;
|
||||
}
|
||||
- (void)setDelegate:(id)theDelegate {
|
||||
delegate = theDelegate;
|
||||
}
|
||||
|
||||
- (int)port {
|
||||
return port;
|
||||
}
|
||||
- (void)setPort:(int)thePort {
|
||||
port = thePort;
|
||||
}
|
||||
|
||||
- (NSString *)bonjourDomain {
|
||||
return bonjourDomain;
|
||||
}
|
||||
- (void)setBonjourDomain:(NSString *)theDomain {
|
||||
[bonjourDomain release];
|
||||
bonjourDomain = [theDomain retain];
|
||||
}
|
||||
|
||||
- (NSString *)bonjourType {
|
||||
return bonjourType;
|
||||
}
|
||||
- (void)setBonjourType:(NSString *)theType {
|
||||
[bonjourType release];
|
||||
bonjourType = [theType retain];
|
||||
}
|
||||
|
||||
- (NSString *)bonjourName {
|
||||
return bonjourName;
|
||||
}
|
||||
- (NSString *)bonjourPublishedName {
|
||||
return [bonjour name];
|
||||
}
|
||||
- (void)setBonjourName:(NSString *)theName {
|
||||
[bonjourName release];
|
||||
bonjourName = [theName retain];
|
||||
}
|
||||
|
||||
- (BOOL)isBonjourEnabled {
|
||||
return bonjourEnabled;
|
||||
}
|
||||
- (void)setBonjourEnabled:(BOOL)isEnabled {
|
||||
bonjourEnabled = isEnabled;
|
||||
if (bonjourEnabled) {
|
||||
if (bonjour==nil && [httpSocket isConnected]) {
|
||||
bonjour = [[NSNetService alloc] initWithDomain:bonjourDomain type:bonjourType name:bonjourName port:port];
|
||||
[bonjour setDelegate:self];
|
||||
[bonjour publish];
|
||||
}
|
||||
} else {
|
||||
if (bonjour!=nil) {
|
||||
[bonjour stop];
|
||||
[bonjour release];
|
||||
bonjour = nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (Class)httpClientClass {
|
||||
return clientClass;
|
||||
}
|
||||
- (void)setHTTPClientClass:(Class)theClientClass {
|
||||
clientClass = theClientClass;
|
||||
}
|
||||
|
||||
- (BOOL)start:(NSError **)error {
|
||||
BOOL success = [httpSocket acceptOnPort:port error:error];
|
||||
if (success) {
|
||||
port = [httpSocket localPort];
|
||||
#if MGMHTTPDebug
|
||||
NSLog(@"Started server on port %d", port);
|
||||
#endif
|
||||
if (bonjourEnabled) {
|
||||
bonjour = [[NSNetService alloc] initWithDomain:bonjourDomain type:bonjourType name:bonjourName port:port];
|
||||
[bonjour setDelegate:self];
|
||||
[bonjour publish];
|
||||
}
|
||||
} else {
|
||||
NSLog(@"Failed to start Server: %@", *error);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
- (void)stop {
|
||||
if(bonjour!=nil) {
|
||||
[bonjour stop];
|
||||
[bonjour release];
|
||||
bonjour = nil;
|
||||
}
|
||||
[httpSocket disconnect];
|
||||
[clientConnections removeAllObjects];
|
||||
}
|
||||
|
||||
- (void)netServiceDidPublish:(NSNetService *)sender {
|
||||
#if MGMHTTPDebug
|
||||
NSLog(@"Bonjour Published domain:%@ type:%@ name:%@", [sender domain], [sender type], [sender name]);
|
||||
#endif
|
||||
}
|
||||
- (void)netService:(NSNetService *)sender didNotPublish:(NSDictionary *)errorDict {
|
||||
NSLog(@"Failed to Publish Bonjour domain:%@ type:%@ name:%@ error:%@", [sender domain], [sender type], [sender name], errorDict);
|
||||
}
|
||||
|
||||
- (int)clientConnectionCount {
|
||||
int count;
|
||||
@synchronized(clientConnections) {
|
||||
count = (int)[clientConnections count];
|
||||
}
|
||||
return count;
|
||||
}
|
||||
#if MGMHTTPThreaded
|
||||
- (NSRunLoop *)onSocket:(AsyncSocket *)sock wantsRunLoopForNewSocket:(AsyncSocket *)newSocket {
|
||||
@synchronized(clientConnections) {
|
||||
for (unsigned int i=0; i<[clientConnections count]; i++) {
|
||||
if ([[[clientConnections objectAtIndex:i] clientSocket] isEqual:newSocket])
|
||||
return [[clientConnections objectAtIndex:i] runLoop];
|
||||
}
|
||||
}
|
||||
return [NSRunLoop currentRunLoop];
|
||||
}
|
||||
#endif
|
||||
- (void)onSocket:(AsyncSocket *)sock didAcceptNewSocket:(AsyncSocket *)newSocket {
|
||||
if (clientClass==[MGMHTTPClient class]) {
|
||||
if ([delegate respondsToSelector:@selector(httpClientClass)]) {
|
||||
clientClass = [delegate httpClientClass];
|
||||
}
|
||||
}
|
||||
MGMHTTPClient *theClient = [clientClass clientWithSocket:newSocket server:self];
|
||||
@synchronized(clientConnections) {
|
||||
[clientConnections addObject:theClient];
|
||||
}
|
||||
}
|
||||
- (void)clientDisconected:(NSNotification *)theNotification {
|
||||
@synchronized(clientConnections) {
|
||||
[clientConnections removeObject:[theNotification object]];
|
||||
}
|
||||
}
|
||||
@end
|
34
EmailScheduler/MGMHTTPClientClass.h
Normal file
34
EmailScheduler/MGMHTTPClientClass.h
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// MGMHTTPClientClass.h
|
||||
// EmailScheduler
|
||||
//
|
||||
// Created by James Coleman on 9/13/14.
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "MGMHTTP/MGMHTTPClient.h"
|
||||
|
||||
@interface MGMHTTPClientClass : MGMHTTPClient {
|
||||
|
||||
}
|
||||
|
||||
@end
|
87
EmailScheduler/MGMHTTPClientClass.m
Normal file
87
EmailScheduler/MGMHTTPClientClass.m
Normal file
@ -0,0 +1,87 @@
|
||||
//
|
||||
// MGMHTTPClientClass.m
|
||||
// EmailScheduler
|
||||
//
|
||||
// Created by James Coleman on 9/13/14.
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import "MGMHTTPClientClass.h"
|
||||
#import "MGMController.h"
|
||||
#import "MGMJSON.h"
|
||||
#import "MGMEmail.h"
|
||||
#import <MailCore/MailCore.h>
|
||||
|
||||
@implementation MGMHTTPClientClass
|
||||
- (void)replyToClient {
|
||||
MGMController *controller = [MGMController sharedController];
|
||||
NSString *user = [self requestWithName:@"user"];
|
||||
NSString *fromEmail = [self requestWithName:@"from"];
|
||||
NSString *fromName = [self requestWithName:@"from-name"];
|
||||
NSString *toEmail = [self requestWithName:@"to"];
|
||||
NSString *toName = [self requestWithName:@"to-name"];
|
||||
NSString *subject = [self requestWithName:@"subject"];
|
||||
NSString *message = [self requestWithName:@"message"];
|
||||
NSString *messageHTML = [self requestWithName:@"message-html"];
|
||||
NSString *additionalHeadersString = [self requestWithName:@"headers"];
|
||||
|
||||
if (fromEmail!=nil && ![fromEmail isEqual:@""] && toEmail!=nil && ![toEmail isEqual:@""] && subject!=nil && ![subject isEqual:@""] && message!=nil && ![message isEqual:@""]) {
|
||||
if ([[controller emailAddresses] objectForKey:(user!=nil && ![user isEqual:@""] ? user : fromEmail)]==nil) {
|
||||
NSDictionary *response = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], @"success", [NSString stringWithFormat:@"No handler for email address %@", fromEmail], @"error", nil];
|
||||
[self print:[response JSONValue]];
|
||||
} else {
|
||||
MCOMessageBuilder *builder = [[MCOMessageBuilder alloc] init];
|
||||
MCOAddress *from = [MCOAddress addressWithDisplayName:fromName mailbox:fromEmail];
|
||||
MCOAddress *to = [MCOAddress addressWithDisplayName:toName mailbox:toEmail];
|
||||
[[builder header] setFrom:from];
|
||||
[[builder header] setTo:@[to]];
|
||||
[[builder header] setSubject:subject];
|
||||
[[builder header] setUserAgent:@"MGMEmail/0.1"];
|
||||
if (messageHTML!=nil && ![messageHTML isEqual:@""]) {
|
||||
[builder setHTMLBody:messageHTML];
|
||||
}
|
||||
[builder setTextBody:message];
|
||||
|
||||
NSDictionary *additionalHeaders = (NSDictionary *)[additionalHeadersString parseJSON];
|
||||
if (additionalHeaders!=nil && [additionalHeaders isKindOfClass:[NSDictionary class]]) {
|
||||
NSArray *keys = [additionalHeaders allKeys];
|
||||
for (unsigned int i=0; i<[keys count]; i++) {
|
||||
[[builder header] setExtraHeaderValue:[additionalHeaders objectForKey:[keys objectAtIndex:i]] forName:[keys objectAtIndex:i]];
|
||||
}
|
||||
}
|
||||
|
||||
NSData *rfc822Data = [builder data];
|
||||
MGMEmail *email = [[MGMEmail new] autorelease];
|
||||
[email setEmailAddress:(user!=nil && ![user isEqual:@""] ? user : fromEmail)];
|
||||
[email setRFC822Data:rfc822Data];
|
||||
[controller addToQueue:email];
|
||||
|
||||
NSDictionary *response = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"success", nil];
|
||||
[self print:[response JSONValue]];
|
||||
}
|
||||
} else {
|
||||
NSDictionary *response = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], @"success", @"Invalid input", @"error", nil];
|
||||
[self print:[response JSONValue]];
|
||||
}
|
||||
|
||||
[super replyToClient];
|
||||
}
|
||||
@end
|
38
EmailScheduler/main.m
Normal file
38
EmailScheduler/main.m
Normal file
@ -0,0 +1,38 @@
|
||||
//
|
||||
// main.m
|
||||
// EmailScheduler
|
||||
//
|
||||
// Created by James Coleman on 9/13/14.
|
||||
// Copyright (c) 2014 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "MGMController.h"
|
||||
|
||||
int main(int argc, const char * argv[]) {
|
||||
@autoreleasepool {
|
||||
MGMController *controller = [[MGMController alloc] init];
|
||||
[[NSRunLoop currentRunLoop] run];
|
||||
[controller release];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
1
MailCore.framework/Headers
Symbolic link
1
MailCore.framework/Headers
Symbolic link
@ -0,0 +1 @@
|
||||
Versions/Current/Headers
|
1
MailCore.framework/MailCore
Symbolic link
1
MailCore.framework/MailCore
Symbolic link
@ -0,0 +1 @@
|
||||
Versions/Current/MailCore
|
1
MailCore.framework/Resources
Symbolic link
1
MailCore.framework/Resources
Symbolic link
@ -0,0 +1 @@
|
||||
Versions/Current/Resources
|
13
MailCore.framework/Versions/A/Headers/MCAbstract.h
Normal file
13
MailCore.framework/Versions/A/Headers/MCAbstract.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef MAILCORE_MCABSTRACT_H
|
||||
|
||||
#define MAILCORE_MCABSTRACT_H
|
||||
|
||||
#include <MailCore/MCAbstractMessage.h>
|
||||
#include <MailCore/MCAbstractMessagePart.h>
|
||||
#include <MailCore/MCAbstractMultipart.h>
|
||||
#include <MailCore/MCAbstractPart.h>
|
||||
#include <MailCore/MCAddress.h>
|
||||
#include <MailCore/MCMessageConstants.h>
|
||||
#include <MailCore/MCMessageHeader.h>
|
||||
|
||||
#endif
|
46
MailCore.framework/Versions/A/Headers/MCAbstractMessage.h
Normal file
46
MailCore.framework/Versions/A/Headers/MCAbstractMessage.h
Normal file
@ -0,0 +1,46 @@
|
||||
#ifndef MAILCORE_MCABSTRACTMESSAGE_H
|
||||
|
||||
#define MAILCORE_MCABSTRACTMESSAGE_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class AbstractPart;
|
||||
class MessageHeader;
|
||||
|
||||
class AbstractMessage : public Object {
|
||||
public:
|
||||
AbstractMessage();
|
||||
virtual ~AbstractMessage();
|
||||
|
||||
virtual MessageHeader * header();
|
||||
virtual void setHeader(MessageHeader * header);
|
||||
|
||||
virtual AbstractPart * partForContentID(String * contentID);
|
||||
virtual AbstractPart * partForUniqueID(String * uniqueID);
|
||||
|
||||
virtual Array * /* AbstractPart */ attachments();
|
||||
virtual Array * /* AbstractPart */ htmlInlineAttachments();
|
||||
virtual Array * /* AbstractPart */ requiredPartsForRendering();
|
||||
|
||||
public: //subclass behavior
|
||||
AbstractMessage(AbstractMessage * other);
|
||||
virtual String * description();
|
||||
virtual Object * copy();
|
||||
virtual HashMap * serializable();
|
||||
virtual void importSerializable(HashMap * hashmap);
|
||||
|
||||
private:
|
||||
MessageHeader * mHeader;
|
||||
void init();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,45 @@
|
||||
#ifndef MAILCORE_MCABSTRACTMESSAGEPART_H
|
||||
|
||||
#define MAILCORE_MCABSTRACTMESSAGEPART_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
#include <MailCore/MCAbstractPart.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class MessageHeader;
|
||||
|
||||
class AbstractMessagePart : public AbstractPart {
|
||||
public:
|
||||
AbstractMessagePart();
|
||||
virtual ~AbstractMessagePart();
|
||||
|
||||
virtual MessageHeader * header();
|
||||
virtual void setHeader(MessageHeader * header);
|
||||
|
||||
virtual AbstractPart * mainPart();
|
||||
virtual void setMainPart(AbstractPart * mainPart);
|
||||
|
||||
public: //subclass behavior
|
||||
AbstractMessagePart(AbstractMessagePart * other);
|
||||
virtual String * description();
|
||||
virtual Object * copy();
|
||||
virtual HashMap * serializable();
|
||||
virtual void importSerializable(HashMap * serializable);
|
||||
|
||||
virtual AbstractPart * partForContentID(String * contentID);
|
||||
virtual AbstractPart * partForUniqueID(String * uniqueID);
|
||||
|
||||
private:
|
||||
AbstractPart * mMainPart;
|
||||
MessageHeader * mHeader;
|
||||
void init();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
39
MailCore.framework/Versions/A/Headers/MCAbstractMultipart.h
Normal file
39
MailCore.framework/Versions/A/Headers/MCAbstractMultipart.h
Normal file
@ -0,0 +1,39 @@
|
||||
#ifndef MAILCORE_MCABSTRACTMULTIPART_H
|
||||
|
||||
#define MAILCORE_MCABSTRACTMULTIPART_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
#include <MailCore/MCAbstractPart.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class AbstractMultipart : public AbstractPart {
|
||||
public:
|
||||
AbstractMultipart();
|
||||
virtual ~AbstractMultipart();
|
||||
|
||||
virtual Array * parts();
|
||||
virtual void setParts(Array * parts);
|
||||
|
||||
public: //subclass behavior
|
||||
AbstractMultipart(AbstractMultipart * other);
|
||||
virtual String * description();
|
||||
virtual Object * copy();
|
||||
virtual HashMap * serializable();
|
||||
virtual void importSerializable(HashMap * serializable);
|
||||
|
||||
virtual AbstractPart * partForContentID(String * contentID);
|
||||
virtual AbstractPart * partForUniqueID(String * uniqueID);
|
||||
|
||||
private:
|
||||
Array * mParts;
|
||||
void init();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
80
MailCore.framework/Versions/A/Headers/MCAbstractPart.h
Normal file
80
MailCore.framework/Versions/A/Headers/MCAbstractPart.h
Normal file
@ -0,0 +1,80 @@
|
||||
#ifndef MAILCORE_MCABSTRACTPART_H
|
||||
|
||||
#define MAILCORE_MCABSTRACTPART_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
#include <MailCore/MCMessageConstants.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class AbstractMessage;
|
||||
|
||||
class AbstractPart : public Object {
|
||||
public:
|
||||
AbstractPart();
|
||||
virtual ~AbstractPart();
|
||||
|
||||
virtual PartType partType();
|
||||
virtual void setPartType(PartType type);
|
||||
|
||||
virtual String * filename();
|
||||
virtual void setFilename(String * filename);
|
||||
|
||||
virtual String * mimeType();
|
||||
virtual void setMimeType(String * mimeType);
|
||||
|
||||
virtual String * charset();
|
||||
virtual void setCharset(String * charset);
|
||||
|
||||
virtual String * uniqueID();
|
||||
virtual void setUniqueID(String * uniqueID);
|
||||
|
||||
virtual String * contentID();
|
||||
virtual void setContentID(String * contentID);
|
||||
|
||||
virtual String * contentLocation();
|
||||
virtual void setContentLocation(String * contentLocation);
|
||||
|
||||
virtual String * contentDescription();
|
||||
virtual void setContentDescription(String * contentDescription);
|
||||
|
||||
virtual bool isInlineAttachment();
|
||||
virtual void setInlineAttachment(bool inlineAttachment);
|
||||
|
||||
virtual AbstractPart * partForContentID(String * contentID);
|
||||
virtual AbstractPart * partForUniqueID(String * uniqueID);
|
||||
|
||||
virtual String * decodedStringForData(Data * data);
|
||||
|
||||
public: // subclass behavior
|
||||
AbstractPart(AbstractPart * other);
|
||||
virtual String * description();
|
||||
virtual Object * copy();
|
||||
virtual HashMap * serializable();
|
||||
virtual void importSerializable(HashMap * serializable);
|
||||
|
||||
public: // private
|
||||
virtual void importIMAPFields(struct mailimap_body_fields * fields,
|
||||
struct mailimap_body_ext_1part * extension);
|
||||
virtual void applyUniquePartID();
|
||||
|
||||
private:
|
||||
String * mUniqueID;
|
||||
String * mFilename;
|
||||
String * mMimeType;
|
||||
String * mCharset;
|
||||
String * mContentID;
|
||||
String * mContentLocation;
|
||||
String * mContentDescription;
|
||||
bool mInlineAttachment;
|
||||
PartType mPartType;
|
||||
void init();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
65
MailCore.framework/Versions/A/Headers/MCAddress.h
Normal file
65
MailCore.framework/Versions/A/Headers/MCAddress.h
Normal file
@ -0,0 +1,65 @@
|
||||
#ifndef MAILCORE_MCADDRESS_H
|
||||
|
||||
#define MAILCORE_MCADDRESS_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class Address : public Object {
|
||||
public:
|
||||
Address();
|
||||
virtual ~Address();
|
||||
|
||||
static Address * addressWithDisplayName(String * displayName, String * mailbox);
|
||||
static Address * addressWithMailbox(String * mailbox);
|
||||
static Address * addressWithRFC822String(String * RFC822String);
|
||||
static Address * addressWithNonEncodedRFC822String(String * nonEncodedRFC822String);
|
||||
|
||||
static Array * addressesWithRFC822String(String * string);
|
||||
static Array * addressesWithNonEncodedRFC822String(String * string);
|
||||
|
||||
static String * RFC822StringForAddresses(Array * addresses);
|
||||
static String * nonEncodedRFC822StringForAddresses(Array * addresses);
|
||||
|
||||
virtual void setDisplayName(String * displayName);
|
||||
virtual String * displayName();
|
||||
|
||||
virtual void setMailbox(String * address);
|
||||
virtual String * mailbox();
|
||||
|
||||
virtual String * RFC822String();
|
||||
virtual String * nonEncodedRFC822String();
|
||||
|
||||
public: // subclass behavior.
|
||||
Address(Address * other);
|
||||
virtual String * description();
|
||||
virtual bool isEqual(Object * otherObject);
|
||||
virtual unsigned int hash();
|
||||
virtual Object * copy();
|
||||
virtual HashMap * serializable();
|
||||
virtual void importSerializable(HashMap * serializable);
|
||||
|
||||
public: // private
|
||||
// Must be released
|
||||
virtual struct mailimf_address * createIMFAddress();
|
||||
virtual struct mailimf_mailbox * createIMFMailbox();
|
||||
|
||||
// Additions
|
||||
static Address * addressWithIMFMailbox(struct mailimf_mailbox * mb);
|
||||
static Address * addressWithNonEncodedIMFMailbox(struct mailimf_mailbox * mb);
|
||||
static Address * addressWithIMAPAddress(struct mailimap_address * imap_addr);
|
||||
|
||||
private:
|
||||
String * mDisplayName;
|
||||
String * mMailbox;
|
||||
void init();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
34
MailCore.framework/Versions/A/Headers/MCAddressDisplay.h
Normal file
34
MailCore.framework/Versions/A/Headers/MCAddressDisplay.h
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// MCAddressDisplay.h
|
||||
// testUI
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/27/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCADDRESSDISPLAY_H
|
||||
|
||||
#define MAILCORE_MCADDRESSDISPLAY_H
|
||||
|
||||
#include <MailCore/MCAbstract.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class AddressDisplay {
|
||||
public:
|
||||
static String * displayStringForAddress(Address * address);
|
||||
static String * shortDisplayStringForAddress(Address * address);
|
||||
static String * veryShortDisplayStringForAddress(Address * address);
|
||||
|
||||
static String * displayStringForAddresses(Array * /* Address */ addresses);
|
||||
static String * shortDisplayStringForAddresses(Array * /* Address */ addresses);
|
||||
static String * veryShortDisplayStringForAddresses(Array * /* Address */ addresses);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
58
MailCore.framework/Versions/A/Headers/MCArray.h
Normal file
58
MailCore.framework/Versions/A/Headers/MCArray.h
Normal file
@ -0,0 +1,58 @@
|
||||
#ifndef MAILCORE_MCARRAY_H
|
||||
|
||||
#define MAILCORE_MCARRAY_H
|
||||
|
||||
#include <MailCore/MCObject.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
typedef struct carray_s carray;
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class String;
|
||||
|
||||
class Array : public Object {
|
||||
public:
|
||||
Array();
|
||||
virtual ~Array();
|
||||
|
||||
static Array * array();
|
||||
static Array * arrayWithObject(Object * obj);
|
||||
|
||||
virtual unsigned int count();
|
||||
virtual void addObject(Object * obj);
|
||||
virtual void removeObjectAtIndex(unsigned int idx);
|
||||
virtual void removeObject(Object * obj);
|
||||
virtual int indexOfObject(Object * obj);
|
||||
virtual Object * objectAtIndex(unsigned int idx);
|
||||
virtual void replaceObject(unsigned int idx, Object * obj);
|
||||
virtual void insertObject(unsigned int idx, Object * obj);
|
||||
virtual void removeAllObjects();
|
||||
|
||||
virtual void addObjectsFromArray(Array * array);
|
||||
virtual Object * lastObject();
|
||||
virtual void removeLastObject();
|
||||
virtual bool containsObject(Object * obj);
|
||||
|
||||
virtual Array * sortedArray(int (* compare)(void * a, void * b, void * context), void * context);
|
||||
virtual void sortArray(int (* compare)(void * a, void * b, void * context), void * context);
|
||||
virtual String * componentsJoinedByString(String * delimiter);
|
||||
|
||||
public: // subclass behavior
|
||||
Array(Array * o);
|
||||
virtual String * description();
|
||||
virtual Object * copy();
|
||||
virtual HashMap * serializable();
|
||||
virtual void importSerializable(HashMap * serializable);
|
||||
|
||||
private:
|
||||
carray * mArray;
|
||||
void init();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
15
MailCore.framework/Versions/A/Headers/MCAssert.h
Normal file
15
MailCore.framework/Versions/A/Headers/MCAssert.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef MAILCORE_MCASSERT_H
|
||||
|
||||
#define MAILCORE_MCASSERT_H
|
||||
|
||||
#define MCAssert(cond) MCAssertInternal(__FILE__, __LINE__, cond, #cond)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void MCAssertInternal(const char * filename, unsigned int line, int cond, const char * condString);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
18
MailCore.framework/Versions/A/Headers/MCAsync.h
Normal file
18
MailCore.framework/Versions/A/Headers/MCAsync.h
Normal file
@ -0,0 +1,18 @@
|
||||
//
|
||||
// MCAsync.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/11/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCASYNC_H
|
||||
|
||||
#define MAILCORE_MCASYNC_H
|
||||
|
||||
#include <MailCore/MCAsyncSMTP.h>
|
||||
#include <MailCore/MCAsyncIMAP.h>
|
||||
#include <MailCore/MCAsyncPOP.h>
|
||||
#include <MailCore/MCAsyncNNTP.h>
|
||||
|
||||
#endif
|
35
MailCore.framework/Versions/A/Headers/MCAsyncIMAP.h
Executable file
35
MailCore.framework/Versions/A/Headers/MCAsyncIMAP.h
Executable file
@ -0,0 +1,35 @@
|
||||
//
|
||||
// MCAsyncIMAP.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/12/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCASYNCIMAP_H
|
||||
|
||||
#define MAILCORE_MCASYNCIMAP_H
|
||||
|
||||
#include <MailCore/MCIMAPAsyncSession.h>
|
||||
#include <MailCore/MCIMAPOperation.h>
|
||||
#include <MailCore/MCIMAPFetchFoldersOperation.h>
|
||||
#include <MailCore/MCIMAPAppendMessageOperation.h>
|
||||
#include <MailCore/MCIMAPCopyMessagesOperation.h>
|
||||
#include <MailCore/MCIMAPFetchMessagesOperation.h>
|
||||
#include <MailCore/MCIMAPFetchContentOperation.h>
|
||||
#include <MailCore/MCIMAPIdleOperation.h>
|
||||
#include <MailCore/MCIMAPFolderInfoOperation.h>
|
||||
#include <MailCore/MCIMAPFolderStatusOperation.h>
|
||||
#include <MailCore/MCIMAPSession.h>
|
||||
#include <MailCore/MCIMAPNamespace.h>
|
||||
#include <MailCore/MCIMAPIdentity.h>
|
||||
#include <MailCore/MCIMAPSearchOperation.h>
|
||||
#include <MailCore/MCIMAPSearchExpression.h>
|
||||
#include <MailCore/MCIMAPFetchNamespaceOperation.h>
|
||||
#include <MailCore/MCIMAPIdentityOperation.h>
|
||||
#include <MailCore/MCIMAPCapabilityOperation.h>
|
||||
#include <MailCore/MCIMAPQuotaOperation.h>
|
||||
#include <MailCore/MCIMAPOperationCallback.h>
|
||||
#include <MailCore/MCIMAPMessageRenderingOperation.h>
|
||||
|
||||
#endif
|
21
MailCore.framework/Versions/A/Headers/MCAsyncNNTP.h
Normal file
21
MailCore.framework/Versions/A/Headers/MCAsyncNNTP.h
Normal file
@ -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
|
20
MailCore.framework/Versions/A/Headers/MCAsyncPOP.h
Normal file
20
MailCore.framework/Versions/A/Headers/MCAsyncPOP.h
Normal file
@ -0,0 +1,20 @@
|
||||
//
|
||||
// MCAsyncPOP.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/16/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCASYNCPOP_H
|
||||
|
||||
#define MAILCORE_MCASYNCPOP_H
|
||||
|
||||
#include <MailCore/MCPOPAsyncSession.h>
|
||||
#include <MailCore/MCPOPOperation.h>
|
||||
#include <MailCore/MCPOPFetchHeaderOperation.h>
|
||||
#include <MailCore/MCPOPFetchMessageOperation.h>
|
||||
#include <MailCore/MCPOPFetchMessagesOperation.h>
|
||||
#include <MailCore/MCPOPOperationCallback.h>
|
||||
|
||||
#endif
|
17
MailCore.framework/Versions/A/Headers/MCAsyncSMTP.h
Normal file
17
MailCore.framework/Versions/A/Headers/MCAsyncSMTP.h
Normal file
@ -0,0 +1,17 @@
|
||||
//
|
||||
// MCAsyncSMTP.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/11/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCASYNCSMTP_H
|
||||
|
||||
#define MAILCORE_MCASYNCSMTP_H
|
||||
|
||||
#include <MailCore/MCSMTPAsyncSession.h>
|
||||
#include <MailCore/MCSMTPOperation.h>
|
||||
#include <MailCore/MCSMTPOperationCallback.h>
|
||||
|
||||
#endif
|
63
MailCore.framework/Versions/A/Headers/MCAttachment.h
Normal file
63
MailCore.framework/Versions/A/Headers/MCAttachment.h
Normal file
@ -0,0 +1,63 @@
|
||||
#ifndef MAILCORE_MCATTACHMENT_H
|
||||
|
||||
#define MAILCORE_MCATTACHMENT_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
#include <MailCore/MCAbstractPart.h>
|
||||
#include <MailCore/MCAbstractMultipart.h>
|
||||
#include <MailCore/MCMessageConstants.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class MessagePart;
|
||||
|
||||
class Attachment : public AbstractPart {
|
||||
public:
|
||||
static String * mimeTypeForFilename(String * filename);
|
||||
static Attachment * attachmentWithContentsOfFile(String * filename);
|
||||
static Attachment * attachmentWithData(String * filename, Data * data);
|
||||
static Attachment * attachmentWithHTMLString(String * htmlString);
|
||||
static Attachment * attachmentWithRFC822Message(Data * messageData);
|
||||
static Attachment * attachmentWithText(String * text);
|
||||
|
||||
Attachment();
|
||||
virtual ~Attachment();
|
||||
|
||||
virtual void setData(Data * data);
|
||||
virtual Data * data();
|
||||
virtual String * decodedString();
|
||||
|
||||
virtual void setContentTypeParameter(String * name, String * value);
|
||||
virtual void removeContentTypeParameter(String * name);
|
||||
virtual String * contentTypeParameterValueForName(String *name);
|
||||
virtual Array * allContentTypeParametersNames();
|
||||
|
||||
public: // subclass behavior
|
||||
Attachment(Attachment * other);
|
||||
virtual String * description();
|
||||
virtual Object * copy();
|
||||
|
||||
public: // private
|
||||
static AbstractPart * attachmentsWithMIME(struct mailmime * mime);
|
||||
|
||||
private:
|
||||
Data * mData;
|
||||
HashMap * mContentTypeParameters;
|
||||
HashMap * mlcContentTypeParameters;
|
||||
void init();
|
||||
static void fillMultipartSubAttachments(AbstractMultipart * multipart, struct mailmime * mime);
|
||||
static AbstractPart * attachmentsWithMIMEWithMain(struct mailmime * mime, bool isMain);
|
||||
static Attachment * attachmentWithSingleMIME(struct mailmime * mime);
|
||||
static MessagePart * attachmentWithMessageMIME(struct mailmime * mime);
|
||||
static Encoding encodingForMIMEEncoding(struct mailmime_mechanism * mechanism, int defaultMimeEncoding);
|
||||
static HashMap * readMimeTypesFile(String * filename);
|
||||
void setContentTypeParameters(HashMap * parameters);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
44
MailCore.framework/Versions/A/Headers/MCAutoreleasePool.h
Normal file
44
MailCore.framework/Versions/A/Headers/MCAutoreleasePool.h
Normal file
@ -0,0 +1,44 @@
|
||||
#ifndef MAILCORE_MCAUTORELEASEPOOL_H
|
||||
|
||||
#define MAILCORE_MCAUTORELEASEPOOL_H
|
||||
|
||||
#include <MailCore/MCObject.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
typedef struct carray_s carray;
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class AutoreleasePool : public Object {
|
||||
public:
|
||||
AutoreleasePool();
|
||||
virtual ~AutoreleasePool();
|
||||
|
||||
static void autorelease(Object * obj);
|
||||
|
||||
public: // subclass behavior
|
||||
virtual String * description();
|
||||
|
||||
private:
|
||||
static void init();
|
||||
static pthread_key_t autoreleasePoolStackKey;
|
||||
carray * mPoolObjects;
|
||||
static carray * createAutoreleasePoolStackIfNeeded();
|
||||
static void destroyAutoreleasePoolStack(void *);
|
||||
static void initAutoreleasePoolStackKey();
|
||||
static AutoreleasePool * currentAutoreleasePool();
|
||||
virtual void add(Object * obj);
|
||||
#ifdef __APPLE__
|
||||
void * mAppleAutoreleasePool;
|
||||
static void * createAppleAutoreleasePool();
|
||||
static void releaseAppleAutoreleasePool(void * appleAutoreleasePool);
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
30
MailCore.framework/Versions/A/Headers/MCBaseTypes.h
Normal file
30
MailCore.framework/Versions/A/Headers/MCBaseTypes.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef MAILCORE_MCBASETYPES_H
|
||||
|
||||
#define MAILCORE_MCBASETYPES_H
|
||||
|
||||
#include <MailCore/MCAutoreleasePool.h>
|
||||
#include <MailCore/MCObject.h>
|
||||
#include <MailCore/MCValue.h>
|
||||
#include <MailCore/MCString.h>
|
||||
#include <MailCore/MCData.h>
|
||||
#include <MailCore/MCArray.h>
|
||||
#include <MailCore/MCHashMap.h>
|
||||
#include <MailCore/MCJSON.h>
|
||||
#include <MailCore/MCMD5.h>
|
||||
#include <MailCore/MCNull.h>
|
||||
#include <MailCore/MCSet.h>
|
||||
#include <MailCore/MCHash.h>
|
||||
#include <MailCore/MCLog.h>
|
||||
#include <MailCore/MCAssert.h>
|
||||
#include <MailCore/MCUtils.h>
|
||||
#include <MailCore/MCRange.h>
|
||||
#include <MailCore/MCIndexSet.h>
|
||||
#include <MailCore/MCOperation.h>
|
||||
#include <MailCore/MCOperationQueue.h>
|
||||
#include <MailCore/MCOperationCallback.h>
|
||||
#include <MailCore/MCLibetpanTypes.h>
|
||||
#include <MailCore/MCICUTypes.h>
|
||||
#include <MailCore/MCIterator.h>
|
||||
#include <MailCore/MCConnectionLogger.h>
|
||||
|
||||
#endif
|
45
MailCore.framework/Versions/A/Headers/MCConnectionLogger.h
Normal file
45
MailCore.framework/Versions/A/Headers/MCConnectionLogger.h
Normal file
@ -0,0 +1,45 @@
|
||||
//
|
||||
// MCConnectionLogger.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 6/24/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_CONNECTION_LOGGER_H
|
||||
|
||||
#define MAILCORE_CONNECTION_LOGGER_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class Data;
|
||||
|
||||
enum ConnectionLogType {
|
||||
// Received data
|
||||
ConnectionLogTypeReceived,
|
||||
// Sent data
|
||||
ConnectionLogTypeSent,
|
||||
// Sent private data
|
||||
ConnectionLogTypeSentPrivate,
|
||||
// Parse error
|
||||
ConnectionLogTypeErrorParse,
|
||||
// Error while receiving data - log() is called with a NULL buffer.
|
||||
ConnectionLogTypeErrorReceived,
|
||||
// Error while sending data - log() is called with a NULL buffer.
|
||||
ConnectionLogTypeErrorSent,
|
||||
};
|
||||
|
||||
class ConnectionLogger {
|
||||
public:
|
||||
virtual void log(void * sender, ConnectionLogType logType, Data * buffer) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
23
MailCore.framework/Versions/A/Headers/MCCore.h
Normal file
23
MailCore.framework/Versions/A/Headers/MCCore.h
Normal file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// Core.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/10/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCCORE_H
|
||||
|
||||
#define MAILCORE_MCCORE_H
|
||||
|
||||
#include <MailCore/MCAbstract.h>
|
||||
#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>
|
||||
#include <MailCore/MCProvider.h>
|
||||
|
||||
#endif
|
68
MailCore.framework/Versions/A/Headers/MCData.h
Normal file
68
MailCore.framework/Versions/A/Headers/MCData.h
Normal file
@ -0,0 +1,68 @@
|
||||
#ifndef MAILCORE_MCDATA_H
|
||||
|
||||
#define MAILCORE_MCDATA_H
|
||||
|
||||
#include <MailCore/MCObject.h>
|
||||
#include <MailCore/MCMessageConstants.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class String;
|
||||
|
||||
class Data : public Object {
|
||||
public:
|
||||
Data();
|
||||
Data(int capacity);
|
||||
Data(const char * bytes, unsigned int length);
|
||||
virtual ~Data();
|
||||
|
||||
static Data * data();
|
||||
static Data * dataWithCapacity(int capacity);
|
||||
static Data * dataWithContentsOfFile(String * filename);
|
||||
static Data * dataWithBytes(const char * bytes, unsigned int length);
|
||||
|
||||
virtual char * bytes();
|
||||
virtual unsigned int length();
|
||||
|
||||
virtual void appendData(Data * otherData);
|
||||
virtual void appendBytes(const char * bytes, unsigned int length);
|
||||
virtual void setBytes(const char * bytes, unsigned int length);
|
||||
virtual void setData(Data * otherData);
|
||||
|
||||
// Helpers
|
||||
virtual String * stringWithDetectedCharset();
|
||||
virtual String * stringWithDetectedCharset(String * charset, bool isHTML);
|
||||
virtual String * stringWithCharset(const char * charset);
|
||||
virtual Data * decodedDataUsingEncoding(Encoding encoding);
|
||||
|
||||
virtual String * base64String();
|
||||
|
||||
public: // private
|
||||
virtual String * charsetWithFilteredHTML(bool filterHTML, String * hintCharset = NULL);
|
||||
|
||||
public: // subclass behavior
|
||||
Data(Data * otherData);
|
||||
virtual String * description();
|
||||
virtual Object * copy();
|
||||
virtual bool isEqual(Object * otherObject);
|
||||
virtual unsigned int hash();
|
||||
virtual HashMap * serializable();
|
||||
virtual void importSerializable(HashMap * serializable);
|
||||
|
||||
private:
|
||||
char * mBytes;
|
||||
unsigned int mLength;
|
||||
unsigned int mAllocated;
|
||||
void allocate(unsigned int length);
|
||||
void reset();
|
||||
String * charsetWithFilteredHTMLWithoutHint(bool filterHTML);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
75
MailCore.framework/Versions/A/Headers/MCDateFormatter.h
Normal file
75
MailCore.framework/Versions/A/Headers/MCDateFormatter.h
Normal file
@ -0,0 +1,75 @@
|
||||
//
|
||||
// MCDateFormatter.h
|
||||
// testUI
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/28/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCDATEFORMATTER_H
|
||||
|
||||
#define MAILCORE_MCDATEFORMATTER_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
|
||||
// predeclare UDateFormat
|
||||
// copied from <unicode/udat.h>
|
||||
typedef void * UDateFormat;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class String;
|
||||
|
||||
// Uses same values as UDateFormatStyle
|
||||
enum DateFormatStyle {
|
||||
DateFormatStyleFull = 0 /* UDAT_FULL*/,
|
||||
DateFormatStyleLong = 1 /* UDAT_LONG */,
|
||||
DateFormatStyleMedium = 2 /* UDAT_MEDIUM */,
|
||||
DateFormatStyleShort = 3 /* UDAT_SHORT */,
|
||||
DateFormatStyleNone = -1 /* UDAT_NONE */,
|
||||
};
|
||||
|
||||
class DateFormatter : public Object {
|
||||
public:
|
||||
DateFormatter();
|
||||
virtual ~DateFormatter();
|
||||
|
||||
static DateFormatter * dateFormatter();
|
||||
|
||||
virtual void setDateStyle(DateFormatStyle style);
|
||||
virtual DateFormatStyle dateStyle();
|
||||
|
||||
virtual void setTimeStyle(DateFormatStyle style);
|
||||
virtual DateFormatStyle timeStyle();
|
||||
|
||||
virtual void setLocale(String * locale);
|
||||
virtual String * locale();
|
||||
|
||||
virtual void setTimezone(String * timezone);
|
||||
virtual String * timezone();
|
||||
|
||||
virtual void setDateFormat(String * dateFormat);
|
||||
virtual String * dateFormat();
|
||||
|
||||
virtual String * stringFromDate(time_t date);
|
||||
virtual time_t dateFromString(String * dateString);
|
||||
|
||||
private:
|
||||
UDateFormat * mDateFormatter;
|
||||
DateFormatStyle mDateStyle;
|
||||
DateFormatStyle mTimeStyle;
|
||||
String * mDateFormat;
|
||||
String * mTimezone;
|
||||
String * mLocale;
|
||||
void * mAppleDateFormatter;
|
||||
|
||||
void prepare();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* defined(__testUI__MCDateFormatter__) */
|
@ -0,0 +1,61 @@
|
||||
//
|
||||
// MCHTMLRendererCallback.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 2/2/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCHTMLRENDERERCALLBACK_H
|
||||
|
||||
#define MAILCORE_MCHTMLRENDERERCALLBACK_H
|
||||
|
||||
#include <MailCore/MCAbstract.h>
|
||||
#include <MailCore/MCIMAP.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class MessageParser;
|
||||
|
||||
class HTMLRendererIMAPCallback {
|
||||
public:
|
||||
HTMLRendererIMAPCallback() {}
|
||||
virtual ~HTMLRendererIMAPCallback() {}
|
||||
|
||||
virtual Data * dataForIMAPPart(String * folder, IMAPPart * part) { return NULL; }
|
||||
virtual void prefetchAttachmentIMAPPart(String * folder, IMAPPart * part) {}
|
||||
virtual void prefetchImageIMAPPart(String * folder, IMAPPart * part) {}
|
||||
};
|
||||
|
||||
class HTMLRendererTemplateCallback {
|
||||
public:
|
||||
virtual bool canPreviewPart(AbstractPart * part);
|
||||
virtual bool shouldShowPart(AbstractPart * part);
|
||||
|
||||
virtual HashMap * templateValuesForHeader(MessageHeader * header);
|
||||
virtual HashMap * templateValuesForPart(AbstractPart * part);
|
||||
|
||||
virtual String * templateForMainHeader(MessageHeader * header);
|
||||
virtual String * templateForImage(AbstractPart * part);
|
||||
virtual String * templateForAttachment(AbstractPart * part);
|
||||
virtual String * templateForMessage(AbstractMessage * message);
|
||||
virtual String * templateForEmbeddedMessage(AbstractMessagePart * part);
|
||||
virtual String * templateForEmbeddedMessageHeader(MessageHeader * header);
|
||||
virtual String * templateForAttachmentSeparator();
|
||||
|
||||
virtual String * cleanHTMLForPart(String * html);
|
||||
|
||||
// Can be used to filter some HTML tags.
|
||||
virtual String * filterHTMLForPart(String * html);
|
||||
|
||||
// Can be used to hide quoted text.
|
||||
virtual String * filterHTMLForMessage(String * html);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
15
MailCore.framework/Versions/A/Headers/MCHash.h
Normal file
15
MailCore.framework/Versions/A/Headers/MCHash.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef MAILCORE_MCHASH_H
|
||||
|
||||
#define MAILCORE_MCHASH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
unsigned int hashCompute(const char * key, unsigned int len);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
52
MailCore.framework/Versions/A/Headers/MCHashMap.h
Normal file
52
MailCore.framework/Versions/A/Headers/MCHashMap.h
Normal file
@ -0,0 +1,52 @@
|
||||
#ifndef MAILCORE_MCHASHMAP_H
|
||||
|
||||
#define MAILCORE_MCHASHMAP_H
|
||||
|
||||
#include <MailCore/MCObject.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class String;
|
||||
class Array;
|
||||
struct HashMapCell;
|
||||
typedef HashMapCell HashMapIter;
|
||||
|
||||
class HashMap : public Object {
|
||||
public:
|
||||
HashMap();
|
||||
virtual ~HashMap();
|
||||
|
||||
static HashMap * hashMap();
|
||||
|
||||
virtual unsigned int count();
|
||||
virtual void setObjectForKey(Object * key, Object * value);
|
||||
virtual void removeObjectForKey(Object * key);
|
||||
virtual Object * objectForKey(Object * key);
|
||||
virtual Array * allKeys();
|
||||
virtual Array * allValues();
|
||||
virtual void removeAllObjects();
|
||||
|
||||
public: // subclass behavior
|
||||
HashMap(HashMap * o);
|
||||
virtual String * description();
|
||||
virtual Object * copy();
|
||||
virtual HashMap * serializable();
|
||||
virtual void importSerializable(HashMap * serializable);
|
||||
|
||||
private:
|
||||
unsigned int mAllocated;
|
||||
unsigned int mCount;
|
||||
void ** mCells;
|
||||
HashMapIter * iteratorBegin();
|
||||
HashMapIter * iteratorNext(HashMapIter * iter);
|
||||
void allocate(unsigned int size);
|
||||
void init();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
19
MailCore.framework/Versions/A/Headers/MCICUTypes.h
Normal file
19
MailCore.framework/Versions/A/Headers/MCICUTypes.h
Normal file
@ -0,0 +1,19 @@
|
||||
//
|
||||
// MCICUTypes.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 4/18/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCICUTYPES_H
|
||||
|
||||
#define MAILCORE_MCICUTYPES_H
|
||||
|
||||
#if defined(__CHAR16_TYPE__)
|
||||
typedef __CHAR16_TYPE__ UChar;
|
||||
#else
|
||||
typedef uint16_t UChar;
|
||||
#endif
|
||||
|
||||
#endif
|
19
MailCore.framework/Versions/A/Headers/MCIMAP.h
Normal file
19
MailCore.framework/Versions/A/Headers/MCIMAP.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef MAILCORE_MCIMAP_H
|
||||
|
||||
#define MAILCORE_MCIMAP_H
|
||||
|
||||
#include <MailCore/MCIMAPFolder.h>
|
||||
#include <MailCore/MCIMAPMessage.h>
|
||||
#include <MailCore/MCIMAPMessagePart.h>
|
||||
#include <MailCore/MCIMAPMultipart.h>
|
||||
#include <MailCore/MCIMAPNamespace.h>
|
||||
#include <MailCore/MCIMAPNamespaceItem.h>
|
||||
#include <MailCore/MCIMAPPart.h>
|
||||
#include <MailCore/MCIMAPProgressCallback.h>
|
||||
#include <MailCore/MCIMAPSearchExpression.h>
|
||||
#include <MailCore/MCIMAPSession.h>
|
||||
#include <MailCore/MCIMAPSyncResult.h>
|
||||
#include <MailCore/MCIMAPFolderStatus.h>
|
||||
#include <MailCore/MCIMAPIdentity.h>
|
||||
|
||||
#endif
|
@ -0,0 +1,55 @@
|
||||
//
|
||||
// MCIMAPAppendMessageOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/12/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPAPPENDMESSAGEOPERATION_H
|
||||
|
||||
#define MAILCORE_MCIMAPAPPENDMESSAGEOPERATION_H
|
||||
|
||||
#include <MailCore/MCIMAPOperation.h>
|
||||
#include <MailCore/MCMessageConstants.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPAppendMessageOperation : public IMAPOperation {
|
||||
public:
|
||||
IMAPAppendMessageOperation();
|
||||
virtual ~IMAPAppendMessageOperation();
|
||||
|
||||
virtual void setMessageData(Data * messageData);
|
||||
virtual Data * messageData();
|
||||
|
||||
virtual void setFlags(MessageFlag flags);
|
||||
virtual MessageFlag flags();
|
||||
|
||||
virtual void setCustomFlags(Array * customFlags);
|
||||
virtual Array * customFlags();
|
||||
|
||||
virtual void setDate(time_t date);
|
||||
virtual time_t date();
|
||||
|
||||
virtual uint32_t createdUID();
|
||||
|
||||
public: // subclass behavior
|
||||
virtual void main();
|
||||
|
||||
private:
|
||||
Data * mMessageData;
|
||||
MessageFlag mFlags;
|
||||
Array * mCustomFlags;
|
||||
time_t mDate;
|
||||
uint32_t mCreatedUID;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
206
MailCore.framework/Versions/A/Headers/MCIMAPAsyncSession.h
Executable file
206
MailCore.framework/Versions/A/Headers/MCIMAPAsyncSession.h
Executable file
@ -0,0 +1,206 @@
|
||||
//
|
||||
// MCIMAPAccount.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/17/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPACCOUNT_H
|
||||
|
||||
#define MAILCORE_MCIMAPACCOUNT_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
#include <MailCore/MCMessageConstants.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPOperation;
|
||||
class IMAPFetchFoldersOperation;
|
||||
class IMAPAppendMessageOperation;
|
||||
class IMAPCopyMessagesOperation;
|
||||
class IMAPFetchMessagesOperation;
|
||||
class IMAPFetchContentOperation;
|
||||
class IMAPIdleOperation;
|
||||
class IMAPFolderInfoOperation;
|
||||
class IMAPFolderStatusOperation;
|
||||
class IMAPNamespace;
|
||||
class IMAPSearchOperation;
|
||||
class IMAPSearchExpression;
|
||||
class IMAPFetchNamespaceOperation;
|
||||
class IMAPIdentityOperation;
|
||||
class IMAPAsyncConnection;
|
||||
class IMAPCapabilityOperation;
|
||||
class IMAPQuotaOperation;
|
||||
class IMAPMessageRenderingOperation;
|
||||
class IMAPMessage;
|
||||
class IMAPSession;
|
||||
class IMAPIdentity;
|
||||
class OperationQueueCallback;
|
||||
|
||||
class IMAPAsyncSession : public Object {
|
||||
public:
|
||||
IMAPAsyncSession();
|
||||
virtual ~IMAPAsyncSession();
|
||||
|
||||
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();
|
||||
|
||||
// To authenticate using OAuth2, username and oauth2token should be set.
|
||||
// auth type to use is AuthTypeOAuth2.
|
||||
virtual void setOAuth2Token(String * token);
|
||||
virtual String * OAuth2Token();
|
||||
|
||||
virtual void setAuthType(AuthType authType);
|
||||
virtual AuthType authType();
|
||||
|
||||
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 setVoIPEnabled(bool enabled);
|
||||
virtual bool isVoIPEnabled();
|
||||
|
||||
virtual void setDefaultNamespace(IMAPNamespace * ns);
|
||||
virtual IMAPNamespace * defaultNamespace();
|
||||
|
||||
virtual void setAllowsFolderConcurrentAccessEnabled(bool enabled);
|
||||
virtual bool allowsFolderConcurrentAccessEnabled();
|
||||
|
||||
virtual void setMaximumConnections(unsigned int maxConnections);
|
||||
virtual unsigned int maximumConnections();
|
||||
|
||||
virtual void setConnectionLogger(ConnectionLogger * logger);
|
||||
virtual ConnectionLogger * connectionLogger();
|
||||
|
||||
#ifdef __APPLE__
|
||||
virtual void setDispatchQueue(dispatch_queue_t dispatchQueue);
|
||||
virtual dispatch_queue_t dispatchQueue();
|
||||
#endif
|
||||
|
||||
virtual void setOperationQueueCallback(OperationQueueCallback * callback);
|
||||
virtual OperationQueueCallback * operationQueueCallback();
|
||||
virtual bool isOperationQueueRunning();
|
||||
virtual void cancelAllOperations();
|
||||
|
||||
virtual IMAPIdentity * serverIdentity();
|
||||
virtual IMAPIdentity * clientIdentity();
|
||||
virtual String * gmailUserDisplayName();
|
||||
|
||||
virtual IMAPFolderInfoOperation * folderInfoOperation(String * folder);
|
||||
virtual IMAPFolderStatusOperation * folderStatusOperation(String * folder);
|
||||
|
||||
virtual IMAPFetchFoldersOperation * fetchSubscribedFoldersOperation();
|
||||
virtual IMAPFetchFoldersOperation * fetchAllFoldersOperation();
|
||||
|
||||
virtual IMAPOperation * renameFolderOperation(String * folder, String * otherName);
|
||||
virtual IMAPOperation * deleteFolderOperation(String * folder);
|
||||
virtual IMAPOperation * createFolderOperation(String * folder);
|
||||
|
||||
virtual IMAPOperation * subscribeFolderOperation(String * folder);
|
||||
virtual IMAPOperation * unsubscribeFolderOperation(String * folder);
|
||||
|
||||
virtual IMAPAppendMessageOperation * appendMessageOperation(String * folder, Data * messageData, MessageFlag flags, Array * customFlags = NULL);
|
||||
|
||||
virtual IMAPCopyMessagesOperation * copyMessagesOperation(String * folder, IndexSet * uids, String * destFolder);
|
||||
|
||||
virtual IMAPOperation * expungeOperation(String * folder);
|
||||
|
||||
virtual IMAPFetchMessagesOperation * fetchMessagesByUIDOperation(String * folder, IMAPMessagesRequestKind requestKind,
|
||||
IndexSet * indexes);
|
||||
virtual IMAPFetchMessagesOperation * fetchMessagesByNumberOperation(String * folder, IMAPMessagesRequestKind requestKind,
|
||||
IndexSet * indexes);
|
||||
virtual IMAPFetchMessagesOperation * syncMessagesByUID(String * folder, IMAPMessagesRequestKind requestKind,
|
||||
IndexSet * indexes, uint64_t modSeq);
|
||||
|
||||
virtual IMAPFetchContentOperation * fetchMessageByUIDOperation(String * folder, uint32_t uid, bool urgent = false);
|
||||
virtual IMAPFetchContentOperation * fetchMessageAttachmentByUIDOperation(String * folder, uint32_t uid, String * partID,
|
||||
Encoding encoding, bool urgent = false);
|
||||
|
||||
virtual IMAPOperation * storeFlagsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags = NULL);
|
||||
virtual IMAPOperation * storeLabelsOperation(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, Array * labels);
|
||||
|
||||
virtual IMAPSearchOperation * searchOperation(String * folder, IMAPSearchKind kind, String * searchString);
|
||||
virtual IMAPSearchOperation * searchOperation(String * folder, IMAPSearchExpression * expression);
|
||||
|
||||
virtual IMAPIdleOperation * idleOperation(String * folder, uint32_t lastKnownUID);
|
||||
|
||||
virtual IMAPFetchNamespaceOperation * fetchNamespaceOperation();
|
||||
|
||||
virtual IMAPIdentityOperation * identityOperation(IMAPIdentity * identity);
|
||||
|
||||
virtual IMAPOperation * connectOperation();
|
||||
virtual IMAPOperation * checkAccountOperation();
|
||||
virtual IMAPOperation * disconnectOperation();
|
||||
|
||||
virtual IMAPCapabilityOperation * capabilityOperation();
|
||||
virtual IMAPQuotaOperation * quotaOperation();
|
||||
|
||||
virtual IMAPOperation * noopOperation();
|
||||
|
||||
virtual IMAPMessageRenderingOperation * htmlRenderingOperation(IMAPMessage * message, String * folder);
|
||||
virtual IMAPMessageRenderingOperation * htmlBodyRenderingOperation(IMAPMessage * message, String * folder);
|
||||
virtual IMAPMessageRenderingOperation * plainTextRenderingOperation(IMAPMessage * message, String * folder);
|
||||
virtual IMAPMessageRenderingOperation * plainTextBodyRenderingOperation(IMAPMessage * message, String * folder, bool stripWhitespace);
|
||||
|
||||
public: // private
|
||||
virtual void automaticConfigurationDone(IMAPSession * session);
|
||||
virtual void operationRunningStateChanged();
|
||||
virtual IMAPAsyncConnection * sessionForFolder(String * folder, bool urgent = false);
|
||||
|
||||
private:
|
||||
Array * mSessions;
|
||||
|
||||
String * mHostname;
|
||||
unsigned int mPort;
|
||||
String * mUsername;
|
||||
String * mPassword;
|
||||
String * mOAuth2Token;
|
||||
AuthType mAuthType;
|
||||
ConnectionType mConnectionType;
|
||||
bool mCheckCertificateEnabled;
|
||||
bool mVoIPEnabled;
|
||||
IMAPNamespace * mDefaultNamespace;
|
||||
time_t mTimeout;
|
||||
bool mAllowsFolderConcurrentAccessEnabled;
|
||||
unsigned int mMaximumConnections;
|
||||
ConnectionLogger * mConnectionLogger;
|
||||
bool mAutomaticConfigurationDone;
|
||||
IMAPIdentity * mServerIdentity;
|
||||
IMAPIdentity * mClientIdentity;
|
||||
bool mQueueRunning;
|
||||
OperationQueueCallback * mOperationQueueCallback;
|
||||
#if __APPLE__
|
||||
dispatch_queue_t mDispatchQueue;
|
||||
#endif
|
||||
String * mGmailUserDisplayName;
|
||||
|
||||
virtual IMAPAsyncConnection * session();
|
||||
virtual IMAPAsyncConnection * matchingSessionForFolder(String * folder);
|
||||
virtual IMAPAsyncConnection * availableSession();
|
||||
virtual IMAPMessageRenderingOperation * renderingOperation(IMAPMessage * message,
|
||||
String * folder,
|
||||
IMAPMessageRenderingType type);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,38 @@
|
||||
//
|
||||
// MCIMAPCapabilityOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 3/4/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPCAPABILITYOPERATION_H
|
||||
|
||||
#define MAILCORE_MCIMAPCAPABILITYOPERATION_H
|
||||
|
||||
#include <MailCore/MCIMAPOperation.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPCapabilityOperation : public IMAPOperation {
|
||||
public:
|
||||
IMAPCapabilityOperation();
|
||||
virtual ~IMAPCapabilityOperation();
|
||||
|
||||
// Result.
|
||||
virtual IndexSet * capabilities();
|
||||
|
||||
public: // subclass behavior
|
||||
virtual void main();
|
||||
|
||||
private:
|
||||
IndexSet * mCapabilities;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,28 @@
|
||||
//
|
||||
// MCIMAPConnectOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by Ryan Walklin on 6/09/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPCONNECTOPERATION_H
|
||||
|
||||
#define MAILCORE_MCIMAPCONNECTOPERATION_H
|
||||
|
||||
#include <MailCore/MCIMAPOperation.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPConnectOperation : public IMAPOperation {
|
||||
public: // subclass behavior
|
||||
virtual void main();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* defined(__MAILCORE_MCIMAPCONNECTOPERATION_H_) */
|
@ -0,0 +1,46 @@
|
||||
//
|
||||
// MCIMAPCopyMessagesOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/12/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPCOPYMESSAGESOPERATION_H
|
||||
|
||||
#define MAILCORE_MCIMAPCOPYMESSAGESOPERATION_H
|
||||
|
||||
#include <MailCore/MCIMAPOperation.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPCopyMessagesOperation : public IMAPOperation {
|
||||
public:
|
||||
IMAPCopyMessagesOperation();
|
||||
virtual ~IMAPCopyMessagesOperation();
|
||||
|
||||
virtual void setDestFolder(String * destFolder);
|
||||
virtual String * destFolder();
|
||||
|
||||
virtual void setUids(IndexSet * uids);
|
||||
virtual IndexSet * uids();
|
||||
|
||||
// Result.
|
||||
virtual HashMap * uidMapping();
|
||||
|
||||
public: // subclass behavior
|
||||
virtual void main();
|
||||
|
||||
private:
|
||||
IndexSet * mUids;
|
||||
String * mDestFolder;
|
||||
HashMap * mUidMapping;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,51 @@
|
||||
//
|
||||
// IMAPFetchContentOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/12/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_IMAPFETCHCONTENTOPERATION_H
|
||||
|
||||
#define MAILCORE_IMAPFETCHCONTENTOPERATION_H
|
||||
|
||||
#include <MailCore/MCIMAPOperation.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPFetchContentOperation : public IMAPOperation {
|
||||
public:
|
||||
IMAPFetchContentOperation();
|
||||
virtual ~IMAPFetchContentOperation();
|
||||
|
||||
virtual void setUid(uint32_t uid);
|
||||
virtual uint32_t uid();
|
||||
|
||||
virtual void setPartID(String * partID);
|
||||
virtual String * partID();
|
||||
|
||||
virtual void setEncoding(Encoding encoding);
|
||||
virtual Encoding encoding();
|
||||
|
||||
// Result.
|
||||
virtual Data * data();
|
||||
|
||||
public: // subclass behavior
|
||||
virtual void main();
|
||||
|
||||
private:
|
||||
uint32_t mUid;
|
||||
String * mPartID;
|
||||
Encoding mEncoding;
|
||||
Data * mData;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,44 @@
|
||||
//
|
||||
// MCIMAPFetchFoldersOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/12/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPFETCHFOLDERSOPERATION_H
|
||||
|
||||
#define MAILCORE_MCIMAPFETCHFOLDERSOPERATION_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
#include <MailCore/MCIMAPOperation.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPFetchFoldersOperation : public IMAPOperation {
|
||||
public:
|
||||
IMAPFetchFoldersOperation();
|
||||
virtual ~IMAPFetchFoldersOperation();
|
||||
|
||||
virtual void setFetchSubscribedEnabled(bool enabled);
|
||||
virtual bool isFetchSubscribedEnabled();
|
||||
|
||||
// Result.
|
||||
virtual Array * /* IMAPFolder */ folders();
|
||||
|
||||
public: // subclass behavior
|
||||
virtual void main();
|
||||
|
||||
private:
|
||||
bool mFetchSubscribedEnabled;
|
||||
Array * mFolders;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,61 @@
|
||||
//
|
||||
// IMAPFetchMessagesOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/12/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPFETCHMESSAGESOPERATION_H
|
||||
|
||||
#define MAILCORE_MCIMAPFETCHMESSAGESOPERATION_H
|
||||
|
||||
#include <MailCore/MCIMAPOperation.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPFetchMessagesOperation : public IMAPOperation {
|
||||
public:
|
||||
IMAPFetchMessagesOperation();
|
||||
virtual ~IMAPFetchMessagesOperation();
|
||||
|
||||
virtual void setFetchByUidEnabled(bool enabled);
|
||||
virtual bool isFetchByUidEnabled();
|
||||
|
||||
virtual void setIndexes(IndexSet * indexes);
|
||||
virtual IndexSet * indexes();
|
||||
|
||||
virtual void setModSequenceValue(uint64_t modseq);
|
||||
virtual uint64_t modSequenceValue();
|
||||
|
||||
virtual void setKind(IMAPMessagesRequestKind kind);
|
||||
virtual IMAPMessagesRequestKind kind();
|
||||
|
||||
virtual void setExtraHeaders(Array * extraHeaders);
|
||||
virtual Array * extraHeaders();
|
||||
|
||||
// Result.
|
||||
virtual Array * /* IMAPMessage */ messages();
|
||||
virtual IndexSet * vanishedMessages();
|
||||
|
||||
public: // subclass behavior
|
||||
virtual void main();
|
||||
|
||||
private:
|
||||
bool mFetchByUidEnabled;
|
||||
IndexSet * mIndexes;
|
||||
IMAPMessagesRequestKind mKind;
|
||||
Array * /* String */ mExtraHeaders;
|
||||
Array * /* IMAPMessage */ mMessages;
|
||||
IndexSet * mVanishedMessages;
|
||||
uint64_t mModSequenceValue;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,39 @@
|
||||
//
|
||||
// IMAPFetchNamespaceOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/12/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPFETCHNAMESPACEOPERATION_H
|
||||
|
||||
#define MAILCORE_MCIMAPFETCHNAMESPACEOPERATION_H
|
||||
|
||||
#include <MailCore/MCIMAPOperation.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPFetchNamespaceOperation : public IMAPOperation {
|
||||
public:
|
||||
IMAPFetchNamespaceOperation();
|
||||
virtual ~IMAPFetchNamespaceOperation();
|
||||
|
||||
// Result.
|
||||
virtual HashMap * namespaces();
|
||||
|
||||
public: // subclass behavior
|
||||
virtual void main();
|
||||
|
||||
private:
|
||||
HashMap * mNamespaces;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
42
MailCore.framework/Versions/A/Headers/MCIMAPFolder.h
Normal file
42
MailCore.framework/Versions/A/Headers/MCIMAPFolder.h
Normal file
@ -0,0 +1,42 @@
|
||||
#ifndef MAILCORE_MCIMAPFOLDER_H
|
||||
|
||||
#define MAILCORE_MCIMAPFOLDER_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
#include <MailCore/MCMessageConstants.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPFolder : public Object {
|
||||
public:
|
||||
IMAPFolder();
|
||||
virtual ~IMAPFolder();
|
||||
|
||||
virtual void setPath(String * path);
|
||||
virtual String * path();
|
||||
|
||||
virtual void setDelimiter(char delimiter);
|
||||
virtual char delimiter();
|
||||
|
||||
virtual void setFlags(IMAPFolderFlag flags);
|
||||
virtual IMAPFolderFlag flags();
|
||||
|
||||
public: // subclass behavior
|
||||
IMAPFolder(IMAPFolder * other);
|
||||
virtual Object * copy();
|
||||
virtual String * description();
|
||||
|
||||
private:
|
||||
String * mPath;
|
||||
char mDelimiter;
|
||||
IMAPFolderFlag mFlags;
|
||||
void init();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,49 @@
|
||||
//
|
||||
// MCIMAPFolderInfoOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/13/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPFOLDERINFOOPERATION_H
|
||||
|
||||
#define MAILCORE_MCIMAPFOLDERINFOOPERATION_H
|
||||
|
||||
#include <MailCore/MCIMAPOperation.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPFolderInfoOperation : public IMAPOperation {
|
||||
public:
|
||||
IMAPFolderInfoOperation();
|
||||
virtual ~IMAPFolderInfoOperation();
|
||||
|
||||
virtual uint32_t uidNext();
|
||||
virtual uint32_t uidValidity();
|
||||
virtual uint64_t modSequenceValue();
|
||||
virtual int messageCount();
|
||||
virtual uint32_t firstUnseenUid();
|
||||
virtual bool allowsNewPermanentFlags();
|
||||
|
||||
public: // subclass behavior
|
||||
virtual void main();
|
||||
|
||||
private:
|
||||
|
||||
uint32_t mUidNext;
|
||||
uint32_t mUidValidity;
|
||||
uint64_t mModSequenceValue;
|
||||
int mMessageCount;
|
||||
uint32_t mFirstUnseenUid;
|
||||
bool mAllowsNewPermanentFlags;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
64
MailCore.framework/Versions/A/Headers/MCIMAPFolderStatus.h
Normal file
64
MailCore.framework/Versions/A/Headers/MCIMAPFolderStatus.h
Normal file
@ -0,0 +1,64 @@
|
||||
//
|
||||
// MCIMAPFolderStatus.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by Sebastian on 6/11/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPFOLDERSTATUS_H
|
||||
|
||||
#define MAILCORE_MCIMAPFOLDERSTATUS_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
#include <MailCore/MCMessageConstants.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPFolderStatus : public Object {
|
||||
public:
|
||||
IMAPFolderStatus();
|
||||
virtual ~IMAPFolderStatus();
|
||||
|
||||
virtual void setUnseenCount(uint32_t unseen);
|
||||
virtual uint32_t unseenCount();
|
||||
|
||||
virtual void setMessageCount(uint32_t messages);
|
||||
virtual uint32_t messageCount();
|
||||
|
||||
virtual void setRecentCount(uint32_t recent);
|
||||
virtual uint32_t recentCount();
|
||||
|
||||
virtual void setUidNext(uint32_t uidNext);
|
||||
virtual uint32_t uidNext();
|
||||
|
||||
virtual void setUidValidity(uint32_t uidValidity);
|
||||
virtual uint32_t uidValidity();
|
||||
|
||||
virtual void setHighestModSeqValue(uint64_t highestModSeqValue);
|
||||
virtual uint64_t highestModSeqValue();
|
||||
|
||||
public: // subclass behavior
|
||||
IMAPFolderStatus(IMAPFolderStatus * other);
|
||||
virtual Object * copy();
|
||||
virtual String * description();
|
||||
|
||||
private:
|
||||
uint32_t mUnseenCount;
|
||||
uint32_t mMessageCount;
|
||||
uint32_t mRecentCount;
|
||||
uint32_t mUidNext;
|
||||
uint32_t mUidValidity;
|
||||
uint64_t mHighestModSeqValue;
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,41 @@
|
||||
//
|
||||
// MCIMAPFolderStatusOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by Sebastian on 6/5/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
#ifndef MAILCORE_MCIMAPFOLDERSTATUSOPERATION_H
|
||||
|
||||
#define MAILCORE_MCIMAPFOLDERSTATUSOPERATION_H
|
||||
|
||||
#include <MailCore/MCIMAPOperation.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPFolderStatus;
|
||||
|
||||
class IMAPFolderStatusOperation : public IMAPOperation {
|
||||
public:
|
||||
IMAPFolderStatusOperation();
|
||||
virtual ~IMAPFolderStatusOperation();
|
||||
|
||||
// Results.
|
||||
virtual IMAPFolderStatus * status();
|
||||
|
||||
public: // subclass behavior
|
||||
virtual void main();
|
||||
|
||||
private:
|
||||
IMAPFolderStatus * mStatus;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
54
MailCore.framework/Versions/A/Headers/MCIMAPIdentity.h
Normal file
54
MailCore.framework/Versions/A/Headers/MCIMAPIdentity.h
Normal file
@ -0,0 +1,54 @@
|
||||
//
|
||||
// MCIMAPIdentity.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by Hoa V. DINH on 8/24/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPIDENTITY_H
|
||||
|
||||
#define MAILCORE_MCIMAPIDENTITY_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPIdentity : public Object {
|
||||
public:
|
||||
|
||||
IMAPIdentity();
|
||||
virtual ~IMAPIdentity();
|
||||
|
||||
virtual void setVendor(String * vendor);
|
||||
virtual String * vendor();
|
||||
|
||||
virtual void setName(String * name);
|
||||
virtual String * name();
|
||||
|
||||
virtual void setVersion(String * version);
|
||||
virtual String * version();
|
||||
|
||||
virtual Array * allInfoKeys();
|
||||
virtual String * infoForKey(String * key);
|
||||
virtual void setInfoForKey(String * key, String * value);
|
||||
|
||||
public: // subclass behavior
|
||||
IMAPIdentity(IMAPIdentity * identity);
|
||||
virtual Object * copy();
|
||||
virtual String * description();
|
||||
|
||||
private:
|
||||
HashMap * mValues;
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,45 @@
|
||||
//
|
||||
// IMAPIdentityOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/12/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPIDENTITYOPERATION_H
|
||||
|
||||
#define MAILCORE_MCIMAPIDENTITYOPERATION_H
|
||||
|
||||
#include <MailCore/MCIMAPOperation.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPIdentity;
|
||||
|
||||
class IMAPIdentityOperation : public IMAPOperation {
|
||||
public:
|
||||
IMAPIdentityOperation();
|
||||
virtual ~IMAPIdentityOperation();
|
||||
|
||||
virtual void setClientIdentity(IMAPIdentity * identity);
|
||||
virtual IMAPIdentity * clientIdentity();
|
||||
|
||||
// Result.
|
||||
virtual IMAPIdentity * serverIdentity();
|
||||
|
||||
public: // subclass behavior
|
||||
virtual void main();
|
||||
|
||||
private:
|
||||
IMAPIdentity * mClientIdentity;
|
||||
IMAPIdentity * mServerIdentity;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
46
MailCore.framework/Versions/A/Headers/MCIMAPIdleOperation.h
Normal file
46
MailCore.framework/Versions/A/Headers/MCIMAPIdleOperation.h
Normal file
@ -0,0 +1,46 @@
|
||||
//
|
||||
// IMAPIdleOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/12/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPIDLEOPERATION_H
|
||||
|
||||
#define MAILCORE_MCIMAPIDLEOPERATION_H
|
||||
|
||||
#include <MailCore/MCIMAPOperation.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPIdleOperation : public IMAPOperation {
|
||||
public:
|
||||
IMAPIdleOperation();
|
||||
virtual ~IMAPIdleOperation();
|
||||
|
||||
virtual void setLastKnownUID(uint32_t uid);
|
||||
virtual uint32_t lastKnownUID();
|
||||
|
||||
virtual void interruptIdle();
|
||||
|
||||
public: // subclass behavior
|
||||
virtual void main();
|
||||
|
||||
private:
|
||||
uint32_t mLastKnownUid;
|
||||
bool mSetupSuccess;
|
||||
bool mInterrupted;
|
||||
pthread_mutex_t mLock;
|
||||
void prepare();
|
||||
void unprepare();
|
||||
bool isInterrupted();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
88
MailCore.framework/Versions/A/Headers/MCIMAPMessage.h
Normal file
88
MailCore.framework/Versions/A/Headers/MCIMAPMessage.h
Normal file
@ -0,0 +1,88 @@
|
||||
#ifndef MAILCORE_IMAP_MESSAGE_H
|
||||
|
||||
#define MAILCORE_IMAP_MESSAGE_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
#include <MailCore/MCAbstractMessage.h>
|
||||
#include <MailCore/MCMessageConstants.h>
|
||||
#include <MailCore/MCAbstractPart.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPPart;
|
||||
class HTMLRendererIMAPCallback;
|
||||
class HTMLRendererTemplateCallback;
|
||||
|
||||
class IMAPMessage : public AbstractMessage {
|
||||
public:
|
||||
IMAPMessage();
|
||||
virtual ~IMAPMessage();
|
||||
|
||||
virtual uint32_t uid();
|
||||
virtual void setUid(uint32_t uid);
|
||||
|
||||
virtual uint32_t size();
|
||||
virtual void setSize(uint32_t size);
|
||||
|
||||
virtual void setFlags(MessageFlag flags);
|
||||
virtual MessageFlag flags();
|
||||
|
||||
virtual void setOriginalFlags(MessageFlag flags);
|
||||
virtual MessageFlag originalFlags();
|
||||
|
||||
virtual void setCustomFlags(Array * customFlags);
|
||||
virtual Array * customFlags();
|
||||
|
||||
virtual uint64_t modSeqValue();
|
||||
virtual void setModSeqValue(uint64_t uid);
|
||||
|
||||
virtual void setMainPart(AbstractPart * mainPart);
|
||||
virtual AbstractPart * mainPart();
|
||||
|
||||
virtual void setGmailLabels(Array * /* String */ labels);
|
||||
virtual Array * /* String */ gmailLabels();
|
||||
|
||||
virtual void setGmailMessageID(uint64_t msgID);
|
||||
virtual uint64_t gmailMessageID();
|
||||
|
||||
virtual void setGmailThreadID(uint64_t threadID);
|
||||
virtual uint64_t gmailThreadID();
|
||||
|
||||
virtual AbstractPart * partForPartID(String * partID);
|
||||
|
||||
virtual AbstractPart * partForContentID(String * contentID);
|
||||
virtual AbstractPart * partForUniqueID(String * uniqueID);
|
||||
|
||||
virtual String * htmlRendering(String * folder,
|
||||
HTMLRendererIMAPCallback * dataCallback,
|
||||
HTMLRendererTemplateCallback * htmlCallback = NULL);
|
||||
|
||||
public: // subclass behavior
|
||||
IMAPMessage(IMAPMessage * other);
|
||||
virtual Object * copy();
|
||||
virtual String * description();
|
||||
virtual HashMap * serializable();
|
||||
virtual void importSerializable(HashMap * serializable);
|
||||
|
||||
private:
|
||||
uint64_t mModSeqValue;
|
||||
uint32_t mUid;
|
||||
uint32_t mSize;
|
||||
|
||||
MessageFlag mFlags;
|
||||
MessageFlag mOriginalFlags;
|
||||
Array * /* String */ mCustomFlags;
|
||||
AbstractPart * mMainPart;
|
||||
Array * /* String */ mGmailLabels;
|
||||
uint64_t mGmailMessageID;
|
||||
uint64_t mGmailThreadID;
|
||||
void init();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
34
MailCore.framework/Versions/A/Headers/MCIMAPMessagePart.h
Normal file
34
MailCore.framework/Versions/A/Headers/MCIMAPMessagePart.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef MAILCORE_IMAPMESSAGEPART_H
|
||||
|
||||
#define MAILCORE_IMAPMESSAGEPART_H
|
||||
|
||||
#include <MailCore/MCAbstractMessagePart.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPMessagePart : public AbstractMessagePart {
|
||||
public:
|
||||
IMAPMessagePart();
|
||||
virtual ~IMAPMessagePart();
|
||||
|
||||
virtual void setPartID(String * partID);
|
||||
virtual String * partID();
|
||||
|
||||
public: // subclass behavior
|
||||
IMAPMessagePart(IMAPMessagePart * other);
|
||||
virtual Object * copy();
|
||||
virtual HashMap * serializable();
|
||||
virtual void importSerializable(HashMap * serializable);
|
||||
|
||||
private:
|
||||
String * mPartID;
|
||||
void init();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,48 @@
|
||||
//
|
||||
// MCIMAPMessageRenderingOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by Paul Young on 27/06/2013.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPMessageRenderingOperation_H
|
||||
|
||||
#define MAILCORE_MCIMAPMessageRenderingOperation_H
|
||||
|
||||
#include <MailCore/MCIMAPOperation.h>
|
||||
#include <MailCore/MCIMAPMessage.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPMessageRenderingOperation : public IMAPOperation {
|
||||
public:
|
||||
IMAPMessageRenderingOperation();
|
||||
virtual ~IMAPMessageRenderingOperation();
|
||||
|
||||
virtual void setRenderingType(IMAPMessageRenderingType type);
|
||||
virtual IMAPMessageRenderingType renderingType();
|
||||
|
||||
virtual void setMessage(IMAPMessage * message);
|
||||
virtual IMAPMessage * message();
|
||||
|
||||
// Result.
|
||||
virtual String * result();
|
||||
|
||||
public: // subclass behavior
|
||||
virtual void main();
|
||||
|
||||
private:
|
||||
IMAPMessageRenderingType mRenderingType;
|
||||
String * mResult;
|
||||
IMAPMessage * mMessage;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
34
MailCore.framework/Versions/A/Headers/MCIMAPMultipart.h
Normal file
34
MailCore.framework/Versions/A/Headers/MCIMAPMultipart.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef MAILCORE_MCIMAPMULTIPART_H
|
||||
|
||||
#define MAILCORE_MCIMAPMULTIPART_H
|
||||
|
||||
#include <MailCore/MCAbstractMultipart.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPMultipart : public AbstractMultipart {
|
||||
public:
|
||||
IMAPMultipart();
|
||||
virtual ~IMAPMultipart();
|
||||
|
||||
virtual void setPartID(String * partID);
|
||||
virtual String * partID();
|
||||
|
||||
public: // subclass behavior
|
||||
IMAPMultipart(IMAPMultipart * other);
|
||||
virtual Object * copy();
|
||||
virtual HashMap * serializable();
|
||||
virtual void importSerializable(HashMap * serializable);
|
||||
|
||||
private:
|
||||
String * mPartID;
|
||||
void init();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
51
MailCore.framework/Versions/A/Headers/MCIMAPNamespace.h
Normal file
51
MailCore.framework/Versions/A/Headers/MCIMAPNamespace.h
Normal file
@ -0,0 +1,51 @@
|
||||
#ifndef MAILCORE_MCIMAPNAMESPACE_H
|
||||
|
||||
#define MAILCORE_MCIMAPNAMESPACE_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPNamespaceItem;
|
||||
|
||||
class IMAPNamespace : public Object {
|
||||
public:
|
||||
IMAPNamespace();
|
||||
virtual ~IMAPNamespace();
|
||||
|
||||
virtual String * mainPrefix();
|
||||
virtual char mainDelimiter();
|
||||
|
||||
virtual Array * /* String */ prefixes();
|
||||
|
||||
virtual String * pathForComponents(Array * components);
|
||||
virtual String * pathForComponentsAndPrefix(Array * components, String * prefix);
|
||||
|
||||
virtual Array * /* String */ componentsFromPath(String * path);
|
||||
|
||||
virtual bool containsFolderPath(String * path);
|
||||
|
||||
static IMAPNamespace * namespaceWithPrefix(String * prefix, char delimiter);
|
||||
|
||||
public: // subclass behavior
|
||||
IMAPNamespace(IMAPNamespace * other);
|
||||
virtual String * description();
|
||||
virtual Object * copy();
|
||||
|
||||
private:
|
||||
Array * /* String */ mItems;
|
||||
void init();
|
||||
IMAPNamespaceItem * mainItem();
|
||||
IMAPNamespaceItem * itemForPath(String * path);
|
||||
|
||||
public: // private
|
||||
virtual void importIMAPNamespace(struct mailimap_namespace_item * item);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
46
MailCore.framework/Versions/A/Headers/MCIMAPNamespaceItem.h
Normal file
46
MailCore.framework/Versions/A/Headers/MCIMAPNamespaceItem.h
Normal file
@ -0,0 +1,46 @@
|
||||
#ifndef MAILCORE_MCIMAPNAMESPACEITEM_H
|
||||
|
||||
#define MAILCORE_MCIMAPNAMESPACEITEM_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPNamespaceItem : public Object {
|
||||
public:
|
||||
IMAPNamespaceItem();
|
||||
virtual ~IMAPNamespaceItem();
|
||||
|
||||
virtual void setPrefix(String * prefix);
|
||||
virtual String * prefix();
|
||||
|
||||
virtual void setDelimiter(char delimiter);
|
||||
virtual char delimiter();
|
||||
|
||||
virtual String * pathForComponents(Array * components);
|
||||
virtual Array * /* String */ componentsForPath(String * path);
|
||||
|
||||
virtual bool containsFolder(String * folder);
|
||||
|
||||
public: // subclass behavior
|
||||
IMAPNamespaceItem(IMAPNamespaceItem * other);
|
||||
virtual String * description();
|
||||
virtual Object * copy();
|
||||
|
||||
private:
|
||||
char mDelimiter;
|
||||
String * mPrefix;
|
||||
void init();
|
||||
|
||||
public: // private
|
||||
virtual void importIMAPNamespaceInfo(struct mailimap_namespace_info * info);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
32
MailCore.framework/Versions/A/Headers/MCIMAPNoopOperation.h
Normal file
32
MailCore.framework/Versions/A/Headers/MCIMAPNoopOperation.h
Normal file
@ -0,0 +1,32 @@
|
||||
//
|
||||
// MCIMAPNoopOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by Robert Widmann on 9/24/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPNOOPOPERATION_H
|
||||
|
||||
#define MAILCORE_MCIMAPNOOPOPERATION_H
|
||||
|
||||
#include <MailCore/MCIMAPOperation.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPNoopOperation : public IMAPOperation {
|
||||
public:
|
||||
IMAPNoopOperation();
|
||||
virtual ~IMAPNoopOperation();
|
||||
|
||||
public: // subclass behavior
|
||||
virtual void main();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
73
MailCore.framework/Versions/A/Headers/MCIMAPOperation.h
Normal file
73
MailCore.framework/Versions/A/Headers/MCIMAPOperation.h
Normal file
@ -0,0 +1,73 @@
|
||||
//
|
||||
// MCIMAPOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/12/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPOPERATION_H
|
||||
|
||||
#define MAILCORE_MCIMAPOPERATION_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
#include <MailCore/MCIMAPProgressCallback.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPAsyncConnection;
|
||||
class IMAPAsyncSession;
|
||||
class IMAPOperationCallback;
|
||||
|
||||
class IMAPOperation : public Operation, public IMAPProgressCallback {
|
||||
public:
|
||||
IMAPOperation();
|
||||
virtual ~IMAPOperation();
|
||||
|
||||
virtual void setMainSession(IMAPAsyncSession * session);
|
||||
virtual IMAPAsyncSession * mainSession();
|
||||
|
||||
virtual void setSession(IMAPAsyncConnection * session);
|
||||
virtual IMAPAsyncConnection * session();
|
||||
|
||||
virtual void setFolder(String * folder);
|
||||
virtual String * folder();
|
||||
|
||||
virtual void setUrgent(bool urgent);
|
||||
virtual bool isUrgent();
|
||||
|
||||
virtual void setImapCallback(IMAPOperationCallback * callback);
|
||||
virtual IMAPOperationCallback * imapCallback();
|
||||
|
||||
virtual void beforeMain();
|
||||
virtual void afterMain();
|
||||
|
||||
virtual void start();
|
||||
|
||||
// Result.
|
||||
virtual void setError(ErrorCode error);
|
||||
virtual ErrorCode error();
|
||||
|
||||
private:
|
||||
IMAPAsyncSession * mMainSession;
|
||||
IMAPAsyncConnection * mSession;
|
||||
String * mFolder;
|
||||
IMAPOperationCallback * mImapCallback;
|
||||
ErrorCode mError;
|
||||
bool mUrgent;
|
||||
|
||||
private:
|
||||
virtual void bodyProgress(IMAPSession * session, unsigned int current, unsigned int maximum);
|
||||
virtual void bodyProgressOnMainThread(void * context);
|
||||
virtual void itemsProgress(IMAPSession * session, unsigned int current, unsigned int maximum);
|
||||
virtual void itemsProgressOnMainThread(void * context);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,29 @@
|
||||
//
|
||||
// MCIMAPOperationCallback.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/12/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPOPERATIONCALLBACK_H
|
||||
|
||||
#define MAILCORE_MCIMAPOPERATIONCALLBACK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPOperation;
|
||||
|
||||
class IMAPOperationCallback {
|
||||
public:
|
||||
virtual void bodyProgress(IMAPOperation * session, unsigned int current, unsigned int maximum) {};
|
||||
virtual void itemProgress(IMAPOperation * session, unsigned int current, unsigned int maximum) {};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
66
MailCore.framework/Versions/A/Headers/MCIMAPPart.h
Normal file
66
MailCore.framework/Versions/A/Headers/MCIMAPPart.h
Normal file
@ -0,0 +1,66 @@
|
||||
#ifndef MAILCORE_MCIMAPPART_H
|
||||
|
||||
#define MAILCORE_MCIMAPPART_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
#include <MailCore/MCAbstractPart.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPMessagePart;
|
||||
class IMAPMultipart;
|
||||
|
||||
class IMAPPart : public AbstractPart {
|
||||
public:
|
||||
IMAPPart();
|
||||
virtual ~IMAPPart();
|
||||
|
||||
virtual void setPartID(String * partID);
|
||||
virtual String * partID();
|
||||
|
||||
virtual void setSize(unsigned int size);
|
||||
virtual unsigned int size();
|
||||
|
||||
virtual unsigned int decodedSize();
|
||||
|
||||
virtual void setEncoding(Encoding encoding);
|
||||
virtual Encoding encoding();
|
||||
|
||||
public: // subclass behavior
|
||||
IMAPPart(IMAPPart * other);
|
||||
virtual Object * copy();
|
||||
virtual HashMap * serializable();
|
||||
virtual void importSerializable(HashMap * serializable);
|
||||
|
||||
public: // private
|
||||
static AbstractPart * attachmentWithIMAPBody(struct mailimap_body * body);
|
||||
|
||||
virtual void importIMAPFields(struct mailimap_body_fields * fields,
|
||||
struct mailimap_body_ext_1part * extension);
|
||||
|
||||
private:
|
||||
String * mPartID;
|
||||
Encoding mEncoding;
|
||||
unsigned int mSize;
|
||||
void init();
|
||||
static AbstractPart * attachmentWithIMAPBodyInternal(struct mailimap_body * body, String * partID);
|
||||
static AbstractPart * attachmentWithIMAPBody1Part(struct mailimap_body_type_1part * body_1part,
|
||||
String * partID);
|
||||
static IMAPMessagePart * attachmentWithIMAPBody1PartMessage(struct mailimap_body_type_msg * message,
|
||||
struct mailimap_body_ext_1part * extension,
|
||||
String * partID);
|
||||
static IMAPPart * attachmentWithIMAPBody1PartBasic(struct mailimap_body_type_basic * basic,
|
||||
struct mailimap_body_ext_1part * extension);
|
||||
static IMAPPart * attachmentWithIMAPBody1PartText(struct mailimap_body_type_text * text,
|
||||
struct mailimap_body_ext_1part * extension);
|
||||
static IMAPMultipart * attachmentWithIMAPBodyMultipart(struct mailimap_body_type_mpart * body_mpart,
|
||||
String * partID);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,21 @@
|
||||
#ifndef MAILCORE_MCIMAPPROGRESSCALLBACK_H
|
||||
|
||||
#define MAILCORE_MCIMAPPROGRESSCALLBACK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPSession;
|
||||
|
||||
class IMAPProgressCallback {
|
||||
public:
|
||||
virtual void bodyProgress(IMAPSession * session, unsigned int current, unsigned int maximum) {};
|
||||
virtual void itemsProgress(IMAPSession * session, unsigned int current, unsigned int maximum) {};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
40
MailCore.framework/Versions/A/Headers/MCIMAPQuotaOperation.h
Normal file
40
MailCore.framework/Versions/A/Headers/MCIMAPQuotaOperation.h
Normal file
@ -0,0 +1,40 @@
|
||||
//
|
||||
// MCIMAPQuotaOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by Petro Korenev on 8/2/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPQuotaOperation_H
|
||||
|
||||
#define MAILCORE_MCIMAPQuotaOperation_H
|
||||
|
||||
#include "MCIMAPOperation.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPQuotaOperation : public IMAPOperation {
|
||||
public:
|
||||
IMAPQuotaOperation();
|
||||
virtual ~IMAPQuotaOperation();
|
||||
|
||||
// Result.
|
||||
virtual uint32_t limit();
|
||||
virtual uint32_t usage();
|
||||
|
||||
public: // subclass behavior
|
||||
virtual void main();
|
||||
|
||||
private:
|
||||
uint32_t mLimit;
|
||||
uint32_t mUsage;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,85 @@
|
||||
#ifndef MAILCORE_MCIMAPSEARCHEXPRESSION_H
|
||||
|
||||
#define MAILCORE_MCIMAPSEARCHEXPRESSION_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
#include <MailCore/MCMessageConstants.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPSearchExpression : public Object {
|
||||
public:
|
||||
IMAPSearchExpression();
|
||||
virtual ~IMAPSearchExpression();
|
||||
|
||||
virtual IMAPSearchKind kind();
|
||||
virtual String * header();
|
||||
virtual String * value();
|
||||
virtual uint64_t longNumber();
|
||||
virtual time_t date();
|
||||
virtual IndexSet * uids();
|
||||
|
||||
|
||||
virtual IMAPSearchExpression * leftExpression();
|
||||
virtual IMAPSearchExpression * rightExpression();
|
||||
|
||||
static IMAPSearchExpression * searchAll();
|
||||
static IMAPSearchExpression * searchFrom(String * value);
|
||||
static IMAPSearchExpression * searchTo(String *value);
|
||||
static IMAPSearchExpression * searchCc(String *value);
|
||||
static IMAPSearchExpression * searchBcc(String *value);
|
||||
static IMAPSearchExpression * searchRecipient(String * value);
|
||||
static IMAPSearchExpression * searchSubject(String * value);
|
||||
static IMAPSearchExpression * searchContent(String * value);
|
||||
static IMAPSearchExpression * searchBody(String * value);
|
||||
static IMAPSearchExpression * searchHeader(String * header, String * value);
|
||||
static IMAPSearchExpression * searchUIDs(IndexSet * uids);
|
||||
static IMAPSearchExpression * searchRead();
|
||||
static IMAPSearchExpression * searchUnread();
|
||||
static IMAPSearchExpression * searchFlagged();
|
||||
static IMAPSearchExpression * searchUnflagged();
|
||||
static IMAPSearchExpression * searchAnswered();
|
||||
static IMAPSearchExpression * searchUnanswered();
|
||||
static IMAPSearchExpression * searchDraft();
|
||||
static IMAPSearchExpression * searchUndraft();
|
||||
static IMAPSearchExpression * searchDeleted();
|
||||
static IMAPSearchExpression * searchSpam();
|
||||
static IMAPSearchExpression * searchBeforeDate(time_t date);
|
||||
static IMAPSearchExpression * searchOnDate(time_t date);
|
||||
static IMAPSearchExpression * searchSinceDate(time_t date);
|
||||
static IMAPSearchExpression * searchBeforeReceivedDate(time_t date);
|
||||
static IMAPSearchExpression * searchOnReceivedDate(time_t date);
|
||||
static IMAPSearchExpression * searchSinceReceivedDate(time_t date);
|
||||
static IMAPSearchExpression * searchSizeLarger(uint32_t size);
|
||||
static IMAPSearchExpression * searchSizeSmaller(uint32_t size);
|
||||
static IMAPSearchExpression * searchGmailThreadID(uint64_t number);
|
||||
static IMAPSearchExpression * searchGmailMessageID(uint64_t number);
|
||||
static IMAPSearchExpression * searchGmailRaw(String * expr);
|
||||
static IMAPSearchExpression * searchAnd(IMAPSearchExpression * left, IMAPSearchExpression * right);
|
||||
static IMAPSearchExpression * searchOr(IMAPSearchExpression * left, IMAPSearchExpression * right);
|
||||
static IMAPSearchExpression * searchNot(IMAPSearchExpression * notExpr);
|
||||
|
||||
|
||||
public: // subclass behavior
|
||||
IMAPSearchExpression(IMAPSearchExpression * other);
|
||||
virtual String * description();
|
||||
virtual Object * copy();
|
||||
|
||||
private:
|
||||
IMAPSearchKind mKind;
|
||||
String * mHeader;
|
||||
String * mValue;
|
||||
uint64_t mLongNumber;
|
||||
IndexSet * mUids;
|
||||
IMAPSearchExpression * mLeftExpression;
|
||||
IMAPSearchExpression * mRightExpression;
|
||||
void init();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,54 @@
|
||||
//
|
||||
// IMAPSearchOperation.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 1/12/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPSEARCHOPERATION_H
|
||||
|
||||
#define MAILCORE_MCIMAPSEARCHOPERATION_H
|
||||
|
||||
#include <MailCore/MCIMAPOperation.h>
|
||||
#include <MailCore/MCMessageConstants.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPSearchExpression;
|
||||
|
||||
class IMAPSearchOperation : public IMAPOperation {
|
||||
public:
|
||||
IMAPSearchOperation();
|
||||
virtual ~IMAPSearchOperation();
|
||||
|
||||
virtual void setSearchKind(IMAPSearchKind kind);
|
||||
virtual IMAPSearchKind searchKind();
|
||||
|
||||
virtual void setSearchString(String * searchString);
|
||||
virtual String * searchString();
|
||||
|
||||
virtual void setSearchExpression(IMAPSearchExpression * expression);
|
||||
virtual IMAPSearchExpression * searchExpression();
|
||||
|
||||
// Result.
|
||||
virtual IndexSet * uids();
|
||||
|
||||
public: // subclass behavior
|
||||
virtual void main();
|
||||
|
||||
private:
|
||||
IMAPSearchKind mKind;
|
||||
String * mSearchString;
|
||||
IMAPSearchExpression * mExpression;
|
||||
IndexSet * mUids;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
279
MailCore.framework/Versions/A/Headers/MCIMAPSession.h
Executable file
279
MailCore.framework/Versions/A/Headers/MCIMAPSession.h
Executable file
@ -0,0 +1,279 @@
|
||||
#ifndef MAILCORE_MCIMAPSESSION_H
|
||||
|
||||
#define MAILCORE_MCIMAPSESSION_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
#include <MailCore/MCMessageConstants.h>
|
||||
#include <MailCore/MCIMAPMessage.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
extern String * IMAPNamespacePersonal;
|
||||
extern String * IMAPNamespaceOther;
|
||||
extern String * IMAPNamespaceShared;
|
||||
|
||||
class IMAPNamespace;
|
||||
class IMAPSearchExpression;
|
||||
class IMAPFolder;
|
||||
class IMAPProgressCallback;
|
||||
class IMAPSyncResult;
|
||||
class IMAPFolderStatus;
|
||||
class IMAPIdentity;
|
||||
|
||||
class IMAPSession : public Object {
|
||||
public:
|
||||
IMAPSession();
|
||||
virtual ~IMAPSession();
|
||||
|
||||
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();
|
||||
|
||||
// To authenticate using OAuth2, username and oauth2token should be set.
|
||||
// auth type to use is AuthTypeOAuth2.
|
||||
virtual void setOAuth2Token(String * token);
|
||||
virtual String * OAuth2Token();
|
||||
|
||||
virtual void setAuthType(AuthType authType);
|
||||
virtual AuthType authType();
|
||||
|
||||
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 setVoIPEnabled(bool enabled);
|
||||
virtual bool isVoIPEnabled();
|
||||
|
||||
// Needed for fetchSubscribedFolders() and fetchAllFolders().
|
||||
virtual void setDefaultNamespace(IMAPNamespace * ns);
|
||||
virtual IMAPNamespace * defaultNamespace();
|
||||
|
||||
virtual IMAPIdentity * serverIdentity();
|
||||
virtual IMAPIdentity * clientIdentity();
|
||||
|
||||
virtual void select(String * folder, ErrorCode * pError);
|
||||
virtual IMAPFolderStatus * folderStatus(String * folder, ErrorCode * pError);
|
||||
|
||||
virtual Array * /* IMAPFolder */ fetchSubscribedFolders(ErrorCode * pError);
|
||||
virtual Array * /* IMAPFolder */ fetchAllFolders(ErrorCode * pError); // will use xlist if available
|
||||
|
||||
virtual void renameFolder(String * folder, String * otherName, ErrorCode * pError);
|
||||
virtual void deleteFolder(String * folder, ErrorCode * pError);
|
||||
virtual void createFolder(String * folder, ErrorCode * pError);
|
||||
|
||||
virtual void subscribeFolder(String * folder, ErrorCode * pError);
|
||||
virtual void unsubscribeFolder(String * folder, ErrorCode * pError);
|
||||
|
||||
virtual void appendMessage(String * folder, Data * messageData, MessageFlag flags,
|
||||
IMAPProgressCallback * progressCallback, uint32_t * createdUID, ErrorCode * pError);
|
||||
virtual void appendMessageWithCustomFlags(String * folder, Data * messageData, MessageFlag flags, Array * customFlags,
|
||||
IMAPProgressCallback * progressCallback, uint32_t * createdUID, ErrorCode * pError);
|
||||
virtual void appendMessageWithCustomFlagsAndDate(String * folder, Data * messageData, MessageFlag flags, Array * customFlags, time_t date,
|
||||
IMAPProgressCallback * progressCallback, uint32_t * createdUID, ErrorCode * pError);
|
||||
|
||||
void copyMessages(String * folder, IndexSet * uidSet, String * destFolder,
|
||||
HashMap ** pUidMapping, ErrorCode * pError);
|
||||
|
||||
virtual void expunge(String * folder, ErrorCode * pError);
|
||||
|
||||
virtual Array * /* IMAPMessage */ fetchMessagesByUID(String * folder, IMAPMessagesRequestKind requestKind,
|
||||
IndexSet * uids, IMAPProgressCallback * progressCallback,
|
||||
ErrorCode * pError);
|
||||
virtual Array * /* IMAPMessage */ fetchMessagesByUIDWithExtraHeaders(String * folder,
|
||||
IMAPMessagesRequestKind requestKind,
|
||||
IndexSet * uids,
|
||||
IMAPProgressCallback * progressCallback,
|
||||
Array * extraHeaders, ErrorCode * pError);
|
||||
virtual Array * /* IMAPMessage */ fetchMessagesByNumber(String * folder, IMAPMessagesRequestKind requestKind,
|
||||
IndexSet * numbers, IMAPProgressCallback * progressCallback,
|
||||
ErrorCode * pError);
|
||||
virtual Array * /* IMAPMessage */ fetchMessagesByNumberWithExtraHeaders(String * folder,
|
||||
IMAPMessagesRequestKind requestKind,
|
||||
IndexSet * numbers,
|
||||
IMAPProgressCallback * progressCallback,
|
||||
Array * extraHeaders, ErrorCode * pError);
|
||||
|
||||
virtual Data * fetchMessageByUID(String * folder, uint32_t uid,
|
||||
IMAPProgressCallback * progressCallback, ErrorCode * pError);
|
||||
virtual Data * fetchMessageAttachmentByUID(String * folder, uint32_t uid, String * partID,
|
||||
Encoding encoding, IMAPProgressCallback * progressCallback, ErrorCode * pError);
|
||||
virtual HashMap * fetchMessageNumberUIDMapping(String * folder, uint32_t fromUID, uint32_t toUID,
|
||||
ErrorCode * pError);
|
||||
|
||||
/* When CONDSTORE or QRESYNC is available */
|
||||
virtual IMAPSyncResult * syncMessagesByUID(String * folder, IMAPMessagesRequestKind requestKind,
|
||||
IndexSet * uids, uint64_t modseq,
|
||||
IMAPProgressCallback * progressCallback, ErrorCode * pError);
|
||||
/* Same as syncMessagesByUID, allows for extra headers */
|
||||
virtual IMAPSyncResult * syncMessagesByUIDWithExtraHeaders(String * folder, IMAPMessagesRequestKind requestKind,
|
||||
IndexSet * uids, uint64_t modseq,
|
||||
IMAPProgressCallback * progressCallback,
|
||||
Array * extraHeaders, ErrorCode * pError);
|
||||
|
||||
virtual void storeFlags(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, ErrorCode * pError);
|
||||
virtual void storeFlagsAndCustomFlags(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, MessageFlag flags, Array * customFlags, ErrorCode * pError);
|
||||
virtual void storeLabels(String * folder, IndexSet * uids, IMAPStoreFlagsRequestKind kind, Array * labels, ErrorCode * pError);
|
||||
|
||||
virtual IndexSet * search(String * folder, IMAPSearchKind kind, String * searchString, ErrorCode * pError);
|
||||
virtual IndexSet * search(String * folder, IMAPSearchExpression * expression, ErrorCode * pError);
|
||||
virtual void getQuota(uint32_t *usage, uint32_t *limit, ErrorCode * pError);
|
||||
|
||||
virtual bool setupIdle();
|
||||
virtual void idle(String * folder, uint32_t lastKnownUID, ErrorCode * pError);
|
||||
virtual void interruptIdle();
|
||||
virtual void unsetupIdle();
|
||||
|
||||
virtual void connect(ErrorCode * pError);
|
||||
virtual void disconnect();
|
||||
|
||||
virtual void noop(ErrorCode * pError);
|
||||
|
||||
virtual HashMap * fetchNamespace(ErrorCode * pError);
|
||||
|
||||
virtual void login(ErrorCode * pError);
|
||||
|
||||
IMAPIdentity * identity(IMAPIdentity * clientIdentity, ErrorCode * pError);
|
||||
|
||||
virtual IndexSet * capability(ErrorCode * pError);
|
||||
|
||||
virtual void enableCompression(ErrorCode * pError);
|
||||
|
||||
virtual uint32_t uidValidity();
|
||||
virtual uint32_t uidNext();
|
||||
virtual uint64_t modSequenceValue();
|
||||
virtual unsigned int lastFolderMessageCount();
|
||||
virtual uint32_t firstUnseenUid();
|
||||
|
||||
virtual bool isIdleEnabled();
|
||||
virtual bool isXListEnabled();
|
||||
virtual bool isCondstoreEnabled();
|
||||
virtual bool isQResyncEnabled();
|
||||
virtual bool isIdentityEnabled();
|
||||
virtual bool isXOAuthEnabled();
|
||||
virtual bool isNamespaceEnabled();
|
||||
virtual bool isCompressionEnabled();
|
||||
virtual bool allowsNewPermanentFlags();
|
||||
|
||||
virtual String * gmailUserDisplayName();
|
||||
|
||||
virtual void setConnectionLogger(ConnectionLogger * logger);
|
||||
virtual ConnectionLogger * connectionLogger();
|
||||
|
||||
/** HTML rendering of the body of the message to be displayed in a web view.*/
|
||||
virtual String * htmlRendering(IMAPMessage * message, String * folder, ErrorCode * pError);
|
||||
|
||||
/** HTML rendering of the body of the message.*/
|
||||
virtual String * htmlBodyRendering(IMAPMessage * message, String * folder, ErrorCode * pError);
|
||||
|
||||
/** Text rendering of the message.*/
|
||||
virtual String * plainTextRendering(IMAPMessage * message, String * folder, ErrorCode * pError);
|
||||
|
||||
/** Text rendering of the body of the message. All end of line will be removed and white spaces cleaned up if requested.
|
||||
This method can be used to generate the summary of the message.*/
|
||||
virtual String * plainTextBodyRendering(IMAPMessage * message, String * folder, bool stripWhitespace, ErrorCode * pError);
|
||||
|
||||
/** Enable automatic query of the capabilities of the IMAP server when set to true. */
|
||||
virtual void setAutomaticConfigurationEnabled(bool enabled);
|
||||
|
||||
/** Check if the automatic query of the capabilities of the IMAP server is enabled. */
|
||||
virtual bool isAutomaticConfigurationEnabled();
|
||||
|
||||
public: // private
|
||||
virtual void loginIfNeeded(ErrorCode * pError);
|
||||
virtual void connectIfNeeded(ErrorCode * pError);
|
||||
virtual void selectIfNeeded(String * folder, ErrorCode * pError);
|
||||
virtual bool isDisconnected();
|
||||
virtual bool isAutomaticConfigurationDone();
|
||||
virtual void resetAutomaticConfigurationDone();
|
||||
virtual void applyCapabilities(IndexSet * capabilities);
|
||||
|
||||
private:
|
||||
String * mHostname;
|
||||
unsigned int mPort;
|
||||
String * mUsername;
|
||||
String * mPassword;
|
||||
String * mOAuth2Token;
|
||||
AuthType mAuthType;
|
||||
ConnectionType mConnectionType;
|
||||
bool mCheckCertificateEnabled;
|
||||
bool mVoIPEnabled;
|
||||
char mDelimiter;
|
||||
IMAPNamespace * mDefaultNamespace;
|
||||
IMAPIdentity * mServerIdentity;
|
||||
IMAPIdentity * mClientIdentity;
|
||||
time_t mTimeout;
|
||||
|
||||
bool mBodyProgressEnabled;
|
||||
bool mIdleEnabled;
|
||||
bool mXListEnabled;
|
||||
bool mCondstoreEnabled;
|
||||
bool mQResyncEnabled;
|
||||
bool mIdentityEnabled;
|
||||
bool mXOauth2Enabled;
|
||||
bool mNamespaceEnabled;
|
||||
bool mCompressionEnabled;
|
||||
bool mIsGmail;
|
||||
bool mAllowsNewPermanentFlags;
|
||||
String * mWelcomeString;
|
||||
bool mNeedsMboxMailWorkaround;
|
||||
uint32_t mUIDValidity;
|
||||
uint32_t mUIDNext;
|
||||
uint64_t mModSequenceValue;
|
||||
unsigned int mFolderMsgCount;
|
||||
uint32_t mFirstUnseenUid;
|
||||
bool mYahooServer;
|
||||
|
||||
unsigned int mLastFetchedSequenceNumber;
|
||||
String * mCurrentFolder;
|
||||
pthread_mutex_t mIdleLock;
|
||||
bool mCanIdle;
|
||||
int mState;
|
||||
mailimap * mImap;
|
||||
IMAPProgressCallback * mProgressCallback;
|
||||
unsigned int mProgressItemsCount;
|
||||
ConnectionLogger * mConnectionLogger;
|
||||
bool mAutomaticConfigurationEnabled;
|
||||
bool mAutomaticConfigurationDone;
|
||||
bool mShouldDisconnect;
|
||||
|
||||
String * mLoginResponse;
|
||||
String * mGmailUserDisplayName;
|
||||
|
||||
void init();
|
||||
void bodyProgress(unsigned int current, unsigned int maximum);
|
||||
void itemsProgress(unsigned int current, unsigned int maximum);
|
||||
bool checkCertificate();
|
||||
static void body_progress(size_t current, size_t maximum, void * context);
|
||||
static void items_progress(size_t current, size_t maximum, void * context);
|
||||
void setup();
|
||||
void unsetup();
|
||||
char fetchDelimiterIfNeeded(char defaultDelimiter, ErrorCode * pError);
|
||||
IMAPSyncResult * fetchMessages(String * folder, IMAPMessagesRequestKind requestKind,
|
||||
bool fetchByUID, struct mailimap_set * imapset, uint64_t modseq,
|
||||
HashMap * mapping, uint32_t startUid, IMAPProgressCallback * progressCallback,
|
||||
Array * extraHeaders, ErrorCode * pError);
|
||||
void capabilitySetWithSessionState(IndexSet * capabilities);
|
||||
bool enableFeature(String * feature);
|
||||
void enableFeatures();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
39
MailCore.framework/Versions/A/Headers/MCIMAPSyncResult.h
Normal file
39
MailCore.framework/Versions/A/Headers/MCIMAPSyncResult.h
Normal file
@ -0,0 +1,39 @@
|
||||
//
|
||||
// MCIMAPSyncResult.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 3/3/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCIMAPSYNCRESULT_H
|
||||
|
||||
#define MAILCORE_MCIMAPSYNCRESULT_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IMAPSyncResult : public Object {
|
||||
public:
|
||||
IMAPSyncResult();
|
||||
virtual ~IMAPSyncResult();
|
||||
|
||||
virtual void setModifiedOrAddedMessages(Array * /* IMAPMessage */ messages);
|
||||
virtual Array * /* IMAPMessage */ modifiedOrAddedMessages();
|
||||
|
||||
virtual void setVanishedMessages(IndexSet * vanishedMessages);
|
||||
virtual IndexSet * vanishedMessages();
|
||||
|
||||
private:
|
||||
Array * /* IMAPMessage */ mModifiedOrAddedMessages;
|
||||
IndexSet * mVanishedMessages;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
75
MailCore.framework/Versions/A/Headers/MCIndexSet.h
Normal file
75
MailCore.framework/Versions/A/Headers/MCIndexSet.h
Normal file
@ -0,0 +1,75 @@
|
||||
//
|
||||
// MCIndexSet.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 3/4/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCINDEXSET_H
|
||||
|
||||
#define MAILCORE_MCINDEXSET_H
|
||||
|
||||
#include <MailCore/MCObject.h>
|
||||
#include <MailCore/MCRange.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class IndexSet : public Object {
|
||||
public:
|
||||
IndexSet();
|
||||
IndexSet(IndexSet * o);
|
||||
|
||||
static IndexSet * indexSet();
|
||||
static IndexSet * indexSetWithRange(Range range);
|
||||
static IndexSet * indexSetWithIndex(uint64_t idx);
|
||||
|
||||
virtual unsigned int count();
|
||||
virtual void addIndex(uint64_t idx);
|
||||
virtual void removeIndex(uint64_t idx);
|
||||
virtual bool containsIndex(uint64_t idx);
|
||||
|
||||
virtual void addRange(Range range);
|
||||
virtual void removeRange(Range range);
|
||||
virtual void intersectsRange(Range range);
|
||||
|
||||
virtual void addIndexSet(IndexSet * indexSet);
|
||||
virtual void removeIndexSet(IndexSet * indexSet);
|
||||
virtual void intersectsIndexSet(IndexSet * indexSet);
|
||||
|
||||
virtual Range * allRanges();
|
||||
virtual unsigned int rangesCount();
|
||||
virtual void removeAllIndexes();
|
||||
|
||||
public: // subclass behavior
|
||||
virtual ~IndexSet();
|
||||
virtual String * description();
|
||||
virtual Object * copy();
|
||||
virtual HashMap * serializable();
|
||||
virtual void importSerializable(HashMap * serializable);
|
||||
|
||||
private:
|
||||
Range * mRanges;
|
||||
unsigned int mCount;
|
||||
unsigned int mAllocated;
|
||||
void init();
|
||||
int rangeIndexForIndex(uint64_t idx);
|
||||
int rangeIndexForIndexWithBounds(uint64_t idx, unsigned int left, unsigned int right);
|
||||
void addRangeIndex(unsigned int rangeIndex);
|
||||
void removeRangeIndex(unsigned int rangeIndex, unsigned int count);
|
||||
int rightRangeIndexForIndex(uint64_t idx);
|
||||
int rightRangeIndexForIndexWithBounds(uint64_t idx, unsigned int left, unsigned int right);
|
||||
int leftRangeIndexForIndex(uint64_t idx);
|
||||
int leftRangeIndexForIndexWithBounds(uint64_t idx, unsigned int left, unsigned int right);
|
||||
void mergeRanges(unsigned int rangeIndex);
|
||||
void tryToMergeAdjacentRanges(unsigned int rangeIndex);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
186
MailCore.framework/Versions/A/Headers/MCIterator.h
Normal file
186
MailCore.framework/Versions/A/Headers/MCIterator.h
Normal file
@ -0,0 +1,186 @@
|
||||
//
|
||||
// MCIterator.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 4/18/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_ITERATOR_H
|
||||
|
||||
#define MAILCORE_ITERATOR_H
|
||||
|
||||
#include <MailCore/MCArray.h>
|
||||
#include <MailCore/MCHashMap.h>
|
||||
#include <MailCore/MCIndexSet.h>
|
||||
#include <MailCore/MCAutoreleasePool.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#define mc_foreacharray(type, __variable, __array) \
|
||||
type * __variable; \
|
||||
mailcore::ArrayIterator __variable##__iterator = mailcore::ArrayIteratorInit(__array); \
|
||||
for (; NULL != (__variable = (type *) mailcore::ArrayIteratorNext(&__variable##__iterator)); )
|
||||
|
||||
#define mc_foreacharrayIndex(__index, type, __variable, __array) \
|
||||
type * __variable; \
|
||||
mailcore::ArrayIterator __variable##__iterator = mailcore::ArrayIteratorInit(__array); \
|
||||
for (unsigned int __index = 0; NULL != (__variable = (type *) mailcore::ArrayIteratorNext(&__variable##__iterator)); __index++)
|
||||
|
||||
#define mc_foreachhashmapKey(keyType, __key, __hashmap) \
|
||||
keyType * __key; \
|
||||
HashMapIterator __key##__iterator = HashMapIteratorInit(__hashmap, true, false); \
|
||||
while (HashMapIteratorRun(&__key##__iterator)) \
|
||||
while (HashMapIteratorNext(&__key##__iterator, &__key, NULL))
|
||||
|
||||
#define mc_foreachhashmapValue(valueType, __value, __hashmap) \
|
||||
valueType * __value; \
|
||||
HashMapIterator __value##__iterator = HashMapIteratorInit(__hashmap, false, true); \
|
||||
while (HashMapIteratorRun(&__value##__iterator)) \
|
||||
while (HashMapIteratorNext(&__value##__iterator, NULL, (Object **) &__value))
|
||||
|
||||
#define mc_foreachhashmapKeyAndValue(keyType, __key, valueType, __value, __hashmap) \
|
||||
keyType * __key; \
|
||||
valueType * __value; \
|
||||
HashMapIterator __key##__value##__iterator = HashMapIteratorInit(__hashmap, true, true); \
|
||||
while (HashMapIteratorRun(&__key##__value##__iterator)) \
|
||||
while (HashMapIteratorNext(&__key##__value##__iterator, (Object **) &__key, (Object **) &__value))
|
||||
|
||||
#define mc_foreachindexset(__variable, __indexset) \
|
||||
int64_t __variable; \
|
||||
mailcore::IndexSetIterator __variable##__iterator = mailcore::IndexSetIteratorInit(__indexset); \
|
||||
for (; (__variable = IndexSetIteratorValue(&__variable##__iterator)), IndexSetIteratorIsValid(&__variable##__iterator) ; mailcore::IndexSetIteratorNext(&__variable##__iterator))
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
struct IndexSetIterator {
|
||||
unsigned int rangeIndex;
|
||||
unsigned int index;
|
||||
Range * currentRange;
|
||||
IndexSet * indexSet;
|
||||
};
|
||||
|
||||
static inline IndexSetIterator IndexSetIteratorInit(IndexSet * indexSet)
|
||||
{
|
||||
IndexSetIterator iterator = { 0, 0, NULL, indexSet };
|
||||
if (indexSet->rangesCount() >= 1) {
|
||||
iterator.currentRange = &indexSet->allRanges()[0];
|
||||
}
|
||||
return iterator;
|
||||
}
|
||||
|
||||
static inline bool IndexSetIteratorIsValid(IndexSetIterator * iterator)
|
||||
{
|
||||
return iterator->currentRange != NULL;
|
||||
}
|
||||
|
||||
static inline int64_t IndexSetIteratorValue(IndexSetIterator * iterator)
|
||||
{
|
||||
return iterator->currentRange == NULL ? -1 : iterator->currentRange->location + iterator->index;
|
||||
}
|
||||
|
||||
static inline bool IndexSetIteratorNext(IndexSetIterator * iterator)
|
||||
{
|
||||
iterator->index ++;
|
||||
if (iterator->index > iterator->currentRange->length) {
|
||||
// switch to an other range
|
||||
iterator->index = 0;
|
||||
iterator->rangeIndex ++;
|
||||
if (iterator->rangeIndex >= iterator->indexSet->rangesCount()) {
|
||||
iterator->currentRange = NULL;
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
iterator->currentRange = &iterator->indexSet->allRanges()[iterator->rangeIndex];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
struct ArrayIterator {
|
||||
unsigned index;
|
||||
unsigned count;
|
||||
Array * array;
|
||||
};
|
||||
|
||||
static inline ArrayIterator ArrayIteratorInit(Array * array)
|
||||
{
|
||||
ArrayIterator iterator = { 0, array != NULL ? array->count() : 0, array };
|
||||
return iterator;
|
||||
}
|
||||
|
||||
static inline Object * ArrayIteratorNext(ArrayIterator * iterator)
|
||||
{
|
||||
if (iterator->index >= iterator->count) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Object * result = iterator->array->objectAtIndex(iterator->index);
|
||||
++ iterator->index;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
struct HashMapIterator {
|
||||
bool cleanup;
|
||||
unsigned index;
|
||||
unsigned count;
|
||||
Array * keys;
|
||||
Array * values;
|
||||
};
|
||||
|
||||
static inline HashMapIterator HashMapIteratorInit(HashMap * hashmap, bool useKeys, bool useValues)
|
||||
{
|
||||
AutoreleasePool * pool = new AutoreleasePool();
|
||||
Array * keys = useKeys ? (hashmap != NULL ? hashmap->allKeys() : NULL) : NULL;
|
||||
Array * values = useValues ? (hashmap != NULL ? hashmap->allValues() : NULL) : NULL;
|
||||
if (keys != NULL) {
|
||||
keys->retain();
|
||||
}
|
||||
if (values != NULL) {
|
||||
values->retain();
|
||||
}
|
||||
HashMapIterator iterator = { false, 0, hashmap != NULL ? hashmap->count() : 0, keys, values };
|
||||
pool->release();
|
||||
|
||||
return iterator;
|
||||
}
|
||||
|
||||
static inline bool HashMapIteratorNext(HashMapIterator * iterator, Object ** keyp, Object ** valuep)
|
||||
{
|
||||
if (iterator->index >= iterator->count) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (keyp != NULL) {
|
||||
* keyp = iterator->keys->objectAtIndex(iterator->index);
|
||||
}
|
||||
if (valuep != NULL) {
|
||||
* valuep = iterator->values->objectAtIndex(iterator->index);
|
||||
}
|
||||
iterator->index ++;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static inline bool HashMapIteratorRun(HashMapIterator * iterator)
|
||||
{
|
||||
if (!iterator->cleanup) {
|
||||
iterator->cleanup = true;
|
||||
return true;
|
||||
} else {
|
||||
MC_SAFE_RELEASE(iterator->keys);
|
||||
MC_SAFE_RELEASE(iterator->values);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
38
MailCore.framework/Versions/A/Headers/MCJSON.h
Normal file
38
MailCore.framework/Versions/A/Headers/MCJSON.h
Normal file
@ -0,0 +1,38 @@
|
||||
//
|
||||
// MCJSON.h
|
||||
// hermes
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 4/8/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCJSON_H
|
||||
|
||||
#define MAILCORE_MCJSON_H
|
||||
|
||||
#include <MailCore/MCObject.h>
|
||||
#include <MailCore/MCHashMap.h>
|
||||
#include <MailCore/MCArray.h>
|
||||
#include <MailCore/MCValue.h>
|
||||
#include <MailCore/MCString.h>
|
||||
#include <MailCore/MCData.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class Null;
|
||||
|
||||
class JSON {
|
||||
public:
|
||||
static String * objectToJSONString(Object * object);
|
||||
static Data * objectToJSONData(Object * object);
|
||||
static Object * objectFromJSONString(String * json);
|
||||
static Object * objectFromJSONData(Data * json);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* defined(__hermes__MCJSON__) */
|
46
MailCore.framework/Versions/A/Headers/MCLibetpanTypes.h
Normal file
46
MailCore.framework/Versions/A/Headers/MCLibetpanTypes.h
Normal file
@ -0,0 +1,46 @@
|
||||
//
|
||||
// MCLibetpanTypes.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 4/7/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCLIBETPANTYPES_H
|
||||
|
||||
#define MAILCORE_MCLIBETPANTYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
struct mailimap_body_fields;
|
||||
struct mailimap_body_ext_1part;
|
||||
struct mailimf_address;
|
||||
struct mailimf_mailbox;
|
||||
struct mailimap_address;
|
||||
struct mailmime;
|
||||
struct mailmime_mechanism;
|
||||
struct mailimap_namespace_item;
|
||||
struct mailimap_namespace_info;
|
||||
struct mailimap_body;
|
||||
struct mailimap_body_fields;
|
||||
struct mailimap_body_ext_1part;
|
||||
struct mailimap_body_type_1part;
|
||||
struct mailimap_body_type_basic;
|
||||
struct mailimap_body_type_text;
|
||||
struct mailimap_body_type_mpart;
|
||||
struct mailimap_body_type_msg;
|
||||
typedef struct mailimap mailimap;
|
||||
struct mailimap_set;
|
||||
struct mailimap_date_time;
|
||||
struct mailimf_fields;
|
||||
struct mailimap_envelope;
|
||||
typedef struct mailpop3 mailpop3;
|
||||
typedef struct mailsmtp mailsmtp;
|
||||
typedef struct newsnntp newsnntp;
|
||||
struct mailsem;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
28
MailCore.framework/Versions/A/Headers/MCLog.h
Normal file
28
MailCore.framework/Versions/A/Headers/MCLog.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef MAILCORE_MCLOG_H
|
||||
|
||||
#define MAILCORE_MCLOG_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define MCLog(...) MCLogInternal(NULL, __FILE__, __LINE__, 0, __VA_ARGS__)
|
||||
#define MCLogStack(...) MCLogInternal(NULL, __FILE__, __LINE__, 1, __VA_ARGS__)
|
||||
|
||||
extern int MCLogEnabled;
|
||||
|
||||
#ifndef __printflike
|
||||
#define __printflike(a,b)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void MCLogInternal(const char * user,
|
||||
const char * filename,
|
||||
unsigned int line,
|
||||
int dumpStack,
|
||||
const char * format, ...) __printflike(5, 6);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
25
MailCore.framework/Versions/A/Headers/MCMD5.h
Normal file
25
MailCore.framework/Versions/A/Headers/MCMD5.h
Normal file
@ -0,0 +1,25 @@
|
||||
//
|
||||
// MCMD5.h
|
||||
// hermes
|
||||
//
|
||||
// Created by DINH Viêt Hoà on 4/11/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCMD5_H
|
||||
|
||||
#define MAILCORE_MCMD5_H
|
||||
|
||||
#include <MailCore/MCData.h>
|
||||
#include <MailCore/MCString.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
Data * md5Data(Data * data);
|
||||
String * md5String(Data * data);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
75
MailCore.framework/Versions/A/Headers/MCMailProvider.h
Normal file
75
MailCore.framework/Versions/A/Headers/MCMailProvider.h
Normal file
@ -0,0 +1,75 @@
|
||||
//
|
||||
// MCMailProvider.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by Robert Widmann on 4/28/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCMAILPROVIDER_H
|
||||
|
||||
#define MAILCORE_MCMAILPROVIDER_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class NetService;
|
||||
|
||||
class MailProvider : public Object {
|
||||
public:
|
||||
static MailProvider * providerWithInfo(HashMap * info);
|
||||
|
||||
MailProvider();
|
||||
virtual ~MailProvider();
|
||||
|
||||
virtual String * identifier();
|
||||
|
||||
virtual Array * /* NetService */ imapServices();
|
||||
virtual Array * /* NetService */ smtpServices();
|
||||
virtual Array * /* NetService */ popServices();
|
||||
|
||||
virtual bool matchEmail(String * email);
|
||||
virtual bool matchMX(String * hostname);
|
||||
|
||||
virtual String * sentMailFolderPath();
|
||||
virtual String * starredFolderPath();
|
||||
virtual String * allMailFolderPath();
|
||||
virtual String * trashFolderPath();
|
||||
virtual String * draftsFolderPath();
|
||||
virtual String * spamFolderPath();
|
||||
virtual String * importantFolderPath();
|
||||
|
||||
// Returns true if one of the folders above matches the given one.
|
||||
virtual bool isMainFolder(String * folderPath, String * prefix);
|
||||
|
||||
public: // subclass behavior
|
||||
MailProvider(MailProvider * other);
|
||||
virtual String * description();
|
||||
virtual Object * copy();
|
||||
|
||||
public: // private
|
||||
virtual void setIdentifier(String * identifier);
|
||||
virtual void fillWithInfo(HashMap * info);
|
||||
|
||||
private:
|
||||
String * mIdentifier;
|
||||
Array * /* String */ mDomainMatch;
|
||||
Array * /* String */ mDomainExclude;
|
||||
Array * /* String */ mMxMatch;
|
||||
Array * /* NetService */ mImapServices;
|
||||
Array * /* NetService */ mSmtpServices;
|
||||
Array * /* NetService */ mPopServices;
|
||||
HashMap * mMailboxPaths;
|
||||
|
||||
virtual bool matchDomain(String * match, String * domain);
|
||||
void init();
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,43 @@
|
||||
//
|
||||
// MCMailProvidersManager.h
|
||||
// mailcore2
|
||||
//
|
||||
// Created by Robert Widmann on 4/28/13.
|
||||
// Copyright (c) 2013 MailCore. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef MAILCORE_MCMAILPROVIDERSMANAGER_H
|
||||
|
||||
#define MAILCORE_MCMAILPROVIDERSMANAGER_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class MailProvider;
|
||||
|
||||
class MailProvidersManager : public Object {
|
||||
public:
|
||||
static MailProvidersManager * sharedManager();
|
||||
|
||||
virtual MailProvider * providerForEmail(String * email);
|
||||
virtual MailProvider * providerForMX(String * hostname);
|
||||
virtual MailProvider * providerForIdentifier(String * identifier);
|
||||
|
||||
virtual void registerProvidersWithFilename(String * filename);
|
||||
|
||||
private:
|
||||
MailProvidersManager();
|
||||
void registerProviders(HashMap * providers);
|
||||
|
||||
HashMap * mProviders;
|
||||
|
||||
void init();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
20
MailCore.framework/Versions/A/Headers/MCMainThread.h
Normal file
20
MailCore.framework/Versions/A/Headers/MCMainThread.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef MAILCORE_MCMAINTHREAD_H
|
||||
|
||||
#define MAILCORE_MCMAINTHREAD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
void callOnMainThread(void (*)(void *), void * context);
|
||||
void callOnMainThreadAndWait(void (*)(void *), void * context);
|
||||
|
||||
// Returns a "call" object.
|
||||
void * callAfterDelay(void (*)(void *), void * context, double time);
|
||||
|
||||
// Pass the pointer returns by callAfterDelay() to cancel a delayed call.
|
||||
void cancelDelayedCall(void * call);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
68
MailCore.framework/Versions/A/Headers/MCMessageBuilder.h
Normal file
68
MailCore.framework/Versions/A/Headers/MCMessageBuilder.h
Normal file
@ -0,0 +1,68 @@
|
||||
#ifndef MAILCORE_MCMESSAGEBUILDER_H
|
||||
|
||||
#define MAILCORE_MCMESSAGEBUILDER_H
|
||||
|
||||
#include <MailCore/MCBaseTypes.h>
|
||||
#include <MailCore/MCAbstractMessage.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
class Attachment;
|
||||
class HTMLRendererTemplateCallback;
|
||||
|
||||
class MessageBuilder : public AbstractMessage {
|
||||
public:
|
||||
MessageBuilder();
|
||||
virtual ~MessageBuilder();
|
||||
|
||||
virtual void setHTMLBody(String * htmlBody);
|
||||
virtual String * htmlBody();
|
||||
|
||||
virtual void setTextBody(String * textBody);
|
||||
virtual String * textBody();
|
||||
|
||||
virtual void setAttachments(Array * /* Attachment */ attachments);
|
||||
virtual Array * /* Attachment */ attachments();
|
||||
virtual void addAttachment(Attachment * attachment);
|
||||
|
||||
// attachments (usually images) that are included in HTML.
|
||||
// a Content-ID should be assigned to these part to be able to reference
|
||||
// them in the HTML using a cid: URL.
|
||||
virtual void setRelatedAttachments(Array * /* Attachment */ attachments);
|
||||
virtual Array * /* Attachment */ relatedAttachments();
|
||||
virtual void addRelatedAttachment(Attachment * attachment);
|
||||
|
||||
// When boundary needs to be prefixed (to go through spam filters).
|
||||
virtual void setBoundaryPrefix(String * boundaryPrefix);
|
||||
virtual String * boundaryPrefix();
|
||||
|
||||
virtual Data * data();
|
||||
|
||||
virtual String * htmlRendering(HTMLRendererTemplateCallback * htmlCallback = NULL);
|
||||
virtual String * htmlBodyRendering();
|
||||
|
||||
virtual String * plainTextRendering();
|
||||
virtual String * plainTextBodyRendering(bool stripWhitespace);
|
||||
|
||||
public: // subclass behavior
|
||||
MessageBuilder(MessageBuilder * other);
|
||||
virtual String * description();
|
||||
virtual Object * copy();
|
||||
|
||||
private:
|
||||
String * mHTMLBody;
|
||||
String * mTextBody;
|
||||
Array * /* Attachment */ mAttachments;
|
||||
Array * /* Attachment */ mRelatedAttachments;
|
||||
String * mBoundaryPrefix;
|
||||
void init();
|
||||
Data * dataAndFilterBcc(bool filterBcc);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
275
MailCore.framework/Versions/A/Headers/MCMessageConstants.h
Normal file
275
MailCore.framework/Versions/A/Headers/MCMessageConstants.h
Normal file
@ -0,0 +1,275 @@
|
||||
#ifndef MAILCORE_MCMESSAGECONSTANTS_H
|
||||
|
||||
#define MAILCORE_MCMESSAGECONSTANTS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mailcore {
|
||||
|
||||
enum ConnectionType {
|
||||
ConnectionTypeClear = 1 << 0,
|
||||
ConnectionTypeStartTLS = 1 << 1,
|
||||
ConnectionTypeTLS = 1 << 2,
|
||||
};
|
||||
|
||||
enum AuthType {
|
||||
AuthTypeSASLNone = 0,
|
||||
AuthTypeSASLCRAMMD5 = 1 << 0,
|
||||
AuthTypeSASLPlain = 1 << 1,
|
||||
AuthTypeSASLGSSAPI = 1 << 2,
|
||||
AuthTypeSASLDIGESTMD5 = 1 << 3,
|
||||
AuthTypeSASLLogin = 1 << 4,
|
||||
AuthTypeSASLSRP = 1 << 5,
|
||||
AuthTypeSASLNTLM = 1 << 6,
|
||||
AuthTypeSASLKerberosV4 = 1 << 7,
|
||||
AuthTypeXOAuth2 = 1 << 8,
|
||||
AuthTypeXOAuth2Outlook = 1 << 9,
|
||||
};
|
||||
|
||||
enum IMAPFolderFlag {
|
||||
IMAPFolderFlagNone = 0,
|
||||
IMAPFolderFlagMarked = 1 << 0,
|
||||
IMAPFolderFlagUnmarked = 1 << 1,
|
||||
IMAPFolderFlagNoSelect = 1 << 2,
|
||||
IMAPFolderFlagNoInferiors = 1 << 3,
|
||||
IMAPFolderFlagInbox = 1 << 4,
|
||||
IMAPFolderFlagSentMail = 1 << 5,
|
||||
IMAPFolderFlagStarred = 1 << 6,
|
||||
IMAPFolderFlagAllMail = 1 << 7,
|
||||
IMAPFolderFlagTrash = 1 << 8,
|
||||
IMAPFolderFlagDrafts = 1 << 9,
|
||||
IMAPFolderFlagSpam = 1 << 10,
|
||||
IMAPFolderFlagImportant = 1 << 11,
|
||||
IMAPFolderFlagArchive = 1 << 12,
|
||||
IMAPFolderFlagAll = IMAPFolderFlagAllMail,
|
||||
IMAPFolderFlagJunk = IMAPFolderFlagSpam,
|
||||
IMAPFolderFlagFlagged = IMAPFolderFlagStarred,
|
||||
IMAPFolderFlagFolderTypeMask = IMAPFolderFlagInbox | IMAPFolderFlagSentMail | IMAPFolderFlagStarred | IMAPFolderFlagAllMail |
|
||||
IMAPFolderFlagTrash| IMAPFolderFlagDrafts | IMAPFolderFlagSpam | IMAPFolderFlagImportant | IMAPFolderFlagArchive,
|
||||
};
|
||||
|
||||
enum MessageFlag {
|
||||
MessageFlagNone = 0,
|
||||
MessageFlagSeen = 1 << 0,
|
||||
MessageFlagAnswered = 1 << 1,
|
||||
MessageFlagFlagged = 1 << 2,
|
||||
MessageFlagDeleted = 1 << 3,
|
||||
MessageFlagDraft = 1 << 4,
|
||||
MessageFlagMDNSent = 1 << 5,
|
||||
MessageFlagForwarded = 1 << 6,
|
||||
MessageFlagSubmitPending = 1 << 7,
|
||||
MessageFlagSubmitted = 1 << 8,
|
||||
MessageFlagMaskAll = MessageFlagSeen | MessageFlagAnswered | MessageFlagFlagged |
|
||||
MessageFlagDeleted | MessageFlagDraft | MessageFlagMDNSent | MessageFlagForwarded |
|
||||
MessageFlagSubmitPending | MessageFlagSubmitted,
|
||||
} ;
|
||||
|
||||
enum IMAPMessagesRequestKind {
|
||||
IMAPMessagesRequestKindUid = 0, // This is the default and it's always fetched
|
||||
IMAPMessagesRequestKindFlags = 1 << 0,
|
||||
IMAPMessagesRequestKindHeaders = 1 << 1,
|
||||
IMAPMessagesRequestKindStructure = 1 << 2,
|
||||
IMAPMessagesRequestKindInternalDate = 1 << 3,
|
||||
IMAPMessagesRequestKindFullHeaders = 1 << 4,
|
||||
IMAPMessagesRequestKindHeaderSubject = 1 << 5,
|
||||
IMAPMessagesRequestKindGmailLabels = 1 << 6,
|
||||
IMAPMessagesRequestKindGmailMessageID = 1 << 7,
|
||||
IMAPMessagesRequestKindGmailThreadID = 1 << 8,
|
||||
IMAPMessagesRequestKindExtraHeaders = 1 << 9,
|
||||
IMAPMessagesRequestKindSize = 1 << 10,
|
||||
};
|
||||
|
||||
enum IMAPFetchRequestType {
|
||||
IMAPFetchRequestTypeUID = 0,
|
||||
IMAPFetchRequestTypeSequence = 1
|
||||
};
|
||||
|
||||
enum IMAPStoreFlagsRequestKind {
|
||||
IMAPStoreFlagsRequestKindAdd,
|
||||
IMAPStoreFlagsRequestKindRemove,
|
||||
IMAPStoreFlagsRequestKindSet,
|
||||
};
|
||||
|
||||
enum IMAPWorkaround {
|
||||
IMAPWorkaroundGmail = 1 << 0,
|
||||
IMAPWorkaroundYahoo = 1 << 1,
|
||||
IMAPWorkaroundExchange2003 = 1 << 2,
|
||||
};
|
||||
|
||||
enum IMAPCapability {
|
||||
IMAPCapabilityACL,
|
||||
IMAPCapabilityBinary,
|
||||
IMAPCapabilityCatenate,
|
||||
IMAPCapabilityChildren,
|
||||
IMAPCapabilityCompressDeflate,
|
||||
IMAPCapabilityCondstore,
|
||||
IMAPCapabilityEnable,
|
||||
IMAPCapabilityIdle,
|
||||
IMAPCapabilityId,
|
||||
IMAPCapabilityLiteralPlus,
|
||||
IMAPCapabilityMultiAppend,
|
||||
IMAPCapabilityNamespace,
|
||||
IMAPCapabilityQResync,
|
||||
IMAPCapabilityQuota,
|
||||
IMAPCapabilitySort,
|
||||
IMAPCapabilityStartTLS,
|
||||
IMAPCapabilityThreadOrderedSubject,
|
||||
IMAPCapabilityThreadReferences,
|
||||
IMAPCapabilityUIDPlus,
|
||||
IMAPCapabilityUnselect,
|
||||
IMAPCapabilityXList,
|
||||
IMAPCapabilityAuthAnonymous,
|
||||
IMAPCapabilityAuthCRAMMD5,
|
||||
IMAPCapabilityAuthDigestMD5,
|
||||
IMAPCapabilityAuthExternal,
|
||||
IMAPCapabilityAuthGSSAPI,
|
||||
IMAPCapabilityAuthKerberosV4,
|
||||
IMAPCapabilityAuthLogin,
|
||||
IMAPCapabilityAuthNTLM,
|
||||
IMAPCapabilityAuthOTP,
|
||||
IMAPCapabilityAuthPlain,
|
||||
IMAPCapabilityAuthSKey,
|
||||
IMAPCapabilityAuthSRP,
|
||||
IMAPCapabilityXOAuth2,
|
||||
IMAPCapabilityGmail,
|
||||
};
|
||||
|
||||
enum POPCapability {
|
||||
POPCapabilityNone,
|
||||
POPCapabilityStartTLS,
|
||||
POPCapabilityTop,
|
||||
POPCapabilityUser,
|
||||
POPCapabilityRespCodes,
|
||||
POPCapabilityPipelining,
|
||||
POPCapabilityUIDL,
|
||||
POPCapabilitySASL,
|
||||
POPCapabilityAuthAnonymous,
|
||||
POPCapabilityAuthCRAMMD5,
|
||||
POPCapabilityAuthDigestMD5,
|
||||
POPCapabilityAuthExternal,
|
||||
POPCapabilityAuthGSSAPI,
|
||||
POPCapabilityAuthKerberosV4,
|
||||
POPCapabilityAuthLogin,
|
||||
POPCapabilityAuthNTLM,
|
||||
POPCapabilityAuthOTP,
|
||||
POPCapabilityAuthPlain,
|
||||
POPCapabilityAuthSKey,
|
||||
POPCapabilityAuthSRP,
|
||||
};
|
||||
|
||||
enum Encoding {
|
||||
Encoding7Bit = 0, // should match MAILIMAP_BODY_FLD_ENC_7BIT
|
||||
Encoding8Bit = 1, // should match MAILIMAP_BODY_FLD_ENC_8BIT
|
||||
EncodingBinary = 2, // should match MAILIMAP_BODY_FLD_ENC_BINARY
|
||||
EncodingBase64 = 3, // should match MAILIMAP_BODY_FLD_ENC_BASE64
|
||||
EncodingQuotedPrintable = 4, // should match MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE
|
||||
EncodingOther = 5, // should match MAILIMAP_BODY_FLD_ENC_OTHER
|
||||
// negative values should be used for other encoding
|
||||
EncodingUUEncode = -1
|
||||
};
|
||||
|
||||
enum IMAPSearchKind {
|
||||
IMAPSearchKindAll,
|
||||
IMAPSearchKindNone,
|
||||
IMAPSearchKindFrom,
|
||||
IMAPSearchKindTo,
|
||||
IMAPSearchKindCc,
|
||||
IMAPSearchKindBcc,
|
||||
IMAPSearchKindRecipient, // Recipient is the combination of To, Cc and Bcc
|
||||
IMAPSearchKindSubject,
|
||||
IMAPSearchKindContent,
|
||||
IMAPSearchKindBody,
|
||||
IMAPSearchKindUIDs,
|
||||
IMAPSearchKindHeader,
|
||||
IMAPSearchKindRead,
|
||||
IMAPSearchKindUnread,
|
||||
IMAPSearchKindFlagged,
|
||||
IMAPSearchKindUnflagged,
|
||||
IMAPSearchKindAnswered,
|
||||
IMAPSearchKindUnanswered,
|
||||
IMAPSearchKindDraft,
|
||||
IMAPSearchKindUndraft,
|
||||
IMAPSearchKindDeleted,
|
||||
IMAPSearchKindSpam,
|
||||
IMAPSearchKindBeforeDate,
|
||||
IMAPSearchKindOnDate,
|
||||
IMAPSearchKindSinceDate,
|
||||
IMAPSearchKindBeforeReceivedDate,
|
||||
IMAPSearchKindOnReceivedDate,
|
||||
IMAPSearchKindSinceReceivedDate,
|
||||
IMAPSearchKindSizeLarger,
|
||||
IMAPSearchKindSizeSmaller,
|
||||
IMAPSearchKindGmailThreadID,
|
||||
IMAPSearchKindGmailMessageID,
|
||||
IMAPSearchKindGmailRaw,
|
||||
IMAPSearchKindOr,
|
||||
IMAPSearchKindAnd,
|
||||
IMAPSearchKindNot,
|
||||
};
|
||||
|
||||
enum ErrorCode {
|
||||
ErrorNone,
|
||||
ErrorConnection,
|
||||
ErrorTLSNotAvailable,
|
||||
ErrorParse,
|
||||
ErrorCertificate,
|
||||
ErrorAuthentication,
|
||||
ErrorGmailIMAPNotEnabled,
|
||||
ErrorGmailExceededBandwidthLimit,
|
||||
ErrorGmailTooManySimultaneousConnections,
|
||||
ErrorMobileMeMoved,
|
||||
ErrorYahooUnavailable,
|
||||
ErrorNonExistantFolder,
|
||||
ErrorRename,
|
||||
ErrorDelete,
|
||||
ErrorCreate,
|
||||
ErrorSubscribe,
|
||||
ErrorAppend,
|
||||
ErrorCopy,
|
||||
ErrorExpunge,
|
||||
ErrorFetch,
|
||||
ErrorIdle,
|
||||
ErrorIdentity,
|
||||
ErrorNamespace,
|
||||
ErrorStore,
|
||||
ErrorCapability,
|
||||
ErrorStartTLSNotAvailable,
|
||||
ErrorSendMessageIllegalAttachment,
|
||||
ErrorStorageLimit,
|
||||
ErrorSendMessageNotAllowed,
|
||||
ErrorNeedsConnectToWebmail,
|
||||
ErrorSendMessage,
|
||||
ErrorAuthenticationRequired,
|
||||
ErrorFetchMessageList,
|
||||
ErrorDeleteMessage,
|
||||
ErrorInvalidAccount,
|
||||
ErrorFile,
|
||||
ErrorCompression,
|
||||
ErrorNoSender,
|
||||
ErrorNoRecipient,
|
||||
ErrorNoop,
|
||||
};
|
||||
|
||||
enum PartType {
|
||||
PartTypeSingle,
|
||||
PartTypeMessage,
|
||||
PartTypeMultipartMixed,
|
||||
PartTypeMultipartRelated,
|
||||
PartTypeMultipartAlternative,
|
||||
PartTypeMultipartSigned,
|
||||
};
|
||||
|
||||
// Private type - It should not be used directly.
|
||||
enum IMAPMessageRenderingType {
|
||||
IMAPMessageRenderingTypeHTML,
|
||||
IMAPMessageRenderingTypeHTMLBody,
|
||||
IMAPMessageRenderingTypePlainText,
|
||||
IMAPMessageRenderingTypePlainTextBody,
|
||||
IMAPMessageRenderingTypePlainTextBodyAndStripWhitespace,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user