diff options
author | CodaFi <devteam.codafi@gmail.com> | 2013-12-08 13:28:59 -0700 |
---|---|---|
committer | CodaFi <devteam.codafi@gmail.com> | 2013-12-08 13:28:59 -0700 |
commit | 87f3cb5765f961d7a7fec734dd890ff913b46393 (patch) | |
tree | d872306d4ed374c00101d2319fdf31ccf058cbbb /src | |
parent | f3eb11eec145a5db4e76bca53b6f6b05566e674e (diff) |
Unify Project Style
Diffstat (limited to 'src')
137 files changed, 2294 insertions, 2238 deletions
diff --git a/src/async/imap/MCIMAPAppendMessageOperation.h b/src/async/imap/MCIMAPAppendMessageOperation.h index 90834c1f..4f210ac8 100644 --- a/src/async/imap/MCIMAPAppendMessageOperation.h +++ b/src/async/imap/MCIMAPAppendMessageOperation.h @@ -32,13 +32,14 @@ namespace mailcore { public: // subclass behavior virtual void main(); - + private: Data * mMessageData; MessageFlag mFlags; uint32_t mCreatedUID; }; + } #endif diff --git a/src/async/imap/MCIMAPAsyncConnection.cc b/src/async/imap/MCIMAPAsyncConnection.cc index 4909310f..8403b3ed 100755 --- a/src/async/imap/MCIMAPAsyncConnection.cc +++ b/src/async/imap/MCIMAPAsyncConnection.cc @@ -43,7 +43,8 @@ using namespace mailcore; namespace mailcore { - class IMAPOperationQueueCallback : public Object, public OperationQueueCallback { + + class IMAPOperationQueueCallback : public Object, public OperationQueueCallback { public: IMAPOperationQueueCallback(IMAPAsyncConnection * connection) { mConnection = connection; @@ -86,6 +87,7 @@ namespace mailcore { private: IMAPAsyncConnection * mConnection; }; + } IMAPAsyncConnection::IMAPAsyncConnection() diff --git a/src/async/imap/MCIMAPAsyncConnection.h b/src/async/imap/MCIMAPAsyncConnection.h index b975ed69..ef6893c8 100755 --- a/src/async/imap/MCIMAPAsyncConnection.h +++ b/src/async/imap/MCIMAPAsyncConnection.h @@ -178,6 +178,7 @@ namespace mailcore { virtual bool isQueueRunning(); virtual void setQueueRunning(bool running); }; + } #endif diff --git a/src/async/imap/MCIMAPAsyncSession.h b/src/async/imap/MCIMAPAsyncSession.h index fa29131a..6870d739 100755 --- a/src/async/imap/MCIMAPAsyncSession.h +++ b/src/async/imap/MCIMAPAsyncSession.h @@ -184,6 +184,7 @@ namespace mailcore { virtual IMAPAsyncConnection * matchingSessionForFolder(String * folder); virtual IMAPAsyncConnection * availableSession(); }; + } #endif diff --git a/src/async/imap/MCIMAPCapabilityOperation.h b/src/async/imap/MCIMAPCapabilityOperation.h index 82a51d93..7e1e7386 100644 --- a/src/async/imap/MCIMAPCapabilityOperation.h +++ b/src/async/imap/MCIMAPCapabilityOperation.h @@ -30,6 +30,7 @@ namespace mailcore { private: IndexSet * mCapabilities; }; + } #endif diff --git a/src/async/imap/MCIMAPCheckAccountOperation.h b/src/async/imap/MCIMAPCheckAccountOperation.h index 78c95d52..a1525500 100644 --- a/src/async/imap/MCIMAPCheckAccountOperation.h +++ b/src/async/imap/MCIMAPCheckAccountOperation.h @@ -20,6 +20,7 @@ namespace mailcore { public: // subclass behavior virtual void main(); }; + } #endif diff --git a/src/async/imap/MCIMAPConnectOperation.h b/src/async/imap/MCIMAPConnectOperation.h index a5d3c035..e2ecebb0 100644 --- a/src/async/imap/MCIMAPConnectOperation.h +++ b/src/async/imap/MCIMAPConnectOperation.h @@ -19,6 +19,7 @@ namespace mailcore { public: // subclass behavior virtual void main(); }; + } #endif diff --git a/src/async/imap/MCIMAPCopyMessagesOperation.h b/src/async/imap/MCIMAPCopyMessagesOperation.h index 06f1eff8..4267d348 100644 --- a/src/async/imap/MCIMAPCopyMessagesOperation.h +++ b/src/async/imap/MCIMAPCopyMessagesOperation.h @@ -38,6 +38,7 @@ namespace mailcore { String * mDestFolder; IndexSet * mDestUids; }; + } #endif diff --git a/src/async/imap/MCIMAPCreateFolderOperation.h b/src/async/imap/MCIMAPCreateFolderOperation.h index 8aa360ca..2116df08 100644 --- a/src/async/imap/MCIMAPCreateFolderOperation.h +++ b/src/async/imap/MCIMAPCreateFolderOperation.h @@ -23,6 +23,7 @@ namespace mailcore { public: // subclass behavior virtual void main(); }; + } #endif diff --git a/src/async/imap/MCIMAPDeleteFolderOperation.h b/src/async/imap/MCIMAPDeleteFolderOperation.h index 5644cf84..3d350eb0 100644 --- a/src/async/imap/MCIMAPDeleteFolderOperation.h +++ b/src/async/imap/MCIMAPDeleteFolderOperation.h @@ -23,6 +23,7 @@ namespace mailcore { public: // subclass behavior virtual void main(); }; + } #endif diff --git a/src/async/imap/MCIMAPDisconnectOperation.h b/src/async/imap/MCIMAPDisconnectOperation.h index 5d572def..2bd00c5e 100644 --- a/src/async/imap/MCIMAPDisconnectOperation.h +++ b/src/async/imap/MCIMAPDisconnectOperation.h @@ -25,6 +25,7 @@ namespace mailcore { public: // subclass behavior virtual void main(); }; + } #endif diff --git a/src/async/imap/MCIMAPExpungeOperation.h b/src/async/imap/MCIMAPExpungeOperation.h index 270eac60..7e9df62e 100644 --- a/src/async/imap/MCIMAPExpungeOperation.h +++ b/src/async/imap/MCIMAPExpungeOperation.h @@ -24,6 +24,7 @@ namespace mailcore { public: // subclass behavior virtual void main(); }; + } #endif diff --git a/src/async/imap/MCIMAPFetchContentOperation.h b/src/async/imap/MCIMAPFetchContentOperation.h index 7de797ae..0e3718d4 100644 --- a/src/async/imap/MCIMAPFetchContentOperation.h +++ b/src/async/imap/MCIMAPFetchContentOperation.h @@ -43,6 +43,7 @@ namespace mailcore { Data * mData; }; + } #endif diff --git a/src/async/imap/MCIMAPFetchFoldersOperation.h b/src/async/imap/MCIMAPFetchFoldersOperation.h index 057df493..09d724aa 100644 --- a/src/async/imap/MCIMAPFetchFoldersOperation.h +++ b/src/async/imap/MCIMAPFetchFoldersOperation.h @@ -37,6 +37,7 @@ namespace mailcore { Array * mFolders; }; + } #endif diff --git a/src/async/imap/MCIMAPFetchMessagesOperation.h b/src/async/imap/MCIMAPFetchMessagesOperation.h index 2a57e44c..ec9aa0c4 100644 --- a/src/async/imap/MCIMAPFetchMessagesOperation.h +++ b/src/async/imap/MCIMAPFetchMessagesOperation.h @@ -53,6 +53,7 @@ namespace mailcore { uint64_t mModSequenceValue; }; + } #endif diff --git a/src/async/imap/MCIMAPFetchNamespaceOperation.h b/src/async/imap/MCIMAPFetchNamespaceOperation.h index a1e32ec7..1138e62f 100644 --- a/src/async/imap/MCIMAPFetchNamespaceOperation.h +++ b/src/async/imap/MCIMAPFetchNamespaceOperation.h @@ -31,6 +31,7 @@ namespace mailcore { HashMap * mNamespaces; }; + } #endif diff --git a/src/async/imap/MCIMAPFolderInfoOperation.cc b/src/async/imap/MCIMAPFolderInfoOperation.cc index c6bba891..8ca500f3 100644 --- a/src/async/imap/MCIMAPFolderInfoOperation.cc +++ b/src/async/imap/MCIMAPFolderInfoOperation.cc @@ -73,7 +73,7 @@ void IMAPFolderInfoOperation::main() mModSequenceValue = session()->session()->modSequenceValue(); mMessageCount = session()->session()->lastFolderMessageCount(); mFirstUnseenUid = session()->session()->firstUnseenUid(); - + setError(error); } diff --git a/src/async/imap/MCIMAPIdentityOperation.h b/src/async/imap/MCIMAPIdentityOperation.h index 16f592a5..9426e092 100644 --- a/src/async/imap/MCIMAPIdentityOperation.h +++ b/src/async/imap/MCIMAPIdentityOperation.h @@ -37,6 +37,7 @@ namespace mailcore { IMAPIdentity * mServerIdentity; }; + } #endif diff --git a/src/async/imap/MCIMAPIdleOperation.cc b/src/async/imap/MCIMAPIdleOperation.cc index f10518f5..7e7eaeb3 100644 --- a/src/async/imap/MCIMAPIdleOperation.cc +++ b/src/async/imap/MCIMAPIdleOperation.cc @@ -49,11 +49,11 @@ void IMAPIdleOperation::main() { ErrorCode error; session()->session()->selectIfNeeded(folder(), &error); - if (error != ErrorNone) { + if (error != ErrorNone) { setError(error); return; } - + performMethodOnMainThread((Object::Method) &IMAPIdleOperation::prepare, NULL, true); if (!mSetupSuccess) { diff --git a/src/async/imap/MCIMAPIdleOperation.h b/src/async/imap/MCIMAPIdleOperation.h index 32ed0877..37e550b5 100644 --- a/src/async/imap/MCIMAPIdleOperation.h +++ b/src/async/imap/MCIMAPIdleOperation.h @@ -35,6 +35,7 @@ namespace mailcore { void prepare(); void unprepare(); }; + } #endif diff --git a/src/async/imap/MCIMAPMessageRenderingOperation.h b/src/async/imap/MCIMAPMessageRenderingOperation.h index 9840fd88..6c75c373 100644 --- a/src/async/imap/MCIMAPMessageRenderingOperation.h +++ b/src/async/imap/MCIMAPMessageRenderingOperation.h @@ -40,6 +40,7 @@ namespace mailcore { IMAPMessage * mMessage; }; + } #endif diff --git a/src/async/imap/MCIMAPMultiDisconnectOperation.h b/src/async/imap/MCIMAPMultiDisconnectOperation.h index 673d19e3..d2d132c0 100644 --- a/src/async/imap/MCIMAPMultiDisconnectOperation.h +++ b/src/async/imap/MCIMAPMultiDisconnectOperation.h @@ -33,6 +33,7 @@ namespace mailcore { Array * _operations; unsigned int _count; }; + } #endif diff --git a/src/async/imap/MCIMAPNoopOperation.h b/src/async/imap/MCIMAPNoopOperation.h index 4ceff687..935f977d 100644 --- a/src/async/imap/MCIMAPNoopOperation.h +++ b/src/async/imap/MCIMAPNoopOperation.h @@ -24,6 +24,7 @@ namespace mailcore { public: // subclass behavior virtual void main(); }; + } #endif diff --git a/src/async/imap/MCIMAPOperation.h b/src/async/imap/MCIMAPOperation.h index e7dcb9a5..29b0782c 100644 --- a/src/async/imap/MCIMAPOperation.h +++ b/src/async/imap/MCIMAPOperation.h @@ -50,7 +50,7 @@ namespace mailcore { ErrorCode mError; private: - virtual void bodyProgress(IMAPSession * session, unsigned int current, unsigned int maximum); + 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); diff --git a/src/async/imap/MCIMAPQuotaOperation.h b/src/async/imap/MCIMAPQuotaOperation.h index 5cef943c..1c8b737a 100644 --- a/src/async/imap/MCIMAPQuotaOperation.h +++ b/src/async/imap/MCIMAPQuotaOperation.h @@ -32,6 +32,7 @@ namespace mailcore { uint32_t mLimit; uint32_t mUsage; }; + } #endif diff --git a/src/async/imap/MCIMAPRenameFolderOperation.h b/src/async/imap/MCIMAPRenameFolderOperation.h index 5db74d4b..dff944c4 100644 --- a/src/async/imap/MCIMAPRenameFolderOperation.h +++ b/src/async/imap/MCIMAPRenameFolderOperation.h @@ -31,6 +31,7 @@ namespace mailcore { String * mOtherName; }; + } #endif diff --git a/src/async/imap/MCIMAPSearchOperation.h b/src/async/imap/MCIMAPSearchOperation.h index ca0c174d..4cacf576 100644 --- a/src/async/imap/MCIMAPSearchOperation.h +++ b/src/async/imap/MCIMAPSearchOperation.h @@ -46,6 +46,7 @@ namespace mailcore { IndexSet * mUids; }; + } #endif diff --git a/src/async/imap/MCIMAPStoreFlagsOperation.h b/src/async/imap/MCIMAPStoreFlagsOperation.h index e4f0f074..0048283c 100644 --- a/src/async/imap/MCIMAPStoreFlagsOperation.h +++ b/src/async/imap/MCIMAPStoreFlagsOperation.h @@ -39,6 +39,7 @@ namespace mailcore { MessageFlag mFlags; }; + } #endif diff --git a/src/async/imap/MCIMAPStoreLabelsOperation.h b/src/async/imap/MCIMAPStoreLabelsOperation.h index 117a0a83..77d94cab 100644 --- a/src/async/imap/MCIMAPStoreLabelsOperation.h +++ b/src/async/imap/MCIMAPStoreLabelsOperation.h @@ -39,6 +39,7 @@ namespace mailcore { Array * /* String */ mLabels; }; + } #endif diff --git a/src/async/imap/MCIMAPSubscribeFolderOperation.h b/src/async/imap/MCIMAPSubscribeFolderOperation.h index 56a6a39a..7cd79eab 100644 --- a/src/async/imap/MCIMAPSubscribeFolderOperation.h +++ b/src/async/imap/MCIMAPSubscribeFolderOperation.h @@ -31,6 +31,7 @@ namespace mailcore { bool mUnsubscribeEnabled; }; + } #endif diff --git a/src/async/pop/MCPOPAsyncSession.cc b/src/async/pop/MCPOPAsyncSession.cc index bb7425e2..07420c0c 100644 --- a/src/async/pop/MCPOPAsyncSession.cc +++ b/src/async/pop/MCPOPAsyncSession.cc @@ -59,6 +59,7 @@ namespace mailcore { private: POPAsyncSession * mSession; }; + } POPAsyncSession::POPAsyncSession() diff --git a/src/async/pop/MCPOPAsyncSession.h b/src/async/pop/MCPOPAsyncSession.h index a37b80ea..b863be11 100644 --- a/src/async/pop/MCPOPAsyncSession.h +++ b/src/async/pop/MCPOPAsyncSession.h @@ -85,6 +85,7 @@ namespace mailcore { virtual POPSession * session(); virtual void logConnection(ConnectionLogType logType, Data * buffer); }; + } #endif diff --git a/src/async/pop/MCPOPFetchHeaderOperation.h b/src/async/pop/MCPOPFetchHeaderOperation.h index d3635eb9..65a86849 100644 --- a/src/async/pop/MCPOPFetchHeaderOperation.h +++ b/src/async/pop/MCPOPFetchHeaderOperation.h @@ -36,6 +36,7 @@ namespace mailcore { MessageHeader * mHeader; }; + } #endif diff --git a/src/async/pop/MCPOPFetchMessageOperation.h b/src/async/pop/MCPOPFetchMessageOperation.h index 877e4380..79f9c7f4 100644 --- a/src/async/pop/MCPOPFetchMessageOperation.h +++ b/src/async/pop/MCPOPFetchMessageOperation.h @@ -33,6 +33,7 @@ namespace mailcore { Data * mData; }; + } #endif diff --git a/src/async/pop/MCPOPFetchMessagesOperation.h b/src/async/pop/MCPOPFetchMessagesOperation.h index 74c97d4d..08ac8b59 100644 --- a/src/async/pop/MCPOPFetchMessagesOperation.h +++ b/src/async/pop/MCPOPFetchMessagesOperation.h @@ -15,6 +15,7 @@ #ifdef __cplusplus namespace mailcore { + class POPFetchMessagesOperation : public POPOperation { public: POPFetchMessagesOperation(); @@ -28,6 +29,7 @@ namespace mailcore { private: Array * /* POPMessageInfo */ mMessages; }; + } #endif diff --git a/src/async/pop/MCPOPOperation.h b/src/async/pop/MCPOPOperation.h index 8134d6a5..ca791fbe 100644 --- a/src/async/pop/MCPOPOperation.h +++ b/src/async/pop/MCPOPOperation.h @@ -41,7 +41,7 @@ namespace mailcore { POPOperationCallback * mPopCallback; ErrorCode mError; private: - virtual void bodyProgress(POPSession * session, unsigned int current, unsigned int maximum); + virtual void bodyProgress(POPSession * session, unsigned int current, unsigned int maximum); virtual void bodyProgressOnMainThread(void * context); }; diff --git a/src/async/smtp/MCSMTPAsyncSession.cc b/src/async/smtp/MCSMTPAsyncSession.cc index 6fda09e1..e24efc09 100644 --- a/src/async/smtp/MCSMTPAsyncSession.cc +++ b/src/async/smtp/MCSMTPAsyncSession.cc @@ -11,6 +11,7 @@ using namespace mailcore; namespace mailcore { + class SMTPOperationQueueCallback : public Object, public OperationQueueCallback { public: SMTPOperationQueueCallback(SMTPAsyncSession * session) { @@ -50,6 +51,7 @@ namespace mailcore { private: SMTPAsyncSession * mSession; }; + } SMTPAsyncSession::SMTPAsyncSession() diff --git a/src/async/smtp/MCSMTPAsyncSession.h b/src/async/smtp/MCSMTPAsyncSession.h index d5e93ecf..63630b77 100644 --- a/src/async/smtp/MCSMTPAsyncSession.h +++ b/src/async/smtp/MCSMTPAsyncSession.h @@ -8,14 +8,14 @@ #ifdef __cplusplus namespace mailcore { - + class MessageBuilder; class SMTPOperation; class SMTPSession; class Address; class SMTPOperationQueueCallback; class SMTPConnectionLogger; - + class SMTPAsyncSession : public Object { public: SMTPAsyncSession(); @@ -67,7 +67,7 @@ namespace mailcore { virtual void tryAutomaticDisconnect(); virtual void logConnection(ConnectionLogType logType, Data * buffer); - private: + private: SMTPSession * mSession; OperationQueue * mQueue; SMTPOperationQueueCallback * mQueueCallback; diff --git a/src/async/smtp/MCSMTPDisconnectOperation.h b/src/async/smtp/MCSMTPDisconnectOperation.h index 8f160029..bd35674f 100644 --- a/src/async/smtp/MCSMTPDisconnectOperation.h +++ b/src/async/smtp/MCSMTPDisconnectOperation.h @@ -25,6 +25,7 @@ namespace mailcore { public: // subclass behavior virtual void main(); }; + } #endif diff --git a/src/async/smtp/MCSMTPNoopOperation.h b/src/async/smtp/MCSMTPNoopOperation.h index 8c97fa0e..53c5d864 100644 --- a/src/async/smtp/MCSMTPNoopOperation.h +++ b/src/async/smtp/MCSMTPNoopOperation.h @@ -16,7 +16,7 @@ #ifdef __cplusplus namespace mailcore { - + class SMTPNoopOperation : public SMTPOperation { public: SMTPNoopOperation(); diff --git a/src/async/smtp/MCSMTPOperation.cc b/src/async/smtp/MCSMTPOperation.cc index 0661ce9f..c0430340 100644 --- a/src/async/smtp/MCSMTPOperation.cc +++ b/src/async/smtp/MCSMTPOperation.cc @@ -82,7 +82,7 @@ void SMTPOperation::bodyProgressOnMainThread(void * ctx) release(); return; } - + struct progressContext * context = (struct progressContext *) ctx; if (mSmtpCallback != NULL) { mSmtpCallback->bodyProgress(this, context->current, context->maximum); diff --git a/src/async/smtp/MCSMTPOperation.h b/src/async/smtp/MCSMTPOperation.h index 1f7a2c79..7f6c9e7b 100644 --- a/src/async/smtp/MCSMTPOperation.h +++ b/src/async/smtp/MCSMTPOperation.h @@ -16,7 +16,7 @@ #ifdef __cplusplus namespace mailcore { - + class SMTPAsyncSession; class SMTPOperationCallback; diff --git a/src/async/smtp/MCSMTPOperationCallback.h b/src/async/smtp/MCSMTPOperationCallback.h index 37a2b486..cf5630ec 100644 --- a/src/async/smtp/MCSMTPOperationCallback.h +++ b/src/async/smtp/MCSMTPOperationCallback.h @@ -14,12 +14,13 @@ namespace mailcore { - class SMTPOperation; + class SMTPOperation; + + class SMTPOperationCallback { + public: + virtual void bodyProgress(SMTPOperation * session, unsigned int current, unsigned int maximum) {}; + }; - class SMTPOperationCallback { - public: - virtual void bodyProgress(SMTPOperation * session, unsigned int current, unsigned int maximum) {}; - }; } #endif diff --git a/src/async/smtp/MCSMTPSendWithDataOperation.h b/src/async/smtp/MCSMTPSendWithDataOperation.h index 6c407bb3..ee325b54 100644 --- a/src/async/smtp/MCSMTPSendWithDataOperation.h +++ b/src/async/smtp/MCSMTPSendWithDataOperation.h @@ -17,7 +17,7 @@ #ifdef __cplusplus namespace mailcore { - + class SMTPSendWithDataOperation : public SMTPOperation { public: SMTPSendWithDataOperation(); @@ -41,6 +41,7 @@ namespace mailcore { Address * mFrom; }; + } #endif diff --git a/src/core/abstract/MCAbstractMessage.h b/src/core/abstract/MCAbstractMessage.h index 2c7766f8..c785f181 100644 --- a/src/core/abstract/MCAbstractMessage.h +++ b/src/core/abstract/MCAbstractMessage.h @@ -6,15 +6,15 @@ #ifdef __cplusplus namespace mailcore { - + class AbstractPart; class MessageHeader; - + class AbstractMessage : public Object { public: AbstractMessage(); virtual ~AbstractMessage(); - + virtual MessageHeader * header(); virtual void setHeader(MessageHeader * header); @@ -36,6 +36,7 @@ namespace mailcore { void init(); }; + } #endif diff --git a/src/core/abstract/MCAbstractMessagePart.h b/src/core/abstract/MCAbstractMessagePart.h index 1d975d62..45790f4a 100644 --- a/src/core/abstract/MCAbstractMessagePart.h +++ b/src/core/abstract/MCAbstractMessagePart.h @@ -37,6 +37,7 @@ namespace mailcore { MessageHeader * mHeader; void init(); }; + } #endif diff --git a/src/core/abstract/MCAbstractMultipart.h b/src/core/abstract/MCAbstractMultipart.h index b499f848..ecb514bf 100644 --- a/src/core/abstract/MCAbstractMultipart.h +++ b/src/core/abstract/MCAbstractMultipart.h @@ -31,6 +31,7 @@ namespace mailcore { Array * mParts; void init(); }; + } #endif diff --git a/src/core/abstract/MCAbstractPart.cc b/src/core/abstract/MCAbstractPart.cc index 3f9f7d0f..08cd83e3 100644 --- a/src/core/abstract/MCAbstractPart.cc +++ b/src/core/abstract/MCAbstractPart.cc @@ -179,40 +179,40 @@ void AbstractPart::setInlineAttachment(bool inlineAttachment) void AbstractPart::importIMAPFields(struct mailimap_body_fields * fields, struct mailimap_body_ext_1part * extension) { - if (fields->bd_parameter != NULL) { - clistiter * cur; - - for(cur = clist_begin(fields->bd_parameter->pa_list) ; cur != NULL ; - cur = clist_next(cur)) { - struct mailimap_single_body_fld_param * imap_param; - - imap_param = (struct mailimap_single_body_fld_param *) clist_content(cur); - - if (strcasecmp(imap_param->pa_name, "name") == 0) { + if (fields->bd_parameter != NULL) { + clistiter * cur; + + for(cur = clist_begin(fields->bd_parameter->pa_list) ; cur != NULL ; + cur = clist_next(cur)) { + struct mailimap_single_body_fld_param * imap_param; + + imap_param = (struct mailimap_single_body_fld_param *) clist_content(cur); + + if (strcasecmp(imap_param->pa_name, "name") == 0) { setFilename(String::stringByDecodingMIMEHeaderValue(imap_param->pa_value)); - } - else if (strcasecmp(imap_param->pa_name, "charset") == 0) { + } + else if (strcasecmp(imap_param->pa_name, "charset") == 0) { setCharset(String::stringByDecodingMIMEHeaderValue(imap_param->pa_value)); - } - } - } + } + } + } if (fields->bd_id != NULL) { - char * contentid; - size_t cur_token; - int r; - - cur_token = 0; - r = mailimf_msg_id_parse(fields->bd_id, strlen(fields->bd_id), + char * contentid; + size_t cur_token; + int r; + + cur_token = 0; + r = mailimf_msg_id_parse(fields->bd_id, strlen(fields->bd_id), &cur_token, &contentid); - if (r == MAILIMF_NO_ERROR) { - // msg id + if (r == MAILIMF_NO_ERROR) { + // msg id setContentID(String::stringWithUTF8Characters(contentid)); free(contentid); - } + } } if (fields->bd_description != NULL) { setContentDescription(String::stringWithUTF8Characters(fields->bd_description)); - } + } if (extension != NULL) { if (extension->bd_disposition != NULL) { @@ -264,15 +264,15 @@ AbstractPart * AbstractPart::partForUniqueID(String * uniqueID) String * AbstractPart::decodedStringForData(Data * data) { - String *lowerMimeType = mMimeType ? mMimeType->lowercaseString() : NULL; - - if (lowerMimeType && lowerMimeType->hasPrefix(MCSTR("text/"))) { - bool isHTML = lowerMimeType->isEqual(MCSTR("text/html")); - return data->stringWithDetectedCharset(mCharset, isHTML); - } - else { - return NULL; - } + String *lowerMimeType = mMimeType ? mMimeType->lowercaseString() : NULL; + + if (lowerMimeType && lowerMimeType->hasPrefix(MCSTR("text/"))) { + bool isHTML = lowerMimeType->isEqual(MCSTR("text/html")); + return data->stringWithDetectedCharset(mCharset, isHTML); + } + else { + return NULL; + } } void AbstractPart::applyUniquePartID() diff --git a/src/core/abstract/MCAbstractPart.h b/src/core/abstract/MCAbstractPart.h index b182850f..d1224c16 100644 --- a/src/core/abstract/MCAbstractPart.h +++ b/src/core/abstract/MCAbstractPart.h @@ -8,9 +8,9 @@ #ifdef __cplusplus namespace mailcore { - + class AbstractMessage; - + class AbstractPart : public Object { public: AbstractPart(); @@ -36,10 +36,10 @@ namespace mailcore { virtual String * contentLocation(); virtual void setContentLocation(String * contentLocation); - + virtual String * contentDescription(); virtual void setContentDescription(String * contentDescription); - + virtual bool isInlineAttachment(); virtual void setInlineAttachment(bool inlineAttachment); diff --git a/src/core/abstract/MCAddress.cc b/src/core/abstract/MCAddress.cc index e117c3f4..ff840691 100644 --- a/src/core/abstract/MCAddress.cc +++ b/src/core/abstract/MCAddress.cc @@ -48,18 +48,18 @@ Address * Address::addressWithMailbox(String * mailbox) Address * Address::addressWithIMFMailbox(struct mailimf_mailbox * mailbox) { Address * address; - + address = new Address(); - if (mailbox->mb_display_name != NULL) { + if (mailbox->mb_display_name != NULL) { address->setDisplayName(String::stringByDecodingMIMEHeaderValue(mailbox->mb_display_name)); - } - if (mailbox->mb_addr_spec != NULL) { - address->setMailbox(String::stringWithUTF8Characters(mailbox->mb_addr_spec)); - } + } + if (mailbox->mb_addr_spec != NULL) { + address->setMailbox(String::stringWithUTF8Characters(mailbox->mb_addr_spec)); + } if (address->mailbox() == NULL) { address->setMailbox(String::string()); } - + return (Address *) address->autorelease(); } @@ -129,18 +129,18 @@ Address * Address::addressWithRFC822String(String * RFC822String) Address * Address::addressWithNonEncodedIMFMailbox(struct mailimf_mailbox * mailbox) { Address * address; - + address = new Address(); - if (mailbox->mb_display_name != NULL) { + if (mailbox->mb_display_name != NULL) { address->setDisplayName(String::stringWithUTF8Characters(mailbox->mb_display_name)); - } - if (mailbox->mb_addr_spec != NULL) { - address->setMailbox(String::stringWithUTF8Characters(mailbox->mb_addr_spec)); - } + } + if (mailbox->mb_addr_spec != NULL) { + address->setMailbox(String::stringWithUTF8Characters(mailbox->mb_addr_spec)); + } if (address->mailbox() == NULL) { address->setMailbox(String::string()); } - + return (Address *) address->autorelease(); } @@ -166,44 +166,44 @@ Address * Address::addressWithNonEncodedRFC822String(String * nonEncodedRFC822St Array * Address::addressesWithRFC822String(String * string) { - const char * utf8String; - size_t currentIndex; - struct mailimf_address_list * addr_list; - Array * result; - int r; - + const char * utf8String; + size_t currentIndex; + struct mailimf_address_list * addr_list; + Array * result; + int r; + utf8String = string->UTF8Characters(); currentIndex = 0; - - r = mailimf_address_list_parse(utf8String, strlen(utf8String), ¤tIndex, &addr_list); + + r = mailimf_address_list_parse(utf8String, strlen(utf8String), ¤tIndex, &addr_list); if (r != MAILIMF_NO_ERROR) return NULL; - - result = lep_address_list_from_lep_addr(addr_list, 1); - mailimf_address_list_free(addr_list); - - return result; + + result = lep_address_list_from_lep_addr(addr_list, 1); + mailimf_address_list_free(addr_list); + + return result; } Array * Address::addressesWithNonEncodedRFC822String(String * string) { - const char * utf8String; - size_t currentIndex; - struct mailimf_address_list * addr_list; - Array * result; - int r; - + const char * utf8String; + size_t currentIndex; + struct mailimf_address_list * addr_list; + Array * result; + int r; + utf8String = string->UTF8Characters(); currentIndex = 0; - - r = mailimf_address_list_parse(utf8String, strlen(utf8String), ¤tIndex, &addr_list); + + r = mailimf_address_list_parse(utf8String, strlen(utf8String), ¤tIndex, &addr_list); if (r != MAILIMF_NO_ERROR) return NULL; - - result = lep_address_list_from_lep_addr(addr_list, 0); - mailimf_address_list_free(addr_list); - - return result; + + result = lep_address_list_from_lep_addr(addr_list, 0); + mailimf_address_list_free(addr_list); + + return result; } String * Address::RFC822StringForAddresses(Array * addresses) @@ -328,36 +328,36 @@ String * Address::mailbox() struct mailimf_address * Address::createIMFAddress() { - struct mailimf_mailbox * mailbox; - struct mailimf_address * result; - + struct mailimf_mailbox * mailbox; + struct mailimf_address * result; + mailbox = createIMFMailbox(); - result = mailimf_address_new(MAILIMF_ADDRESS_MAILBOX, mailbox, NULL); - - return result; + result = mailimf_address_new(MAILIMF_ADDRESS_MAILBOX, mailbox, NULL); + + return result; } struct mailimf_mailbox * Address::createIMFMailbox() { - struct mailimf_mailbox * result; - char * display_name; - char * addr_spec; - - display_name = NULL; - if (displayName() != NULL) { + struct mailimf_mailbox * result; + char * display_name; + char * addr_spec; + + display_name = NULL; + if (displayName() != NULL) { if (displayName()->length() > 0) { Data * data; - + data = displayName()->encodedAddressDisplayNameValue(); if (data->bytes() != NULL) { display_name = strdup(data->bytes()); } } } - addr_spec = strdup(mailbox()->UTF8Characters()); - result = mailimf_mailbox_new(display_name, addr_spec); - - return result; + addr_spec = strdup(mailbox()->UTF8Characters()); + result = mailimf_mailbox_new(display_name, addr_spec); + + return result; } String * Address::RFC822String() @@ -370,7 +370,7 @@ String * Address::RFC822String() String * result; mb = createIMFMailbox(); - + list = clist_new(); clist_append(list, mb); mb_list = mailimf_mailbox_list_new(list); @@ -395,11 +395,11 @@ String * Address::nonEncodedRFC822String() struct mailimf_mailbox_list * mb_list; clist * list; String * result; - char * display_name; - char * addr_spec; - - display_name = NULL; - if (displayName() != NULL) { + char * display_name; + char * addr_spec; + + display_name = NULL; + if (displayName() != NULL) { if (displayName()->length() > 0) { display_name = strdup(displayName()->UTF8Characters()); } @@ -430,68 +430,68 @@ String * Address::nonEncodedRFC822String() static Array * lep_address_list_from_lep_mailbox(struct mailimf_mailbox_list * mb_list, int encoded) { - Array * result; - clistiter * cur; - - result = Array::array(); - for(cur = clist_begin(mb_list->mb_list) ; cur != NULL ; cur = clist_next(cur)) { - struct mailimf_mailbox * mb; - Address * address; - - mb = (mailimf_mailbox *) clist_content(cur); - if (encoded) { - address = Address::addressWithIMFMailbox(mb); - } - else { - address = Address::addressWithNonEncodedIMFMailbox(mb); - } - result->addObject(address); - } - - return result; + Array * result; + clistiter * cur; + + result = Array::array(); + for(cur = clist_begin(mb_list->mb_list) ; cur != NULL ; cur = clist_next(cur)) { + struct mailimf_mailbox * mb; + Address * address; + + mb = (mailimf_mailbox *) clist_content(cur); + if (encoded) { + address = Address::addressWithIMFMailbox(mb); + } + else { + address = Address::addressWithNonEncodedIMFMailbox(mb); + } + result->addObject(address); + } + + return result; } static Array * lep_address_list_from_lep_addr(struct mailimf_address_list * addr_list, int encoded) { - Array * result; - clistiter * cur; - - result = Array::array(); - - for(cur = clist_begin(addr_list->ad_list) ; cur != NULL ; - cur = clist_next(cur)) { - struct mailimf_address * addr; - - addr = (mailimf_address *) clist_content(cur); - switch (addr->ad_type) { - case MAILIMF_ADDRESS_MAILBOX: - { - Address * address; - - if (encoded) { - address = Address::addressWithIMFMailbox(addr->ad_data.ad_mailbox); - } - else { - address = Address::addressWithNonEncodedIMFMailbox(addr->ad_data.ad_mailbox); - } - result->addObject(address); - break; - } - - case MAILIMF_ADDRESS_GROUP: - { - if (addr->ad_data.ad_group->grp_mb_list != NULL) { - Array * subArray; - - subArray = lep_address_list_from_lep_mailbox(addr->ad_data.ad_group->grp_mb_list, encoded); - result->addObjectsFromArray(subArray); - } - break; - } - } - } - - return result; + Array * result; + clistiter * cur; + + result = Array::array(); + + for(cur = clist_begin(addr_list->ad_list) ; cur != NULL ; + cur = clist_next(cur)) { + struct mailimf_address * addr; + + addr = (mailimf_address *) clist_content(cur); + switch (addr->ad_type) { + case MAILIMF_ADDRESS_MAILBOX: + { + Address * address; + + if (encoded) { + address = Address::addressWithIMFMailbox(addr->ad_data.ad_mailbox); + } + else { + address = Address::addressWithNonEncodedIMFMailbox(addr->ad_data.ad_mailbox); + } + result->addObject(address); + break; + } + + case MAILIMF_ADDRESS_GROUP: + { + if (addr->ad_data.ad_group->grp_mb_list != NULL) { + Array * subArray; + + subArray = lep_address_list_from_lep_mailbox(addr->ad_data.ad_group->grp_mb_list, encoded); + result->addObjectsFromArray(subArray); + } + break; + } + } + } + + return result; } static void * createObject() diff --git a/src/core/abstract/MCAddress.h b/src/core/abstract/MCAddress.h index 867ee02d..4c38ff4c 100644 --- a/src/core/abstract/MCAddress.h +++ b/src/core/abstract/MCAddress.h @@ -7,12 +7,12 @@ #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); @@ -26,10 +26,10 @@ namespace mailcore { virtual void setDisplayName(String * displayName); virtual String * displayName(); - + virtual void setMailbox(String * address); virtual String * mailbox(); - + virtual String * RFC822String(); virtual String * nonEncodedRFC822String(); @@ -57,7 +57,7 @@ namespace mailcore { String * mMailbox; void init(); }; - + } #endif diff --git a/src/core/abstract/MCMessageConstants.h b/src/core/abstract/MCMessageConstants.h index a8f0a056..59b65f5b 100644 --- a/src/core/abstract/MCMessageConstants.h +++ b/src/core/abstract/MCMessageConstants.h @@ -10,7 +10,7 @@ namespace mailcore { ConnectionTypeStartTLS = 1 << 1, ConnectionTypeTLS = 1 << 2, }; - + enum AuthType { AuthTypeSASLNone = 0, AuthTypeSASLCRAMMD5 = 1 << 0, @@ -23,7 +23,7 @@ namespace mailcore { AuthTypeSASLKerberosV4 = 1 << 7, AuthTypeXOAuth2 = 1 << 8, }; - + enum IMAPFolderFlag { IMAPFolderFlagNone = 0, IMAPFolderFlagMarked = 1 << 0, @@ -43,7 +43,7 @@ namespace mailcore { IMAPFolderFlagJunk = IMAPFolderFlagSpam, IMAPFolderFlagFlagged = IMAPFolderFlagStarred, }; - + enum MessageFlag { MessageFlagNone = 0, MessageFlagSeen = 1 << 0, @@ -56,7 +56,7 @@ namespace mailcore { MessageFlagSubmitPending = 1 << 7, MessageFlagSubmitted = 1 << 8, } ; - + enum IMAPMessagesRequestKind { IMAPMessagesRequestKindUid = 0, // This is the default and it's always fetched IMAPMessagesRequestKindFlags = 1 << 0, @@ -71,24 +71,24 @@ namespace mailcore { 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, @@ -126,7 +126,7 @@ namespace mailcore { IMAPCapabilityXOAuth2, IMAPCapabilityGmail, }; - + enum POPCapability { POPCapabilityNone, POPCapabilityStartTLS, @@ -149,7 +149,7 @@ namespace mailcore { POPCapabilityAuthSKey, POPCapabilityAuthSRP, }; - + enum Encoding { Encoding7Bit = 0, // should match MAILIMAP_BODY_FLD_ENC_7BIT Encoding8Bit = 1, // should match MAILIMAP_BODY_FLD_ENC_8BIT @@ -255,6 +255,7 @@ namespace mailcore { IMAPMessageRenderingTypePlainTextBody, IMAPMessageRenderingTypePlainTextBodyAndStripWhitespace, }; + } #endif diff --git a/src/core/abstract/MCMessageHeader.h b/src/core/abstract/MCMessageHeader.h index 828d3a47..3e4af198 100644 --- a/src/core/abstract/MCMessageHeader.h +++ b/src/core/abstract/MCMessageHeader.h @@ -8,9 +8,9 @@ #ifdef __cplusplus namespace mailcore { - + class Address; - + class MessageHeader : public Object { public: MessageHeader(); @@ -18,70 +18,70 @@ namespace mailcore { virtual void setMessageID(String * messageID); virtual String * messageID(); - + virtual void setReferences(Array * /* String */ references); virtual Array * /* String */ references(); - + virtual void setInReplyTo(Array * /* String */ inReplyTo); virtual Array * /* String */ inReplyTo(); - + virtual void setDate(time_t date); virtual time_t date(); - + virtual void setReceivedDate(time_t date); virtual time_t receivedDate(); - + virtual void setSender(Address * sender); virtual Address * sender(); - + virtual void setFrom(Address * from); virtual Address * from(); - + virtual void setTo(Array * /* Address */ to); virtual Array * /* Address */ to(); - + virtual void setCc(Array * /* Address */ cc); virtual Array * /* Address */ cc(); - + virtual void setBcc(Array * /* Address */ bcc); virtual Array * /* Address */ bcc(); - + virtual void setReplyTo(Array * /* Address */ replyTo); virtual Array * /* Address */ replyTo(); - + virtual void setSubject(String * subject); virtual String * subject(); - + virtual void setUserAgent(String * userAgent); virtual String * userAgent(); - + virtual void setExtraHeader(String *name, String * value); virtual void removeExtraHeader(String *name); virtual String * extraHeaderValueForName(String *name); virtual Array * allExtraHeadersNames(); - + String * extractedSubject(); virtual String * partialExtractedSubject(); virtual void importHeadersData(Data * data); - + virtual MessageHeader * replyHeader(bool replyAll, Array * addressesExcludedFromRecipient); virtual MessageHeader * forwardHeader(); - + public: // subclass behavior MessageHeader(MessageHeader * other); virtual String * description(); virtual Object * copy(); virtual HashMap * serializable(); virtual void importSerializable(HashMap * serializable); - + public: // private virtual void importIMAPEnvelope(struct mailimap_envelope * env); virtual void importIMAPReferences(Data * data); virtual void importIMAPInternalDate(struct mailimap_date_time * date); - + virtual struct mailimf_fields * createIMFFieldsAndFilterBcc(bool filterBcc); virtual void importIMFFields(struct mailimf_fields * fields); - + private: String * mMessageID; Array * /* String */ mReferences; @@ -100,7 +100,7 @@ namespace mailcore { void setExtraHeaders(HashMap *headers); Array * recipientWithReplyAll(bool replyAll, bool includeTo, bool includeCc, Array * senderEmails); }; - + } #endif diff --git a/src/core/basetypes/MCArray.h b/src/core/basetypes/MCArray.h index 392c4aff..cbf65b82 100644 --- a/src/core/basetypes/MCArray.h +++ b/src/core/basetypes/MCArray.h @@ -9,9 +9,9 @@ typedef struct carray_s carray; namespace mailcore { - + class String; - + class Array : public Object { public: Array(); @@ -19,7 +19,7 @@ namespace mailcore { static Array * array(); static Array * arrayWithObject(Object * obj); - + virtual unsigned int count(); virtual void addObject(Object * obj); virtual void removeObjectAtIndex(unsigned int idx); @@ -48,7 +48,7 @@ namespace mailcore { carray * mArray; void init(); }; - + } #endif diff --git a/src/core/basetypes/MCAutoreleasePool.h b/src/core/basetypes/MCAutoreleasePool.h index 1ba4b5d6..7feb52f5 100644 --- a/src/core/basetypes/MCAutoreleasePool.h +++ b/src/core/basetypes/MCAutoreleasePool.h @@ -10,32 +10,32 @@ typedef struct carray_s carray; namespace mailcore { - - class AutoreleasePool : public Object { - public: - AutoreleasePool(); - virtual ~AutoreleasePool(); - - static void autorelease(Object * obj); + + class AutoreleasePool : public Object { + public: + AutoreleasePool(); + virtual ~AutoreleasePool(); + + static void autorelease(Object * obj); public: // subclass behavior - virtual String * description(); + 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); + 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 - }; + }; } diff --git a/src/core/basetypes/MCConnectionLoggerUtils.h b/src/core/basetypes/MCConnectionLoggerUtils.h index 86f3c591..a48c8a07 100644 --- a/src/core/basetypes/MCConnectionLoggerUtils.h +++ b/src/core/basetypes/MCConnectionLoggerUtils.h @@ -12,7 +12,7 @@ #include <MailCore/MCConnectionLogger.h> namespace mailcore { - + ConnectionLogType getConnectionType(int log_type); bool isBufferFromLogType(int log_type); diff --git a/src/core/basetypes/MCData.cc b/src/core/basetypes/MCData.cc index 4ad2a524..b8520975 100644 --- a/src/core/basetypes/MCData.cc +++ b/src/core/basetypes/MCData.cc @@ -243,7 +243,7 @@ static bool isHintCharsetValid(String * hintCharset) String * Data::stringWithDetectedCharset(String * hintCharset, bool isHTML) { - String * result; + String * result; String * charset; if (isHintCharsetValid(hintCharset)) { @@ -307,7 +307,7 @@ String * Data::stringWithDetectedCharset(String * hintCharset, bool isHTML) result = MCSTR(""); } - return result; + return result; } String * Data::charsetWithFilteredHTMLWithoutHint(bool filterHTML) diff --git a/src/core/basetypes/MCData.h b/src/core/basetypes/MCData.h index 455ec73a..245ac0c4 100644 --- a/src/core/basetypes/MCData.h +++ b/src/core/basetypes/MCData.h @@ -8,9 +8,9 @@ #ifdef __cplusplus namespace mailcore { - + class String; - + class Data : public Object { public: Data(); diff --git a/src/core/basetypes/MCHTMLCleaner.cc b/src/core/basetypes/MCHTMLCleaner.cc index 7d45d3f2..45271c10 100644 --- a/src/core/basetypes/MCHTMLCleaner.cc +++ b/src/core/basetypes/MCHTMLCleaner.cc @@ -25,7 +25,7 @@ String * HTMLCleaner::cleanHTML(String * input) TidyBuffer errbuf; TidyBuffer docbuf; int rc; - + TidyDoc tdoc = tidyCreate(); tidyBufInit(&output); tidyBufInit(&errbuf); diff --git a/src/core/basetypes/MCHash.h b/src/core/basetypes/MCHash.h index 1ae547cd..bce93bfc 100644 --- a/src/core/basetypes/MCHash.h +++ b/src/core/basetypes/MCHash.h @@ -5,9 +5,9 @@ #ifdef __cplusplus namespace mailcore { - + unsigned int hashCompute(const char * key, unsigned int len); - + } #endif diff --git a/src/core/basetypes/MCHashMap.cc b/src/core/basetypes/MCHashMap.cc index ddd32fec..41266c1b 100644 --- a/src/core/basetypes/MCHashMap.cc +++ b/src/core/basetypes/MCHashMap.cc @@ -19,6 +19,7 @@ namespace mailcore { Object * value; HashMapCell * next; }; + } #define CHASH_DEFAULTSIZE 13 @@ -164,11 +165,11 @@ void HashMap::removeObjectForKey(Object * key) { unsigned int func, indx; HashMapIter * iter, * old; - + func = key->hash();; indx = func % mAllocated; - - /* look for the key in existing cells */ + + /* look for the key in existing cells */ old = NULL; iter = (HashMapIter *) mCells[indx]; while (iter) { @@ -194,9 +195,9 @@ Object * HashMap::objectForKey(Object * key) { unsigned int func; HashMapIter * iter; - + func = key->hash(); - + /* look for the key in existing cells */ iter = (HashMapIter *) mCells[func % mAllocated]; while (iter) { diff --git a/src/core/basetypes/MCHashMap.h b/src/core/basetypes/MCHashMap.h index 41e0be4c..d367a43d 100644 --- a/src/core/basetypes/MCHashMap.h +++ b/src/core/basetypes/MCHashMap.h @@ -7,43 +7,43 @@ #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(); + + 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(); + 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(); - }; + private: + unsigned int mAllocated; + unsigned int mCount; + void ** mCells; + HashMapIter * iteratorBegin(); + HashMapIter * iteratorNext(HashMapIter * iter); + void allocate(unsigned int size); + void init(); + }; } diff --git a/src/core/basetypes/MCIndexSet.h b/src/core/basetypes/MCIndexSet.h index a5bc6760..b1605b90 100644 --- a/src/core/basetypes/MCIndexSet.h +++ b/src/core/basetypes/MCIndexSet.h @@ -18,40 +18,40 @@ namespace mailcore { - class IndexSet : public Object { - public: - IndexSet(); - IndexSet(IndexSet * o); - - static IndexSet * indexSet(); + 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 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 addRange(Range range); virtual void removeRange(Range range); - virtual void intersectsRange(Range range); + virtual void intersectsRange(Range range); virtual Range * allRanges(); virtual unsigned int rangesCount(); - virtual void removeAllIndexes(); + virtual void removeAllIndexes(); public: // subclass behavior - virtual ~IndexSet(); - virtual String * description(); - virtual Object * copy(); - virtual HashMap * serializable(); + virtual ~IndexSet(); + virtual String * description(); + virtual Object * copy(); + virtual HashMap * serializable(); virtual void importSerializable(HashMap * serializable); - private: - Range * mRanges; + private: + Range * mRanges; unsigned int mCount; unsigned int mAllocated; - void init(); + void init(); int rangeIndexForIndex(uint64_t idx); int rangeIndexForIndexWithBounds(uint64_t idx, unsigned int left, unsigned int right); void addRangeIndex(unsigned int rangeIndex); @@ -62,8 +62,8 @@ namespace mailcore { int leftRangeIndexForIndexWithBounds(uint64_t idx, unsigned int left, unsigned int right); void mergeRanges(unsigned int rangeIndex); void tryToMergeAdjacentRanges(unsigned int rangeIndex); - }; - + }; + } #endif diff --git a/src/core/basetypes/MCJSON.h b/src/core/basetypes/MCJSON.h index c49fd813..2049de16 100644 --- a/src/core/basetypes/MCJSON.h +++ b/src/core/basetypes/MCJSON.h @@ -19,7 +19,7 @@ #ifdef __cplusplus namespace mailcore { - + class Null; class JSON { diff --git a/src/core/basetypes/MCJSONParser.cc b/src/core/basetypes/MCJSONParser.cc index c72f0c8b..adac3570 100644 --- a/src/core/basetypes/MCJSONParser.cc +++ b/src/core/basetypes/MCJSONParser.cc @@ -68,31 +68,31 @@ Object * JSONParser::result() bool JSONParser::parse() { skipBlank(); - if (parseDictionary()) - return true; - if (parseArray()) - return true; + if (parseDictionary()) + return true; + if (parseArray()) + return true; if (parseBoolean()) return true; if (parseNull()) return true; - if (parseFloat()) - return true; - if (parseString()) - return true; - - return false; + if (parseFloat()) + return true; + if (parseString()) + return true; + + return false; } bool JSONParser::isEndOfExpression() { - if (mPosition == mContent->length()) - return true; - - if (mContent->characterAtIndex(mPosition) == ';') - return true; - - return false; + if (mPosition == mContent->length()) + return true; + + if (mContent->characterAtIndex(mPosition) == ';') + return true; + + return false; } void JSONParser::skipBlank() @@ -120,98 +120,98 @@ unsigned int JSONParser::skipBlank(unsigned int position) bool JSONParser::parseDictionary() { - int position; - HashMap * dict; - - position = mPosition; - - if (!scanCharacter('{', position)) { - return false; - } - position ++; + int position; + HashMap * dict; + + position = mPosition; + + if (!scanCharacter('{', position)) { + return false; + } + position ++; position = skipBlank(position); - dict = HashMap::hashMap(); - - if (scanCharacter('}', position)) { - position ++; - } - else { - while (1) { - JSONParser * keyParser; - JSONParser * valueParser; - String * key; - Object * value; - - if (position >= mContent->length()) - return false; - - key = NULL; - keyParser = new JSONParser(); + dict = HashMap::hashMap(); + + if (scanCharacter('}', position)) { + position ++; + } + else { + while (1) { + JSONParser * keyParser; + JSONParser * valueParser; + String * key; + Object * value; + + if (position >= mContent->length()) + return false; + + key = NULL; + keyParser = new JSONParser(); keyParser->autorelease(); keyParser->setContent(mContent); keyParser->setPosition(position); - if (!keyParser->parse()) - return false; - - if (!keyParser->result()->className()->isEqual(MCSTR("mailcore::String"))) - return false; - - key = (String *) keyParser->result(); - position = keyParser->position(); - + if (!keyParser->parse()) + return false; + + if (!keyParser->result()->className()->isEqual(MCSTR("mailcore::String"))) + return false; + + key = (String *) keyParser->result(); + position = keyParser->position(); + position = skipBlank(position); - if (!scanCharacter(':', position)) - return false; - position ++; + if (!scanCharacter(':', position)) + return false; + position ++; position = skipBlank(position); - - value = NULL; - valueParser = new JSONParser(); + + value = NULL; + valueParser = new JSONParser(); valueParser->autorelease(); valueParser->setContent(mContent); valueParser->setPosition(position); - if (!valueParser->parse()) - return false; - - value = valueParser->result(); - position = valueParser->position(); - + if (!valueParser->parse()) + return false; + + value = valueParser->result(); + position = valueParser->position(); + dict->setObjectForKey(key, value); - - position = skipBlank(position); - - if (scanCharacter(',', position)) { - position ++; + + position = skipBlank(position); + + if (scanCharacter(',', position)) { + position ++; position = skipBlank(position); - } - else if (scanCharacter('}', position)) { - position ++; - break; - } - else { - return false; - } - } - } - - mResult = dict->retain(); - mPosition = position; - - return true; + } + else if (scanCharacter('}', position)) { + position ++; + break; + } + else { + return false; + } + } + } + + mResult = dict->retain(); + mPosition = position; + + return true; } bool JSONParser::scanCharacter(UChar ch, unsigned int position) { - if (position >= mContent->length()) - return false; - - if (mContent->characterAtIndex(position) != ch) - return false; - - return true; + if (position >= mContent->length()) + return false; + + if (mContent->characterAtIndex(position) != ch) + return false; + + return true; } bool JSONParser::scanKeyword(String * str, unsigned int position) @@ -225,83 +225,83 @@ bool JSONParser::scanKeyword(String * str, unsigned int position) pool = new AutoreleasePool(); result = false; - if (mContent->substringWithRange(RangeMake(position, str->length()))->isEqual(str)) - result = true; + if (mContent->substringWithRange(RangeMake(position, str->length()))->isEqual(str)) + result = true; pool->release(); - return result; + return result; } bool JSONParser::parseArray() { - int position; - Array * array; - - position = mPosition; - - if (!scanCharacter('[', position)) { - return false; - } - position ++; + int position; + Array * array; + + position = mPosition; + + if (!scanCharacter('[', position)) { + return false; + } + position ++; position = skipBlank(position); - - array = Array::array(); - - if (scanCharacter(']', position)) { - position ++; - } - else { - while (1) { - JSONParser * valueParser; - Object * value; - - if (position >= mContent->length()) - return false; - - value = NULL; - valueParser = new JSONParser(); + + array = Array::array(); + + if (scanCharacter(']', position)) { + position ++; + } + else { + while (1) { + JSONParser * valueParser; + Object * value; + + if (position >= mContent->length()) + return false; + + value = NULL; + valueParser = new JSONParser(); valueParser->setContent(mContent); valueParser->setPosition(position); valueParser->autorelease(); - if (!valueParser->parse()) - return false; - - value = valueParser->result(); - - position = valueParser->position(); - array->addObject(value); - - position = skipBlank(position); - - if (scanCharacter(',', position)) { - position ++; + if (!valueParser->parse()) + return false; + + value = valueParser->result(); + + position = valueParser->position(); + array->addObject(value); + + position = skipBlank(position); + + if (scanCharacter(',', position)) { + position ++; position = skipBlank(position); - } - else if (scanCharacter(']', position)) { - position ++; - break; - } - else { - return false; - } - } - } - - mResult = array->retain(); - mPosition = position; - - return true; + } + else if (scanCharacter(']', position)) { + position ++; + break; + } + else { + return false; + } + } + } + + mResult = array->retain(); + mPosition = position; + + return true; } static inline int hexToInt(UChar inCharacter) { - if (inCharacter >= '0' && inCharacter <= '9') { + if (inCharacter >= '0' && inCharacter <= '9') { return inCharacter - '0'; } - else if (inCharacter >= 'a' && inCharacter <= 'f') { + else if (inCharacter >= 'a' && inCharacter <= 'f') { return inCharacter - 'a' + 10; } - else if (inCharacter >= 'A' && inCharacter <= 'F') { + else if (inCharacter >= 'A' && inCharacter <= 'F') { return inCharacter - 'A' + 10; } else { @@ -311,251 +311,251 @@ static inline int hexToInt(UChar inCharacter) bool JSONParser::parseString() { - unsigned int position; - String * str; + unsigned int position; + String * str; bool doubleQuote = false; bool startString; bool endOfString; - - position = mPosition; - - startString = false; - if (scanCharacter('\"', position)) { - doubleQuote = true; - startString = true; - } - else if (scanCharacter('\'', position)) { - startString = true; - } - - if (!startString) - return false; - - position ++; - - str = String::string(); - + + position = mPosition; + + startString = false; + if (scanCharacter('\"', position)) { + doubleQuote = true; + startString = true; + } + else if (scanCharacter('\'', position)) { + startString = true; + } + + if (!startString) + return false; + + position ++; + + str = String::string(); + endOfString = false; - while (1) { - UChar ch; - - if (position >= mContent->length()) - return false; - - ch = mContent->characterAtIndex(position); - switch (ch) { - case '\\': - { - position ++; - - if (position >= mContent->length()) - return false; - - ch = mContent->characterAtIndex(position); - switch (ch) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': { - UChar char_value; - unsigned int count; + while (1) { + UChar ch; + + if (position >= mContent->length()) + return false; + + ch = mContent->characterAtIndex(position); + switch (ch) { + case '\\': + { + position ++; + + if (position >= mContent->length()) + return false; + + ch = mContent->characterAtIndex(position); + switch (ch) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': { + UChar char_value; + unsigned int count; count = 0; - char_value = 0; - while ((ch >= '0') && (ch <= '7')) { - int value; - - value = hexToInt(ch); - if (value == -1) - break; - - char_value = char_value * 8 + value; + char_value = 0; + while ((ch >= '0') && (ch <= '7')) { + int value; + + value = hexToInt(ch); + if (value == -1) + break; + + char_value = char_value * 8 + value; count ++; - position ++; + position ++; if (count >= 3) break; - if (position >= mContent->length()) - break; - ch = mContent->characterAtIndex(position); - } + if (position >= mContent->length()) + break; + ch = mContent->characterAtIndex(position); + } UChar characters[2]; characters[0] = char_value; characters[1] = 0; str->appendCharactersLength(characters, 1); - break; - } - case 'b': - str->appendString(MCSTR("\b")); - position ++; - break; - case 't': - str->appendString(MCSTR("\t")); - position ++; - break; - case 'n': - str->appendString(MCSTR("\n")); - position ++; - break; - case 'r': - str->appendString(MCSTR("\r")); - position ++; - break; - case 'f': - str->appendString(MCSTR("\f")); - position ++; - break; - case 'v': - str->appendString(MCSTR("\v")); - position ++; - break; - case '\"': - str->appendString(MCSTR("\"")); - position ++; - break; - case '\'': - str->appendString(MCSTR("\'")); - position ++; - break; - case '\\': - str->appendString(MCSTR("\\")); - position ++; - break; - case '/': - str->appendString(MCSTR("/")); - position ++; - break; - case 'u': { - unsigned int i; - UChar char_value; - - position ++; - char_value = 0; - for(i = 0 ; i < 4 ; i ++) { - int value; - - if (position >= mContent->length()) - return false; - ch = mContent->characterAtIndex(position); - value = hexToInt(ch); - if (value == -1) - break; - - char_value = char_value * 16 + value; - position ++; - } - + break; + } + case 'b': + str->appendString(MCSTR("\b")); + position ++; + break; + case 't': + str->appendString(MCSTR("\t")); + position ++; + break; + case 'n': + str->appendString(MCSTR("\n")); + position ++; + break; + case 'r': + str->appendString(MCSTR("\r")); + position ++; + break; + case 'f': + str->appendString(MCSTR("\f")); + position ++; + break; + case 'v': + str->appendString(MCSTR("\v")); + position ++; + break; + case '\"': + str->appendString(MCSTR("\"")); + position ++; + break; + case '\'': + str->appendString(MCSTR("\'")); + position ++; + break; + case '\\': + str->appendString(MCSTR("\\")); + position ++; + break; + case '/': + str->appendString(MCSTR("/")); + position ++; + break; + case 'u': { + unsigned int i; + UChar char_value; + + position ++; + char_value = 0; + for(i = 0 ; i < 4 ; i ++) { + int value; + + if (position >= mContent->length()) + return false; + ch = mContent->characterAtIndex(position); + value = hexToInt(ch); + if (value == -1) + break; + + char_value = char_value * 16 + value; + position ++; + } + UChar characters[2]; characters[0] = char_value; characters[1] = 0; str->appendCharactersLength(characters, 1); - - break; - } - case 'x': { - unsigned int i; - UChar char_value; - - position ++; - char_value = 0; - for(i = 0 ; i < 2 ; i ++) { - int value; - - if (position >= mContent->length()) - return false; - ch = mContent->characterAtIndex(position); - value = hexToInt(ch); - if (value == -1) - break; - - char_value = char_value * 16 + value; - position ++; - } - + + break; + } + case 'x': { + unsigned int i; + UChar char_value; + + position ++; + char_value = 0; + for(i = 0 ; i < 2 ; i ++) { + int value; + + if (position >= mContent->length()) + return false; + ch = mContent->characterAtIndex(position); + value = hexToInt(ch); + if (value == -1) + break; + + char_value = char_value * 16 + value; + position ++; + } + UChar characters[2]; characters[0] = char_value; characters[1] = 0; str->appendCharactersLength(characters, 1); - - break; - } - default: { + + break; + } + default: { UChar characters[3]; characters[0] = '\\'; characters[1] = ch; characters[2] = 0; str->appendCharactersLength(characters, 2); - position ++; - break; + position ++; + break; } - } - break; - } - - case '\'': - position ++; - if (!doubleQuote) - endOfString = true; + } + break; + } + + case '\'': + position ++; + if (!doubleQuote) + endOfString = true; else str->appendString(MCSTR("\'")); - break; - case '\"': - position ++; - if (doubleQuote) - endOfString = true; + break; + case '\"': + position ++; + if (doubleQuote) + endOfString = true; else str->appendString(MCSTR("\"")); - break; - default: { - position ++; + break; + default: { + position ++; UChar characters[2]; characters[0] = ch; characters[1] = 0; str->appendCharactersLength(characters, 1); - break; + break; } - } - - if (endOfString) - break; - } - - mResult = str->retain(); - mPosition = position; + } + + if (endOfString) + break; + } + + mResult = str->retain(); + mPosition = position; return true; } bool JSONParser::parseBoolean() { - if (scanKeyword(MCSTR("true"), mPosition)) { - mPosition += MCSTR("true")->length(); - mResult = Value::valueWithBoolValue(true)->retain();; - return true; - } - - if (scanKeyword(MCSTR("false"), mPosition)) { - mPosition += MCSTR("false")->length(); - mResult = Value::valueWithBoolValue(false)->retain();; - return true; - } - - return false; + if (scanKeyword(MCSTR("true"), mPosition)) { + mPosition += MCSTR("true")->length(); + mResult = Value::valueWithBoolValue(true)->retain();; + return true; + } + + if (scanKeyword(MCSTR("false"), mPosition)) { + mPosition += MCSTR("false")->length(); + mResult = Value::valueWithBoolValue(false)->retain();; + return true; + } + + return false; } bool JSONParser::parseNull() { - if (scanKeyword(MCSTR("null"), mPosition)) { - mPosition += MCSTR("null")->length(); - mResult = Null::null()->retain(); - return true; - } - - return false; + if (scanKeyword(MCSTR("null"), mPosition)) { + mPosition += MCSTR("null")->length(); + mResult = Null::null()->retain(); + return true; + } + + return false; } bool JSONParser::parseFloat() @@ -596,31 +596,31 @@ bool JSONParser::parseFloat() Object * JSONParser::objectFromData(Data * data) { - String * str = NULL; - Object * result; - - str = String::stringWithData(data, "utf-8"); - if (str == NULL) - return NULL; - - result = objectFromString(str); - - return result; + String * str = NULL; + Object * result; + + str = String::stringWithData(data, "utf-8"); + if (str == NULL) + return NULL; + + result = objectFromString(str); + + return result; } Object * JSONParser::objectFromString(String * str) { - Object * result; - JSONParser * parser; - - parser = new JSONParser(); + Object * result; + JSONParser * parser; + + parser = new JSONParser(); parser->setContent(str); - parser->parse(); - result = parser->result(); + parser->parse(); + result = parser->result(); result->retain()->autorelease(); parser->release(); - - return result; + + return result; } Data * JSONParser::dataFromObject(Object * object) @@ -697,16 +697,16 @@ String * JSONParser::JSStringFromString(String * str) case ';': case '|': case '~': - case '\'': { + case '\'': { UChar characters[2]; characters[0] = ch; characters[1] = 0; result->appendCharactersLength(characters, 1); break; } - case '"': - case '/': - case '\\': { + case '"': + case '/': + case '\\': { UChar characters[3]; characters[0] = '\\'; characters[1] = ch; diff --git a/src/core/basetypes/MCJSONParser.h b/src/core/basetypes/MCJSONParser.h index f27e924e..4f759708 100644 --- a/src/core/basetypes/MCJSONParser.h +++ b/src/core/basetypes/MCJSONParser.h @@ -16,9 +16,8 @@ namespace mailcore { class Data; class String; - + class JSONParser : public Object { - public: JSONParser(); virtual ~JSONParser(); diff --git a/src/core/basetypes/MCLog.c b/src/core/basetypes/MCLog.c index 11407f00..3e91a349 100644 --- a/src/core/basetypes/MCLog.c +++ b/src/core/basetypes/MCLog.c @@ -22,16 +22,16 @@ static void logInternalv(FILE * file, int dumpStack, const char * format, va_list argp); void MCLogInternal(const char * user, - const char * filename, - unsigned int line, - int dumpStack, - const char * format, ...) + const char * filename, + unsigned int line, + int dumpStack, + const char * format, ...) { - va_list argp; - - va_start(argp, format); + va_list argp; + + va_start(argp, format); logInternalv(stderr, user, filename, line, dumpStack, format, argp); - va_end(argp); + va_end(argp); } static void logInternalv(FILE * file, @@ -51,13 +51,13 @@ static void logInternalv(FILE * file, filename = p + 1; } - struct timeval tv; - struct tm tm_value; + struct timeval tv; + struct tm tm_value; pthread_t thread_id = pthread_self(); - gettimeofday(&tv, NULL); - localtime_r(&tv.tv_sec, &tm_value); - fprintf(file, "%04u-%02u-%02u %02u:%02u:%02u.%03u ", tm_value.tm_year + 1900, tm_value.tm_mon + 1, tm_value.tm_mday, tm_value.tm_hour, tm_value.tm_min, tm_value.tm_sec, (int) (tv.tv_usec / 1000)); + gettimeofday(&tv, NULL); + localtime_r(&tv.tv_sec, &tm_value); + fprintf(file, "%04u-%02u-%02u %02u:%02u:%02u.%03u ", tm_value.tm_year + 1900, tm_value.tm_mon + 1, tm_value.tm_mday, tm_value.tm_hour, tm_value.tm_min, tm_value.tm_sec, (int) (tv.tv_usec / 1000)); #ifdef __MACH__ if (pthread_main_np()) { diff --git a/src/core/basetypes/MCObject.h b/src/core/basetypes/MCObject.h index faebdcec..0f3a769b 100644 --- a/src/core/basetypes/MCObject.h +++ b/src/core/basetypes/MCObject.h @@ -14,17 +14,17 @@ virtual mcType * getter(); namespace mailcore { - + extern bool zombieEnabled; class String; class HashMap; - + class Object { public: Object(); virtual ~Object(); - + virtual int retainCount(); virtual Object * retain(); virtual void release(); diff --git a/src/core/basetypes/MCOperation.h b/src/core/basetypes/MCOperation.h index bd61e073..8c5b3127 100644 --- a/src/core/basetypes/MCOperation.h +++ b/src/core/basetypes/MCOperation.h @@ -12,9 +12,9 @@ #ifdef __cplusplus namespace mailcore { - + class OperationCallback; - + class Operation : public Object { public: Operation(); @@ -33,14 +33,14 @@ namespace mailcore { // Will be called on main thread. virtual void afterMain(); - + virtual void start(); #ifdef __APPLE__ virtual void setCallbackDispatchQueue(dispatch_queue_t callbackDispatchQueue); virtual dispatch_queue_t callbackDispatchQueue(); #endif - + private: OperationCallback * mCallback; bool mCancelled; @@ -48,7 +48,7 @@ namespace mailcore { #ifdef __APPLE__ dispatch_queue_t mCallbackDispatchQueue; #endif - + }; } diff --git a/src/core/basetypes/MCOperationCallback.h b/src/core/basetypes/MCOperationCallback.h index 7507d413..66a50524 100644 --- a/src/core/basetypes/MCOperationCallback.h +++ b/src/core/basetypes/MCOperationCallback.h @@ -5,14 +5,14 @@ #ifdef __cplusplus namespace mailcore { - - class Operation; - - class OperationCallback { - public: - virtual void operationFinished(Operation * op) {} - }; - + + class Operation; + + class OperationCallback { + public: + virtual void operationFinished(Operation * op) {} + }; + } #endif diff --git a/src/core/basetypes/MCOperationQueue.cc b/src/core/basetypes/MCOperationQueue.cc index 39d3bfbe..41e8f4c0 100644 --- a/src/core/basetypes/MCOperationQueue.cc +++ b/src/core/basetypes/MCOperationQueue.cc @@ -15,8 +15,8 @@ using namespace mailcore; OperationQueue::OperationQueue() { - mOperations = new Array(); - mStarted = false; + mOperations = new Array(); + mStarted = false; pthread_mutex_init(&mLock, NULL); mWaiting = false; mOperationSem = mailsem_new(); diff --git a/src/core/basetypes/MCOperationQueueCallback.h b/src/core/basetypes/MCOperationQueueCallback.h index 367888bb..d849a441 100644 --- a/src/core/basetypes/MCOperationQueueCallback.h +++ b/src/core/basetypes/MCOperationQueueCallback.h @@ -10,14 +10,15 @@ #define __MAILCORE_OPERATIONQUEUECALLBACK_H_ namespace mailcore { - - class OperationQueue; - class OperationQueueCallback { + class OperationQueue; + + class OperationQueueCallback { public: virtual void queueStartRunning() {} virtual void queueStoppedRunning() {} }; + } #endif diff --git a/src/core/basetypes/MCSet.h b/src/core/basetypes/MCSet.h index 41075d69..39793d80 100644 --- a/src/core/basetypes/MCSet.h +++ b/src/core/basetypes/MCSet.h @@ -7,11 +7,11 @@ #ifdef __cplusplus namespace mailcore { - + class String; class Array; class HashMap; - + class Set : public Object { public: Set(); @@ -19,7 +19,7 @@ namespace mailcore { static Set * set(); static Set * setWithArray(Array * objects); - + virtual unsigned int count(); virtual void addObject(Object * obj); virtual void removeObject(Object * obj); diff --git a/src/core/basetypes/MCString.cc b/src/core/basetypes/MCString.cc index d8863f44..d99931b6 100644 --- a/src/core/basetypes/MCString.cc +++ b/src/core/basetypes/MCString.cc @@ -38,48 +38,48 @@ void mailcore::setICUDataDirectory(String * directory) static inline int to_be_quoted(const char * word, size_t size, int subject) { - int do_quote; - const char * cur; - size_t i; - - do_quote = 0; - cur = word; - for(i = 0 ; i < size ; i ++) { - if (* cur == '=') - do_quote = 1; - - if (!subject) { - switch (* cur) { - case ',': - case ':': - case '!': - case '"': - case '#': - case '$': - case '@': - case '[': - case '\\': - case ']': - case '^': - case '`': - case '{': - case '|': - case '}': - case '~': - case '=': - case '?': - case '_': - do_quote = 1; - break; - } - } - if (((unsigned char) * cur) >= 128) - do_quote = 1; - - cur ++; - } - - return do_quote; + int do_quote; + const char * cur; + size_t i; + + do_quote = 0; + cur = word; + for(i = 0 ; i < size ; i ++) { + if (* cur == '=') + do_quote = 1; + + if (!subject) { + switch (* cur) { + case ',': + case ':': + case '!': + case '"': + case '#': + case '$': + case '@': + case '[': + case '\\': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case '=': + case '?': + case '_': + do_quote = 1; + break; + } + } + if (((unsigned char) * cur) >= 128) + do_quote = 1; + + cur ++; + } + + return do_quote; } #define MAX_IMF_LINE 72 @@ -87,92 +87,92 @@ static inline int to_be_quoted(const char * word, size_t size, int subject) static inline void quote_word(const char * display_charset, MMAPString * mmapstr, const char * word, size_t size) { - const char * cur; - size_t i; - char hex[4]; - int col; - - mmap_string_append(mmapstr, "=?"); - mmap_string_append(mmapstr, display_charset); - mmap_string_append(mmapstr, "?Q?"); - - col = (int) mmapstr->len; - - cur = word; - for(i = 0 ; i < size ; i ++) { - int do_quote_char; - - do_quote_char = 0; - switch (* cur) { - case ',': - case ':': - case '!': - case '"': - case '#': - case '$': - case '@': - case '[': - case '\\': - case ']': - case '^': - case '`': - case '{': - case '|': - case '}': - case '~': - case '=': - case '?': - case '_': - do_quote_char = 1; - break; - - default: - if (((unsigned char) * cur) >= 128) - do_quote_char = 1; - break; - } - - if (do_quote_char) { - snprintf(hex, 4, "=%2.2X", (unsigned char) * cur); - mmap_string_append(mmapstr, hex); - col += 3; - } - else { - if (* cur == ' ') { - mmap_string_append_c(mmapstr, '_'); - } - else { - mmap_string_append_c(mmapstr, * cur); - } - col += 3; - } - cur ++; - } - - mmap_string_append(mmapstr, "?="); + const char * cur; + size_t i; + char hex[4]; + int col; + + mmap_string_append(mmapstr, "=?"); + mmap_string_append(mmapstr, display_charset); + mmap_string_append(mmapstr, "?Q?"); + + col = (int) mmapstr->len; + + cur = word; + for(i = 0 ; i < size ; i ++) { + int do_quote_char; + + do_quote_char = 0; + switch (* cur) { + case ',': + case ':': + case '!': + case '"': + case '#': + case '$': + case '@': + case '[': + case '\\': + case ']': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case '=': + case '?': + case '_': + do_quote_char = 1; + break; + + default: + if (((unsigned char) * cur) >= 128) + do_quote_char = 1; + break; + } + + if (do_quote_char) { + snprintf(hex, 4, "=%2.2X", (unsigned char) * cur); + mmap_string_append(mmapstr, hex); + col += 3; + } + else { + if (* cur == ' ') { + mmap_string_append_c(mmapstr, '_'); + } + else { + mmap_string_append_c(mmapstr, * cur); + } + col += 3; + } + cur ++; + } + + mmap_string_append(mmapstr, "?="); } static inline void get_word(const char * begin, const char ** pend, int subject, int * pto_be_quoted) { - const char * cur; - - cur = begin; - - while ((* cur != ' ') && (* cur != '\t') && (* cur != '\0')) { - cur ++; - } - while (((* cur == ' ') || (* cur == '\t')) && (* cur != '\0')) { - cur ++; - } - - if (cur - begin + - 1 /* minimum column of string in a + const char * cur; + + cur = begin; + + while ((* cur != ' ') && (* cur != '\t') && (* cur != '\0')) { + cur ++; + } + while (((* cur == ' ') || (* cur == '\t')) && (* cur != '\0')) { + cur ++; + } + + if (cur - begin + + 1 /* minimum column of string in a folded header */ > MAX_IMF_LINE) - * pto_be_quoted = 1; - else - * pto_be_quoted = to_be_quoted(begin, cur - begin, subject); - - * pend = cur; + * pto_be_quoted = 1; + else + * pto_be_quoted = to_be_quoted(begin, cur - begin, subject); + + * pend = cur; } static char * etpan_make_full_quoted_printable(const char * display_charset, @@ -193,266 +193,266 @@ static char * etpan_make_full_quoted_printable(const char * display_charset, else { str = strdup(phrase); } - - return str; + + return str; } static char * etpan_make_quoted_printable(const char * display_charset, const char * phrase, int subject) { - char * str; - const char * cur; - MMAPString * mmapstr; - - mmapstr = mmap_string_new(""); - - cur = phrase; - while (* cur != '\0') { - const char * begin; - const char * end; - int do_quote; - int quote_words; - - begin = cur; - end = begin; - quote_words = 0; - do_quote = 1; - - while (* cur != '\0') { - get_word(cur, &cur, subject, &do_quote); - if (do_quote) { - quote_words = 1; - end = cur; - } - else - break; - if (* cur != '\0') - cur ++; - } - - if (quote_words) { - quote_word(display_charset, mmapstr, begin, end - begin); - - if ((* end == ' ') || (* end == '\t')) { - mmap_string_append_c(mmapstr, * end); - end ++; - } - - if (* end != '\0') { - mmap_string_append_len(mmapstr, end, cur - end); - } - } - else { - mmap_string_append_len(mmapstr, begin, cur - begin); - } - - if ((* cur == ' ') || (* cur == '\t')) { - mmap_string_append_c(mmapstr, * cur); - cur ++; - } - } - - str = strdup(mmapstr->str); - mmap_string_free(mmapstr); - - return str; + char * str; + const char * cur; + MMAPString * mmapstr; + + mmapstr = mmap_string_new(""); + + cur = phrase; + while (* cur != '\0') { + const char * begin; + const char * end; + int do_quote; + int quote_words; + + begin = cur; + end = begin; + quote_words = 0; + do_quote = 1; + + while (* cur != '\0') { + get_word(cur, &cur, subject, &do_quote); + if (do_quote) { + quote_words = 1; + end = cur; + } + else + break; + if (* cur != '\0') + cur ++; + } + + if (quote_words) { + quote_word(display_charset, mmapstr, begin, end - begin); + + if ((* end == ' ') || (* end == '\t')) { + mmap_string_append_c(mmapstr, * end); + end ++; + } + + if (* end != '\0') { + mmap_string_append_len(mmapstr, end, cur - end); + } + } + else { + mmap_string_append_len(mmapstr, begin, cur - begin); + } + + if ((* cur == ' ') || (* cur == '\t')) { + mmap_string_append_c(mmapstr, * cur); + cur ++; + } + } + + str = strdup(mmapstr->str); + mmap_string_free(mmapstr); + + return str; } #pragma mark extract subject static inline int skip_subj_blob(char * subj, size_t * begin, - size_t length, int keep_bracket) + size_t length, int keep_bracket) { if (keep_bracket) return 0; - /* subj-blob = "[" *BLOBCHAR "]" *WSP */ - size_t cur_token; - - cur_token = * begin; - - if (subj[cur_token] != '[') - return 0; - - cur_token ++; - - while (1) { - if (cur_token >= length) - return 0; - - if (subj[cur_token] == '[') - return 0; - - if (subj[cur_token] == ']') - break; - - cur_token ++; - } - - cur_token ++; - - while (1) { - if (cur_token >= length) - break; - - if (subj[cur_token] != ' ') - break; - - cur_token ++; - } - - * begin = cur_token; - - return 1; + /* subj-blob = "[" *BLOBCHAR "]" *WSP */ + size_t cur_token; + + cur_token = * begin; + + if (subj[cur_token] != '[') + return 0; + + cur_token ++; + + while (1) { + if (cur_token >= length) + return 0; + + if (subj[cur_token] == '[') + return 0; + + if (subj[cur_token] == ']') + break; + + cur_token ++; + } + + cur_token ++; + + while (1) { + if (cur_token >= length) + break; + + if (subj[cur_token] != ' ') + break; + + cur_token ++; + } + + * begin = cur_token; + + return 1; } static inline int skip_subj_refwd(char * subj, size_t * begin, - size_t length, int keep_bracket) + size_t length, int keep_bracket) { - /* subj-refwd = ("re" / ("fw" ["d"])) *WSP [subj-blob] ":" */ - size_t cur_token; - int prefix; + /* subj-refwd = ("re" / ("fw" ["d"])) *WSP [subj-blob] ":" */ + size_t cur_token; + int prefix; int has_suffix; - - cur_token = * begin; - prefix = 0; + + cur_token = * begin; + prefix = 0; + if (!prefix) { + if (length - cur_token >= 18) { + if (strncasecmp(subj + cur_token, "Переслать", 18) == 0) { + cur_token += 18; + prefix = 1; + } + } + } + if (!prefix) { + if (length - cur_token >= 10) { + if (strncasecmp(subj + cur_token, "Ответ", 10) == 0) { + cur_token += 10; + prefix = 1; + } + } + } + if (!prefix) { + if (length - cur_token >= 7) { + if (strncasecmp(subj + cur_token, "Antwort", 7) == 0) { + cur_token += 7; + prefix = 1; + } + } + } + if (!prefix) { + if (length - cur_token >= 6) { + if (strncasecmp(subj + cur_token, "回复", 6) == 0) { + cur_token += 6; + prefix = 1; + } + else if (strncasecmp(subj + cur_token, "转发", 6) == 0) { + cur_token += 6; + prefix = 1; + } + } + } + if (!prefix) { + if (length - cur_token >= 5) { + // é is 2 chars in utf-8 + if (strncasecmp(subj + cur_token, "réf.", 5) == 0) { + cur_token += 5; + prefix = 1; + } + else if (strncasecmp(subj + cur_token, "rép.", 5) == 0) { + cur_token += 5; + prefix = 1; + } + else if (strncasecmp(subj + cur_token, "trans", 5) == 0) { + cur_token += 5; + prefix = 1; + } + } + } if (!prefix) { - if (length - cur_token >= 18) { - if (strncasecmp(subj + cur_token, "Переслать", 18) == 0) { - cur_token += 18; - prefix = 1; - } - } + if (length - cur_token >= 4) { + if (strncasecmp(subj + cur_token, "antw", 4) == 0) { + cur_token += 4; + prefix = 1; + } + } } if (!prefix) { - if (length - cur_token >= 10) { - if (strncasecmp(subj + cur_token, "Ответ", 10) == 0) { - cur_token += 10; - prefix = 1; - } - } - } - if (!prefix) { - if (length - cur_token >= 7) { - if (strncasecmp(subj + cur_token, "Antwort", 7) == 0) { - cur_token += 7; - prefix = 1; - } - } - } + if (length - cur_token >= 3) { + if (strncasecmp(subj + cur_token, "fwd", 3) == 0) { + cur_token += 3; + prefix = 1; + } + else if (strncasecmp(subj + cur_token, "ogg", 3) == 0) { + cur_token += 3; + prefix = 1; + } + else if (strncasecmp(subj + cur_token, "odp", 3) == 0) { + cur_token += 3; + prefix = 1; + } + else if (strncasecmp(subj + cur_token, "res", 3) == 0) { + cur_token += 3; + prefix = 1; + } + else if (strncasecmp(subj + cur_token, "end", 3) == 0) { + cur_token += 3; + prefix = 1; + } + } + } if (!prefix) { - if (length - cur_token >= 6) { - if (strncasecmp(subj + cur_token, "回复", 6) == 0) { - cur_token += 6; - prefix = 1; - } - else if (strncasecmp(subj + cur_token, "转发", 6) == 0) { - cur_token += 6; - prefix = 1; - } - } - } - if (!prefix) { - if (length - cur_token >= 5) { - // é is 2 chars in utf-8 - if (strncasecmp(subj + cur_token, "réf.", 5) == 0) { - cur_token += 5; - prefix = 1; - } - else if (strncasecmp(subj + cur_token, "rép.", 5) == 0) { - cur_token += 5; - prefix = 1; - } - else if (strncasecmp(subj + cur_token, "trans", 5) == 0) { - cur_token += 5; - prefix = 1; - } - } - } - if (!prefix) { - if (length - cur_token >= 4) { - if (strncasecmp(subj + cur_token, "antw", 4) == 0) { - cur_token += 4; - prefix = 1; - } - } - } - if (!prefix) { - if (length - cur_token >= 3) { - if (strncasecmp(subj + cur_token, "fwd", 3) == 0) { - cur_token += 3; - prefix = 1; - } - else if (strncasecmp(subj + cur_token, "ogg", 3) == 0) { - cur_token += 3; - prefix = 1; - } - else if (strncasecmp(subj + cur_token, "odp", 3) == 0) { - cur_token += 3; - prefix = 1; - } - else if (strncasecmp(subj + cur_token, "res", 3) == 0) { - cur_token += 3; - prefix = 1; - } - else if (strncasecmp(subj + cur_token, "end", 3) == 0) { - cur_token += 3; - prefix = 1; - } - } - } - if (!prefix) { - if (length - cur_token >= 2) { - if (strncasecmp(subj + cur_token, "fw", 2) == 0) { - cur_token += 2; - prefix = 1; - } - else if (strncasecmp(subj + cur_token, "re", 2) == 0) { - cur_token += 2; - prefix = 1; - } - else if (strncasecmp(subj + cur_token, "tr", 2) == 0) { - cur_token += 2; - prefix = 1; - } - else if (strncasecmp(subj + cur_token, "aw", 2) == 0) { - cur_token += 2; - prefix = 1; - } - else if (strncasecmp(subj + cur_token, "sv", 2) == 0) { - cur_token += 2; - prefix = 1; - } - else if (strncasecmp(subj + cur_token, "rv", 2) == 0) { - cur_token += 2; - prefix = 1; - } - } - } - if (!prefix) { - if (length - cur_token >= 1) { - if (strncasecmp(subj + cur_token, "r", 1) == 0) { - cur_token += 1; - prefix = 1; - } - } - } - - if (!prefix) - return 0; - - while (1) { - if (cur_token >= length) - break; - - if (subj[cur_token] != ' ') - break; - - cur_token ++; - } - - skip_subj_blob(subj, &cur_token, length, keep_bracket); - + if (length - cur_token >= 2) { + if (strncasecmp(subj + cur_token, "fw", 2) == 0) { + cur_token += 2; + prefix = 1; + } + else if (strncasecmp(subj + cur_token, "re", 2) == 0) { + cur_token += 2; + prefix = 1; + } + else if (strncasecmp(subj + cur_token, "tr", 2) == 0) { + cur_token += 2; + prefix = 1; + } + else if (strncasecmp(subj + cur_token, "aw", 2) == 0) { + cur_token += 2; + prefix = 1; + } + else if (strncasecmp(subj + cur_token, "sv", 2) == 0) { + cur_token += 2; + prefix = 1; + } + else if (strncasecmp(subj + cur_token, "rv", 2) == 0) { + cur_token += 2; + prefix = 1; + } + } + } + if (!prefix) { + if (length - cur_token >= 1) { + if (strncasecmp(subj + cur_token, "r", 1) == 0) { + cur_token += 1; + prefix = 1; + } + } + } + + if (!prefix) + return 0; + + while (1) { + if (cur_token >= length) + break; + + if (subj[cur_token] != ' ') + break; + + cur_token ++; + } + + skip_subj_blob(subj, &cur_token, length, keep_bracket); + has_suffix = 0; if (!has_suffix) { @@ -465,7 +465,7 @@ static inline int skip_subj_refwd(char * subj, size_t * begin, } if (!has_suffix) { - if (cur_token < length) { + if (cur_token < length) { if (subj[cur_token] == ':') { cur_token ++; has_suffix = 1; @@ -477,212 +477,212 @@ static inline int skip_subj_refwd(char * subj, size_t * begin, return 0; } - * begin = cur_token; - - return 1; + * begin = cur_token; + + return 1; } static inline int skip_subj_leader(char * subj, size_t * begin, - size_t length, int keep_bracket) -{ - size_t cur_token; - - cur_token = * begin; - - /* subj-leader = (*subj-blob subj-refwd) / WSP */ - - if (subj[cur_token] == ' ') { - cur_token ++; - } - else { - while (cur_token < length) { - if (!skip_subj_blob(subj, &cur_token, length, keep_bracket)) - break; - } - if (!skip_subj_refwd(subj, &cur_token, length, keep_bracket)) - return 0; - } - - * begin = cur_token; - - return 1; + size_t length, int keep_bracket) +{ + size_t cur_token; + + cur_token = * begin; + + /* subj-leader = (*subj-blob subj-refwd) / WSP */ + + if (subj[cur_token] == ' ') { + cur_token ++; + } + else { + while (cur_token < length) { + if (!skip_subj_blob(subj, &cur_token, length, keep_bracket)) + break; + } + if (!skip_subj_refwd(subj, &cur_token, length, keep_bracket)) + return 0; + } + + * begin = cur_token; + + return 1; } static char * extract_subject(char * str, int keep_bracket) { - char * subj; - char * cur; - char * write_pos; - size_t len; - size_t begin; - int do_repeat_5; - int do_repeat_6; - - /* - (1) Convert any RFC 2047 encoded-words in the subject to - UTF-8. - We work on UTF-8 string -- DVH - */ - - subj = strdup(str); - if (subj == NULL) - return NULL; - - len = strlen(subj); - - /* - Convert all tabs and continuations to space. - Convert all multiple spaces to a single space. - */ - - cur = subj; - write_pos = subj; - while (* cur != '\0') { - int cont; - - switch (* cur) { - case '\t': - case '\r': - case '\n': - cont = 1; - - cur ++; - while (* cur && cont) { - switch (* cur) { - case '\t': - case '\r': - case '\n': - cont = 1; - break; - default: - cont = 0; - break; - } - cur ++; - } - - * write_pos = ' '; - write_pos ++; - - break; - - default: - * write_pos = * cur; - write_pos ++; - - cur ++; - - break; - } - } - * write_pos = '\0'; - - begin = 0; - - do { - do_repeat_6 = 0; - - /* - (2) Remove all trailing text of the subject that matches - the subj-trailer ABNF, repeat until no more matches are - possible. - */ - - while (len > 0) { - /* subj-trailer = "(fwd)" / WSP */ - if (subj[len - 1] == ' ') { - subj[len - 1] = '\0'; - len --; - } - else { - if (len < 5) - break; - - if (strncasecmp(subj + len - 5, "(fwd)", 5) != 0) - break; - - subj[len - 5] = '\0'; - len -= 5; - } - } - - do { - size_t saved_begin; - - do_repeat_5 = 0; - - /* - (3) Remove all prefix text of the subject that matches the - subj-leader ABNF. - */ - - if (skip_subj_leader(subj, &begin, len, keep_bracket)) - do_repeat_5 = 1; - - /* - (4) If there is prefix text of the subject that matches the - subj-blob ABNF, and removing that prefix leaves a non-empty - subj-base, then remove the prefix text. - */ - - saved_begin = begin; - if (skip_subj_blob(subj, &begin, len, keep_bracket)) { - if (begin == len) { - /* this will leave a empty subject base */ - begin = saved_begin; - } - else - do_repeat_5 = 1; - } - - /* - (5) Repeat (3) and (4) until no matches remain. - Note: it is possible to defer step (2) until step (6), - but this requires checking for subj-trailer in step (4). - */ - - } - while (do_repeat_5); - - /* - (6) If the resulting text begins with the subj-fwd-hdr ABNF - and ends with the subj-fwd-trl ABNF, remove the - subj-fwd-hdr and subj-fwd-trl and repeat from step (2). - */ - - if (len >= 5) { - if (strncasecmp(subj + begin, "[fwd:", 5) == 0) { - begin += 5; - - if (subj[len - 1] == ']') { - subj[len - 1] = '\0'; - len --; - do_repeat_6 = 1; - } - } - } - - } - while (do_repeat_6); - - /* - (7) The resulting text is the "base subject" used in - threading. - */ - - /* convert to upper case */ - - cur = subj + begin; - write_pos = subj; - - while (* cur != '\0') { - * write_pos = * cur; - cur ++; - write_pos ++; - } - * write_pos = '\0'; - - return subj; + char * subj; + char * cur; + char * write_pos; + size_t len; + size_t begin; + int do_repeat_5; + int do_repeat_6; + + /* + (1) Convert any RFC 2047 encoded-words in the subject to + UTF-8. + We work on UTF-8 string -- DVH + */ + + subj = strdup(str); + if (subj == NULL) + return NULL; + + len = strlen(subj); + + /* + Convert all tabs and continuations to space. + Convert all multiple spaces to a single space. + */ + + cur = subj; + write_pos = subj; + while (* cur != '\0') { + int cont; + + switch (* cur) { + case '\t': + case '\r': + case '\n': + cont = 1; + + cur ++; + while (* cur && cont) { + switch (* cur) { + case '\t': + case '\r': + case '\n': + cont = 1; + break; + default: + cont = 0; + break; + } + cur ++; + } + + * write_pos = ' '; + write_pos ++; + + break; + + default: + * write_pos = * cur; + write_pos ++; + + cur ++; + + break; + } + } + * write_pos = '\0'; + + begin = 0; + + do { + do_repeat_6 = 0; + + /* + (2) Remove all trailing text of the subject that matches + the subj-trailer ABNF, repeat until no more matches are + possible. + */ + + while (len > 0) { + /* subj-trailer = "(fwd)" / WSP */ + if (subj[len - 1] == ' ') { + subj[len - 1] = '\0'; + len --; + } + else { + if (len < 5) + break; + + if (strncasecmp(subj + len - 5, "(fwd)", 5) != 0) + break; + + subj[len - 5] = '\0'; + len -= 5; + } + } + + do { + size_t saved_begin; + + do_repeat_5 = 0; + + /* + (3) Remove all prefix text of the subject that matches the + subj-leader ABNF. + */ + + if (skip_subj_leader(subj, &begin, len, keep_bracket)) + do_repeat_5 = 1; + + /* + (4) If there is prefix text of the subject that matches the + subj-blob ABNF, and removing that prefix leaves a non-empty + subj-base, then remove the prefix text. + */ + + saved_begin = begin; + if (skip_subj_blob(subj, &begin, len, keep_bracket)) { + if (begin == len) { + /* this will leave a empty subject base */ + begin = saved_begin; + } + else + do_repeat_5 = 1; + } + + /* + (5) Repeat (3) and (4) until no matches remain. + Note: it is possible to defer step (2) until step (6), + but this requires checking for subj-trailer in step (4). + */ + + } + while (do_repeat_5); + + /* + (6) If the resulting text begins with the subj-fwd-hdr ABNF + and ends with the subj-fwd-trl ABNF, remove the + subj-fwd-hdr and subj-fwd-trl and repeat from step (2). + */ + + if (len >= 5) { + if (strncasecmp(subj + begin, "[fwd:", 5) == 0) { + begin += 5; + + if (subj[len - 1] == ']') { + subj[len - 1] = '\0'; + len --; + do_repeat_6 = 1; + } + } + } + + } + while (do_repeat_6); + + /* + (7) The resulting text is the "base subject" used in + threading. + */ + + /* convert to upper case */ + + cur = subj + begin; + write_pos = subj; + + while (* cur != '\0') { + * write_pos = * cur; + cur ++; + write_pos ++; + } + * write_pos = '\0'; + + return subj; } String::String(const UChar * unicodeChars) @@ -768,12 +768,12 @@ String * String::stringWithData(Data * data, const char * charset) String * String::stringWithUTF8Format(const char * format, ...) { - va_list argp; - - va_start(argp, format); + va_list argp; + + va_start(argp, format); String * result = stringWithVUTF8Format(format, argp); - va_end(argp); - + va_end(argp); + return result; } @@ -819,12 +819,12 @@ void String::appendString(String * otherString) void String::appendUTF8Format(const char * format, ...) { - va_list argp; - - va_start(argp, format); + va_list argp; + + va_start(argp, format); String * otherString = stringWithVUTF8Format(format, argp); - va_end(argp); - + va_end(argp); + this->appendString(otherString); } @@ -910,12 +910,12 @@ String * String::stringByAppendingString(String * otherString) String * String::stringByAppendingUTF8Format(const char * format, ...) { - va_list argp; - - va_start(argp, format); + va_list argp; + + va_start(argp, format); String * otherString = stringWithVUTF8Format(format, argp); - va_end(argp); - + va_end(argp); + return this->stringByAppendingString(otherString); } @@ -990,7 +990,7 @@ String * String::stringByDecodingMIMEHeaderValue(const char * phrase) { size_t cur_token; char * decoded; - String * result; + String * result; bool hasEncoding; if (phrase == NULL) @@ -1027,44 +1027,44 @@ String * String::stringByDecodingMIMEHeaderValue(const char * phrase) } free(decoded); - - return result; + + return result; } Data * String::encodedAddressDisplayNameValue() { - char * str; - Data * result; - + char * str; + Data * result; + str = etpan_make_full_quoted_printable(DEFAULT_DISPLAY_CHARSET, UTF8Characters()); result = Data::dataWithBytes(str, (unsigned int) strlen(str) + 1); - free(str); + free(str); return result; } Data * String::encodedMIMEHeaderValue() { - char * str; - Data * result; - - str = etpan_make_quoted_printable(DEFAULT_DISPLAY_CHARSET, UTF8Characters(), 0); + char * str; + Data * result; + + str = etpan_make_quoted_printable(DEFAULT_DISPLAY_CHARSET, UTF8Characters(), 0); result = Data::dataWithBytes(str, (unsigned int) strlen(str) + 1); - free(str); - - return result; + free(str); + + return result; } Data * String::encodedMIMEHeaderValueForSubject() { - char * str; - Data * result; - - str = etpan_make_quoted_printable(DEFAULT_DISPLAY_CHARSET, UTF8Characters(), 1); - result = Data::dataWithBytes(str, (unsigned int) strlen(str) + 1); - free(str); - - return result; + char * str; + Data * result; + + str = etpan_make_quoted_printable(DEFAULT_DISPLAY_CHARSET, UTF8Characters(), 1); + result = Data::dataWithBytes(str, (unsigned int) strlen(str) + 1); + free(str); + + return result; } int String::compareWithCaseSensitive(String * otherString, bool caseSensitive) @@ -1182,14 +1182,14 @@ String * String::extractedSubject() String * String::extractedSubjectAndKeepBracket(bool keepBracket) { - char * result; - String * str; - - result = extract_subject((char *) UTF8Characters(), keepBracket); - str = String::stringWithUTF8Characters(result); - free(result); - - return str; + char * result; + String * str; + + result = extract_subject((char *) UTF8Characters(), keepBracket); + str = String::stringWithUTF8Characters(result); + free(result); + + return str; } String * String::uuidString() @@ -1248,7 +1248,7 @@ unsigned int String::replaceOccurrencesOfString(String * occurrence, String * re } // copy remaining if(p) { - u_strcpy(dest_p, p); + u_strcpy(dest_p, p); } free(mUnicodeChars); @@ -1292,11 +1292,11 @@ int String::locationOfString(String * occurrence) #pragma mark strip HTML struct parserState { - int level; - int enabled; - int disabledLevel; - String * result; - int logEnabled; + int level; + int enabled; + int disabledLevel; + String * result; + int logEnabled; int hasQuote; int quoteLevel; bool hasText; @@ -1314,19 +1314,19 @@ static void charactersParsed(void * context, const xmlChar * ch, int len) /*" Callback function for stringByStrippingHTML. "*/ { - struct parserState * state; - - state = (struct parserState *) context; - String * result = state->result; - - if (!state->enabled) { - return; - } - - if (state->logEnabled) { - MCLog("text %s", ch); - } - String * modifiedString; + struct parserState * state; + + state = (struct parserState *) context; + String * result = state->result; + + if (!state->enabled) { + return; + } + + if (state->logEnabled) { + MCLog("text %s", ch); + } + String * modifiedString; modifiedString = new String((const char *) ch, len); modifiedString->replaceOccurrencesOfString(MCSTR("\n"), MCSTR(" ")); modifiedString->replaceOccurrencesOfString(MCSTR("\r"), MCSTR(" ")); @@ -1391,11 +1391,11 @@ static void charactersParsed(void * context, /* GCS: custom error function to ignore errors */ static void structuredError(void * userData, - xmlErrorPtr error) + xmlErrorPtr error) { - /* ignore all errors */ - (void)userData; - (void)error; + /* ignore all errors */ + (void)userData; + (void)error; } static void appendQuote(struct parserState * state) @@ -1501,13 +1501,13 @@ static HashMap * dictionaryFromAttributes(const xmlChar ** atts) static void elementStarted(void * ctx, const xmlChar * name, const xmlChar ** atts) { - struct parserState * state; - - state = (struct parserState *) ctx; - - if (state->logEnabled) { - MCLog("parsed element %s", name); - } + struct parserState * state; + + state = (struct parserState *) ctx; + + if (state->logEnabled) { + MCLog("parsed element %s", name); + } if (strcasecmp((const char *) name, "blockquote") == 0) { state->quoteLevel ++; @@ -1565,22 +1565,22 @@ static void elementStarted(void * ctx, const xmlChar * name, const xmlChar ** at state->paragraphSpacingStack->addObject(Value::valueWithBoolValue(hasSpacing)); } - if (state->enabled) { - if (state->level == 1) { - if (strcasecmp((const char *) name, "head") == 0) { - state->enabled = 0; - state->disabledLevel = state->level; - } - } - if (strcasecmp((const char *) name, "style") == 0) { - state->enabled = 0; - state->disabledLevel = state->level; - } - else if (strcasecmp((const char *) name, "script") == 0) { - state->enabled = 0; - state->disabledLevel = state->level; - } - else if (strcasecmp((const char *) name, "p") == 0) { + if (state->enabled) { + if (state->level == 1) { + if (strcasecmp((const char *) name, "head") == 0) { + state->enabled = 0; + state->disabledLevel = state->level; + } + } + if (strcasecmp((const char *) name, "style") == 0) { + state->enabled = 0; + state->disabledLevel = state->level; + } + else if (strcasecmp((const char *) name, "script") == 0) { + state->enabled = 0; + state->disabledLevel = state->level; + } + else if (strcasecmp((const char *) name, "p") == 0) { returnToLineAtBeginningOfBlock(state); if (((Value *) state->paragraphSpacingStack->lastObject())->boolValue()) { returnToLine(state); @@ -1589,7 +1589,7 @@ static void elementStarted(void * ctx, const xmlChar * name, const xmlChar ** at else if (blockElements()->containsObject(String::stringWithUTF8Characters((const char *) name)->lowercaseString())) { returnToLineAtBeginningOfBlock(state); } - else if (strcasecmp((const char *) name, "blockquote") == 0) { + else if (strcasecmp((const char *) name, "blockquote") == 0) { if (!state->showBlockQuote) { AutoreleasePool * pool; String * type; @@ -1620,38 +1620,38 @@ static void elementStarted(void * ctx, const xmlChar * name, const xmlChar ** at else { returnToLineAtBeginningOfBlock(state); } - } + } else if (strcasecmp((const char *) name, "br") == 0) { returnToLine(state); state->hasReturnToLine = true; } - } - - state->level ++; + } + + state->level ++; } static void elementEnded(void * ctx, const xmlChar * name) { - struct parserState * state; + struct parserState * state; + + state = (struct parserState *) ctx; - state = (struct parserState *) ctx; - - if (state->logEnabled) { - MCLog("ended element %s", name); - } + if (state->logEnabled) { + MCLog("ended element %s", name); + } if (strcasecmp((const char *) name, "blockquote") == 0) { state->quoteLevel --; } - state->level --; - if (!state->enabled) { - if (state->level == state->disabledLevel) { - state->enabled = 1; - } - } + state->level --; + if (!state->enabled) { + if (state->level == state->disabledLevel) { + state->enabled = 1; + } + } - bool hasReturnToLine; + bool hasReturnToLine; hasReturnToLine = false; if (strcasecmp((const char *) name, "a") == 0) { @@ -1707,13 +1707,13 @@ static void elementEnded(void * ctx, const xmlChar * name) static void commentParsed(void * ctx, const xmlChar * value) { - struct parserState * state; - - state = (struct parserState *) ctx; - - if (state->logEnabled) { - MCLog("comments %s", value); - } + struct parserState * state; + + state = (struct parserState *) ctx; + + if (state->logEnabled) { + MCLog("comments %s", value); + } } void initializeLibXML() @@ -1740,20 +1740,20 @@ String * String::flattenHTMLAndShowBlockquoteAndLink(bool showBlockquote, bool s { initializeLibXML(); - int mem_base = xmlMemBlocks(); + int mem_base = xmlMemBlocks(); String * result = String::string(); - xmlSAXHandler handler; - bzero(&handler, sizeof(xmlSAXHandler)); - handler.characters = &charactersParsed; - handler.startElement = elementStarted; - handler.endElement = elementEnded; - handler.comment = commentParsed; - struct parserState state; - state.result = result; - state.level = 0; - state.enabled = 1; - state.logEnabled = 0; - state.disabledLevel = 0; + xmlSAXHandler handler; + bzero(&handler, sizeof(xmlSAXHandler)); + handler.characters = &charactersParsed; + handler.startElement = elementStarted; + handler.endElement = elementEnded; + handler.comment = commentParsed; + struct parserState state; + state.result = result; + state.level = 0; + state.enabled = 1; + state.logEnabled = 0; + state.disabledLevel = 0; state.quoteLevel = 0; state.hasText = false; state.hasQuote = false; @@ -1762,16 +1762,16 @@ String * String::flattenHTMLAndShowBlockquoteAndLink(bool showBlockquote, bool s state.showLink = showLink; state.lastCharIsWhitespace = true; state.linkStack = new Array(); - state.paragraphSpacingStack = new Array(); + state.paragraphSpacingStack = new Array(); const char * characters = cleanedHTMLString()->UTF8Characters(); - htmlSAXParseDoc((xmlChar*) characters, "utf-8", &handler, &state); + htmlSAXParseDoc((xmlChar*) characters, "utf-8", &handler, &state); - if (mem_base != xmlMemBlocks()) { - MCLog("Leak of %d blocks found in htmlSAXParseDoc", + if (mem_base != xmlMemBlocks()) { + MCLog("Leak of %d blocks found in htmlSAXParseDoc", xmlMemBlocks() - mem_base); - } + } state.paragraphSpacingStack->release(); state.linkStack->release(); @@ -1781,7 +1781,7 @@ String * String::flattenHTMLAndShowBlockquoteAndLink(bool showBlockquote, bool s ch[1] = 0; result->replaceOccurrencesOfString(String::stringWithCharacters(ch), MCSTR(" ")); - return result; + return result; } String * String::flattenHTMLAndShowBlockquote(bool showBlockquote) diff --git a/src/core/basetypes/MCString.h b/src/core/basetypes/MCString.h index 7992ed8c..2afd0e7b 100644 --- a/src/core/basetypes/MCString.h +++ b/src/core/basetypes/MCString.h @@ -11,128 +11,128 @@ #ifdef __cplusplus namespace mailcore { - - class Data; - class Array; - - class String : public Object { - public: - String(const UChar * unicodeChars = NULL); - String(const UChar * unicodeChars, unsigned int length); - String(const char * UTF8Characters); - String(Data * data, const char * charset); - String(const char * bytes, unsigned int length, const char * charset = NULL); - virtual ~String(); - - static String * string(); - static String * stringWithUTF8Format(const char * format, ...); - static String * stringWithVUTF8Format(const char * format, va_list ap); - static String * stringWithUTF8Characters(const char * UTF8Characters); - static String * stringWithCharacters(const UChar * characters); - static String * stringWithCharacters(const UChar * characters, unsigned int length); - static String * stringWithData(Data * data, const char * charset = NULL); - - virtual const UChar * unicodeCharacters(); - virtual const char * UTF8Characters(); - virtual unsigned int length(); - - virtual void appendString(String * otherString); - virtual void appendUTF8Format(const char * format, ...); - virtual void appendCharacters(const UChar * unicodeCharacters); - virtual void appendCharactersLength(const UChar * unicodeCharacters, unsigned int length); - virtual void appendUTF8Characters(const char * UTF8Characters); - virtual void setString(String * otherString); - virtual void setUTF8Characters(const char * UTF8Characters); - virtual void setCharacters(const UChar * unicodeCharacters); - - virtual String * stringByAppendingString(String * otherString); - virtual String * stringByAppendingUTF8Format(const char * format, ...); - virtual String * stringByAppendingUTF8Characters(const char * UTF8Characters); - virtual String * stringByAppendingCharacters(const UChar * unicodeCharacters); - virtual String * stringByAppendingPathComponent(String * component); - virtual String * stringByDeletingLastPathComponent(); - - virtual int compare(String * otherString); - virtual int caseInsensitiveCompare(String * otherString); - virtual String * lowercaseString(); - virtual String * uppercaseString(); - - virtual UChar characterAtIndex(unsigned int idx); - virtual void deleteCharactersInRange(Range range); - virtual unsigned int replaceOccurrencesOfString(String * occurrence, String * replacement); - virtual int locationOfString(String * occurrence); - - virtual Array * componentsSeparatedByString(String * separator); - - virtual bool isEqualCaseInsensitive(String * otherString); - - // Additions - static String * stringByDecodingMIMEHeaderValue(const char * phrase); - virtual Data * encodedAddressDisplayNameValue(); - virtual Data * encodedMIMEHeaderValue(); - virtual Data * encodedMIMEHeaderValueForSubject(); - virtual String * extractedSubject(); - virtual String * extractedSubjectAndKeepBracket(bool keepBracket); - static String * uuidString(); - - virtual bool hasSuffix(String * suffix); - virtual bool hasPrefix(String * prefix); - - virtual String * substringFromIndex(unsigned int idx); - virtual String * substringToIndex(unsigned int idx); - virtual String * substringWithRange(Range range); - - virtual String * flattenHTML(); - virtual String * flattenHTMLAndShowBlockquote(bool showBlockquote); - virtual String * flattenHTMLAndShowBlockquoteAndLink(bool showBlockquote, bool showLink); - - virtual String * lastPathComponent(); - virtual String * pathExtension(); - virtual Data * dataUsingEncoding(const char * charset = NULL); - - virtual const char * fileSystemRepresentation(); - static String * stringWithFileSystemRepresentation(const char * filename); - - int intValue(); - unsigned int unsignedIntValue(); - long longValue(); - unsigned long unsignedLongValue(); - long long longLongValue(); - unsigned long long unsignedLongLongValue(); - double doubleValue(); - - virtual Data * mUTF7EncodedData(); - static String * stringWithMUTF7Data(Data * data); - virtual String * mUTF7EncodedString(); - virtual String * mUTF7DecodedString(); + + class Data; + class Array; + + class String : public Object { + public: + String(const UChar * unicodeChars = NULL); + String(const UChar * unicodeChars, unsigned int length); + String(const char * UTF8Characters); + String(Data * data, const char * charset); + String(const char * bytes, unsigned int length, const char * charset = NULL); + virtual ~String(); + + static String * string(); + static String * stringWithUTF8Format(const char * format, ...); + static String * stringWithVUTF8Format(const char * format, va_list ap); + static String * stringWithUTF8Characters(const char * UTF8Characters); + static String * stringWithCharacters(const UChar * characters); + static String * stringWithCharacters(const UChar * characters, unsigned int length); + static String * stringWithData(Data * data, const char * charset = NULL); + + virtual const UChar * unicodeCharacters(); + virtual const char * UTF8Characters(); + virtual unsigned int length(); + + virtual void appendString(String * otherString); + virtual void appendUTF8Format(const char * format, ...); + virtual void appendCharacters(const UChar * unicodeCharacters); + virtual void appendCharactersLength(const UChar * unicodeCharacters, unsigned int length); + virtual void appendUTF8Characters(const char * UTF8Characters); + virtual void setString(String * otherString); + virtual void setUTF8Characters(const char * UTF8Characters); + virtual void setCharacters(const UChar * unicodeCharacters); + + virtual String * stringByAppendingString(String * otherString); + virtual String * stringByAppendingUTF8Format(const char * format, ...); + virtual String * stringByAppendingUTF8Characters(const char * UTF8Characters); + virtual String * stringByAppendingCharacters(const UChar * unicodeCharacters); + virtual String * stringByAppendingPathComponent(String * component); + virtual String * stringByDeletingLastPathComponent(); + + virtual int compare(String * otherString); + virtual int caseInsensitiveCompare(String * otherString); + virtual String * lowercaseString(); + virtual String * uppercaseString(); + + virtual UChar characterAtIndex(unsigned int idx); + virtual void deleteCharactersInRange(Range range); + virtual unsigned int replaceOccurrencesOfString(String * occurrence, String * replacement); + virtual int locationOfString(String * occurrence); + + virtual Array * componentsSeparatedByString(String * separator); + + virtual bool isEqualCaseInsensitive(String * otherString); + + // Additions + static String * stringByDecodingMIMEHeaderValue(const char * phrase); + virtual Data * encodedAddressDisplayNameValue(); + virtual Data * encodedMIMEHeaderValue(); + virtual Data * encodedMIMEHeaderValueForSubject(); + virtual String * extractedSubject(); + virtual String * extractedSubjectAndKeepBracket(bool keepBracket); + static String * uuidString(); + + virtual bool hasSuffix(String * suffix); + virtual bool hasPrefix(String * prefix); + + virtual String * substringFromIndex(unsigned int idx); + virtual String * substringToIndex(unsigned int idx); + virtual String * substringWithRange(Range range); + + virtual String * flattenHTML(); + virtual String * flattenHTMLAndShowBlockquote(bool showBlockquote); + virtual String * flattenHTMLAndShowBlockquoteAndLink(bool showBlockquote, bool showLink); + + virtual String * lastPathComponent(); + virtual String * pathExtension(); + virtual Data * dataUsingEncoding(const char * charset = NULL); + + virtual const char * fileSystemRepresentation(); + static String * stringWithFileSystemRepresentation(const char * filename); + + int intValue(); + unsigned int unsignedIntValue(); + long longValue(); + unsigned long unsignedLongValue(); + long long longLongValue(); + unsigned long long unsignedLongLongValue(); + double doubleValue(); + + virtual Data * mUTF7EncodedData(); + static String * stringWithMUTF7Data(Data * data); + virtual String * mUTF7EncodedString(); + virtual String * mUTF7DecodedString(); virtual String * htmlEncodedString(); - virtual String * cleanedHTMLString(); + virtual String * cleanedHTMLString(); virtual Data * decodedBase64Data(); public: // private - static String * uniquedStringWithUTF8Characters(const char * UTF8Characters); + static String * uniquedStringWithUTF8Characters(const char * UTF8Characters); public: // subclass behavior - String(String * otherString); - virtual String * description(); - virtual Object * copy(); - virtual bool isEqual(Object * otherObject); - virtual unsigned int hash(); + String(String * otherString); + virtual String * description(); + virtual Object * copy(); + virtual bool isEqual(Object * otherObject); + virtual unsigned int hash(); virtual HashMap * serializable(); virtual void importSerializable(HashMap * serializable); - private: - UChar * mUnicodeChars; - unsigned int mLength; - unsigned int mAllocated; - void allocate(unsigned int length); - void reset(); - int compareWithCaseSensitive(String * otherString, bool caseSensitive); - void appendBytes(const char * bytes, unsigned int length, const char * charset); - void appendUTF8CharactersLength(const char * UTF8Characters, unsigned int length); - }; + private: + UChar * mUnicodeChars; + unsigned int mLength; + unsigned int mAllocated; + void allocate(unsigned int length); + void reset(); + int compareWithCaseSensitive(String * otherString, bool caseSensitive); + void appendBytes(const char * bytes, unsigned int length, const char * charset); + void appendUTF8CharactersLength(const char * UTF8Characters, unsigned int length); + }; void setICUDataDirectory(String * directory); } diff --git a/src/core/basetypes/MCUtils.h b/src/core/basetypes/MCUtils.h index 8309842e..7fecfc90 100644 --- a/src/core/basetypes/MCUtils.h +++ b/src/core/basetypes/MCUtils.h @@ -8,24 +8,24 @@ #define MC_SAFE_COPY(o) ((o) != NULL ? (o)->copy() : NULL) #define MC_SAFE_RELEASE(o) \ - do { \ - if ((o) != NULL) { \ - (o)->release(); \ - (o) = NULL; \ - } \ - } while (0) + do { \ + if ((o) != NULL) { \ + (o)->release(); \ + (o) = NULL; \ + } \ + } while (0) #define MC_SAFE_REPLACE_RETAIN(type, mField, value) \ - do { \ - MC_SAFE_RELEASE(mField); \ - mField = (type *) MC_SAFE_RETAIN(value); \ - } while (0) + do { \ + MC_SAFE_RELEASE(mField); \ + mField = (type *) MC_SAFE_RETAIN(value); \ + } while (0) #define MC_SAFE_REPLACE_COPY(type, mField, value) \ - do { \ - MC_SAFE_RELEASE(mField); \ - mField = (type *) MC_SAFE_COPY(value); \ - } while (0) + do { \ + MC_SAFE_RELEASE(mField); \ + mField = (type *) MC_SAFE_COPY(value); \ + } while (0) #define MCSTR(str) mailcore::String::uniquedStringWithUTF8Characters("" str "") diff --git a/src/core/basetypes/MCValue.h b/src/core/basetypes/MCValue.h index a03b09a0..f4ea6a6e 100644 --- a/src/core/basetypes/MCValue.h +++ b/src/core/basetypes/MCValue.h @@ -7,9 +7,9 @@ #ifdef __cplusplus namespace mailcore { - - class String; - + + class String; + enum { ValueTypeNone, ValueTypeBool, @@ -29,81 +29,81 @@ namespace mailcore { ValueTypeData, }; - class Value : public Object { - public: - virtual ~Value(); - - static Value * valueWithBoolValue(bool value); - static Value * valueWithCharValue(char value); - static Value * valueWithUnsignedCharValue(unsigned char value); - static Value * valueWithIntValue(int value); - static Value * valueWithUnsignedIntValue(unsigned int value); - static Value * valueWithLongValue(long value); - static Value * valueWithUnsignedLongValue(unsigned long value); - static Value * valueWithLongLongValue(long long value); - static Value * valueWithUnsignedLongLongValue(unsigned long long value); - static Value * valueWithFloatValue(float value); - static Value * valueWithDoubleValue(double value); - static Value * valueWithPointerValue(void * value); - static Value * valueWithData(const char * value, int length); - - virtual bool boolValue(); - virtual char charValue(); - virtual unsigned char unsignedCharValue(); - virtual short shortValue(); - virtual unsigned short unsignedShortValue(); - virtual int intValue(); - virtual unsigned int unsignedIntValue(); - virtual long longValue(); - virtual unsigned long unsignedLongValue(); - virtual long long longLongValue(); - virtual unsigned long long unsignedLongLongValue(); - virtual float floatValue(); - virtual double doubleValue(); - virtual void * pointerValue(); - virtual void dataValue(const char ** p_value, int * p_length); + class Value : public Object { + public: + virtual ~Value(); + + static Value * valueWithBoolValue(bool value); + static Value * valueWithCharValue(char value); + static Value * valueWithUnsignedCharValue(unsigned char value); + static Value * valueWithIntValue(int value); + static Value * valueWithUnsignedIntValue(unsigned int value); + static Value * valueWithLongValue(long value); + static Value * valueWithUnsignedLongValue(unsigned long value); + static Value * valueWithLongLongValue(long long value); + static Value * valueWithUnsignedLongLongValue(unsigned long long value); + static Value * valueWithFloatValue(float value); + static Value * valueWithDoubleValue(double value); + static Value * valueWithPointerValue(void * value); + static Value * valueWithData(const char * value, int length); + + virtual bool boolValue(); + virtual char charValue(); + virtual unsigned char unsignedCharValue(); + virtual short shortValue(); + virtual unsigned short unsignedShortValue(); + virtual int intValue(); + virtual unsigned int unsignedIntValue(); + virtual long longValue(); + virtual unsigned long unsignedLongValue(); + virtual long long longLongValue(); + virtual unsigned long long unsignedLongLongValue(); + virtual float floatValue(); + virtual double doubleValue(); + virtual void * pointerValue(); + virtual void dataValue(const char ** p_value, int * p_length); public: // subclass behavior - Value(Value * other); - virtual String * description(); - virtual bool isEqual(Object * otherObject); - virtual unsigned int hash(); - Object * copy(); + Value(Value * other); + virtual String * description(); + virtual bool isEqual(Object * otherObject); + virtual unsigned int hash(); + Object * copy(); virtual HashMap * serializable(); virtual void importSerializable(HashMap * serializable); public: // private static void * createObject(); - private: - int mType; - union { - bool boolValue; - char charValue; - unsigned char unsignedCharValue; - short shortValue; - unsigned short unsignedShortValue; - int intValue; - unsigned int unsignedIntValue; - long longValue; - unsigned long unsignedLongValue; - long long longLongValue; - unsigned long long unsignedLongLongValue; - float floatValue; - double doubleValue; - void * pointerValue; - struct { - char * data; - int length; - } dataValue; - } mValue; - Value(); + private: + int mType; + union { + bool boolValue; + char charValue; + unsigned char unsignedCharValue; + short shortValue; + unsigned short unsignedShortValue; + int intValue; + unsigned int unsignedIntValue; + long longValue; + unsigned long unsignedLongValue; + long long longLongValue; + unsigned long long unsignedLongLongValue; + float floatValue; + double doubleValue; + void * pointerValue; + struct { + char * data; + int length; + } dataValue; + } mValue; + Value(); public: // private virtual int type(); - - }; - + + }; + } #endif diff --git a/src/core/imap/MCIMAPFolder.h b/src/core/imap/MCIMAPFolder.h index f4f6e7ef..85bfd69f 100644 --- a/src/core/imap/MCIMAPFolder.h +++ b/src/core/imap/MCIMAPFolder.h @@ -8,33 +8,33 @@ #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(); + + 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(); + IMAPFolder(IMAPFolder * other); + virtual Object * copy(); + virtual String * description(); - private: - String * mPath; - char mDelimiter; - IMAPFolderFlag mFlags; - void init(); - }; - + private: + String * mPath; + char mDelimiter; + IMAPFolderFlag mFlags; + void init(); + }; + } #endif diff --git a/src/core/imap/MCIMAPFolderStatus.h b/src/core/imap/MCIMAPFolderStatus.h index 5a6dbac2..a4c9ede9 100644 --- a/src/core/imap/MCIMAPFolderStatus.h +++ b/src/core/imap/MCIMAPFolderStatus.h @@ -16,47 +16,46 @@ #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(); + + 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; + 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(); - }; - + + void init(); + }; + } #endif diff --git a/src/core/imap/MCIMAPIdentity.h b/src/core/imap/MCIMAPIdentity.h index c2565955..83bd3273 100644 --- a/src/core/imap/MCIMAPIdentity.h +++ b/src/core/imap/MCIMAPIdentity.h @@ -15,37 +15,37 @@ #ifdef __cplusplus namespace mailcore { - - class IMAPIdentity : public Object { - public: + + class IMAPIdentity : public Object { + public: - IMAPIdentity(); - virtual ~IMAPIdentity(); + IMAPIdentity(); + virtual ~IMAPIdentity(); - virtual void setVendor(String * vendor); - virtual String * vendor(); + virtual void setVendor(String * vendor); + virtual String * vendor(); - virtual void setName(String * name); - virtual String * name(); + virtual void setName(String * name); + virtual String * name(); - virtual void setVersion(String * version); - virtual String * version(); + 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(); + IMAPIdentity(IMAPIdentity * identity); + virtual Object * copy(); + virtual String * description(); - private: + private: HashMap * mValues; - void init(); - }; - + void init(); + }; + } #endif diff --git a/src/core/imap/MCIMAPMessage.h b/src/core/imap/MCIMAPMessage.h index d01d23a1..ebcad889 100644 --- a/src/core/imap/MCIMAPMessage.h +++ b/src/core/imap/MCIMAPMessage.h @@ -25,7 +25,7 @@ namespace mailcore { virtual uint32_t size(); virtual void setSize(uint32_t size); - + virtual void setFlags(MessageFlag flags); virtual MessageFlag flags(); @@ -43,7 +43,7 @@ namespace mailcore { virtual void setGmailMessageID(uint64_t msgID); virtual uint64_t gmailMessageID(); - + virtual void setGmailThreadID(uint64_t threadID); virtual uint64_t gmailThreadID(); @@ -67,7 +67,7 @@ namespace mailcore { uint64_t mModSeqValue; uint32_t mUid; uint32_t mSize; - + MessageFlag mFlags; MessageFlag mOriginalFlags; AbstractPart * mMainPart; diff --git a/src/core/imap/MCIMAPMessagePart.h b/src/core/imap/MCIMAPMessagePart.h index 3afb2b98..a355ed8f 100644 --- a/src/core/imap/MCIMAPMessagePart.h +++ b/src/core/imap/MCIMAPMessagePart.h @@ -26,6 +26,7 @@ namespace mailcore { String * mPartID; void init(); }; + } #endif diff --git a/src/core/imap/MCIMAPMultipart.h b/src/core/imap/MCIMAPMultipart.h index ca3574ab..9d03bd78 100644 --- a/src/core/imap/MCIMAPMultipart.h +++ b/src/core/imap/MCIMAPMultipart.h @@ -26,6 +26,7 @@ namespace mailcore { String * mPartID; void init(); }; + } #endif diff --git a/src/core/imap/MCIMAPNamespace.h b/src/core/imap/MCIMAPNamespace.h index 4ce0b546..bcb4b185 100644 --- a/src/core/imap/MCIMAPNamespace.h +++ b/src/core/imap/MCIMAPNamespace.h @@ -7,43 +7,43 @@ #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); + + 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(); + IMAPNamespace(IMAPNamespace * other); + virtual String * description(); + virtual Object * copy(); - private: - Array * /* String */ mItems; - void init(); - IMAPNamespaceItem * mainItem(); - IMAPNamespaceItem * itemForPath(String * path); + private: + Array * /* String */ mItems; + void init(); + IMAPNamespaceItem * mainItem(); + IMAPNamespaceItem * itemForPath(String * path); public: // private - virtual void importIMAPNamespace(struct mailimap_namespace_item * item); - }; - + virtual void importIMAPNamespace(struct mailimap_namespace_item * item); + }; + } #endif diff --git a/src/core/imap/MCIMAPNamespaceItem.h b/src/core/imap/MCIMAPNamespaceItem.h index 8ab094cc..a4cc605b 100644 --- a/src/core/imap/MCIMAPNamespaceItem.h +++ b/src/core/imap/MCIMAPNamespaceItem.h @@ -7,38 +7,38 @@ #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); + + 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(); + IMAPNamespaceItem(IMAPNamespaceItem * other); + virtual String * description(); + virtual Object * copy(); - private: - char mDelimiter; - String * mPrefix; - void init(); + private: + char mDelimiter; + String * mPrefix; + void init(); public: // private - virtual void importIMAPNamespaceInfo(struct mailimap_namespace_info * info); + virtual void importIMAPNamespaceInfo(struct mailimap_namespace_info * info); + + }; - }; - } #endif diff --git a/src/core/imap/MCIMAPPart.cc b/src/core/imap/MCIMAPPart.cc index 5fc39fc9..c75891a7 100644 --- a/src/core/imap/MCIMAPPart.cc +++ b/src/core/imap/MCIMAPPart.cc @@ -12,7 +12,7 @@ using namespace mailcore; void IMAPPart::init() { mPartID = NULL; - mEncoding = Encoding8Bit; + mEncoding = Encoding8Bit; mSize = 0; } @@ -25,7 +25,7 @@ IMAPPart::IMAPPart(IMAPPart * other) : AbstractPart(other) { init(); MC_SAFE_REPLACE_COPY(String, mPartID, other->mPartID); - mEncoding = other->mEncoding; + mEncoding = other->mEncoding; mSize = other->mSize; } @@ -71,13 +71,13 @@ Encoding IMAPPart::encoding() unsigned int IMAPPart::decodedSize() { - switch (mEncoding) { - case MAILIMAP_BODY_FLD_ENC_BASE64: + switch (mEncoding) { + case MAILIMAP_BODY_FLD_ENC_BASE64: return mSize * 3 / 4; default: return mSize; - } + } } AbstractPart * IMAPPart::attachmentWithIMAPBody(struct mailimap_body * body) @@ -86,7 +86,7 @@ AbstractPart * IMAPPart::attachmentWithIMAPBody(struct mailimap_body * body) AbstractPart * result; partID = NULL; - if (body->bd_type == MAILIMAP_BODY_1PART) { + if (body->bd_type == MAILIMAP_BODY_1PART) { partID = MCSTR("1"); } result = attachmentWithIMAPBodyInternal(body, partID); @@ -97,55 +97,55 @@ AbstractPart * IMAPPart::attachmentWithIMAPBody(struct mailimap_body * body) AbstractPart * IMAPPart::attachmentWithIMAPBodyInternal(struct mailimap_body * body, String * partID) { - switch (body->bd_type) { - case MAILIMAP_BODY_1PART: + switch (body->bd_type) { + case MAILIMAP_BODY_1PART: return attachmentWithIMAPBody1Part(body->bd_data.bd_body_1part, partID); - case MAILIMAP_BODY_MPART: + case MAILIMAP_BODY_MPART: return attachmentWithIMAPBodyMultipart(body->bd_data.bd_body_mpart, partID); - } - + } + return NULL; } AbstractPart * IMAPPart::attachmentWithIMAPBody1Part(struct mailimap_body_type_1part * body_1part, String * partID) { - switch (body_1part->bd_type) { - case MAILIMAP_BODY_TYPE_1PART_BASIC: - { - IMAPPart * attachment; + switch (body_1part->bd_type) { + case MAILIMAP_BODY_TYPE_1PART_BASIC: + { + IMAPPart * attachment; - attachment = attachmentWithIMAPBody1PartBasic(body_1part->bd_data.bd_type_basic, + attachment = attachmentWithIMAPBody1PartBasic(body_1part->bd_data.bd_type_basic, body_1part->bd_ext_1part); attachment->setPartID(partID); return attachment; - } - case MAILIMAP_BODY_TYPE_1PART_MSG: - { - return attachmentWithIMAPBody1PartMessage(body_1part->bd_data.bd_type_msg, + } + case MAILIMAP_BODY_TYPE_1PART_MSG: + { + return attachmentWithIMAPBody1PartMessage(body_1part->bd_data.bd_type_msg, body_1part->bd_ext_1part, partID); - } - case MAILIMAP_BODY_TYPE_1PART_TEXT: - { - IMAPPart * attachment; - - attachment = attachmentWithIMAPBody1PartText(body_1part->bd_data.bd_type_text, + } + case MAILIMAP_BODY_TYPE_1PART_TEXT: + { + IMAPPart * attachment; + + attachment = attachmentWithIMAPBody1PartText(body_1part->bd_data.bd_type_text, body_1part->bd_ext_1part); attachment->setPartID(partID); MCLog("attachment %s", MCUTF8(partID)); return attachment; - } - } - - return NULL; + } + } + + return NULL; } IMAPMessagePart * IMAPPart::attachmentWithIMAPBody1PartMessage(struct mailimap_body_type_msg * message, struct mailimap_body_ext_1part * extension, String * partID) { - IMAPMessagePart * attachment; - AbstractPart * subAttachment; + IMAPMessagePart * attachment; + AbstractPart * subAttachment; String * nextPartID; nextPartID = NULL; @@ -157,7 +157,7 @@ IMAPMessagePart * IMAPPart::attachmentWithIMAPBody1PartMessage(struct mailimap_b // mpart nextPartID = partID; } - + attachment = new IMAPMessagePart(); attachment->setPartID(partID); attachment->header()->importIMAPEnvelope(message->bd_envelope); @@ -197,47 +197,47 @@ void IMAPPart::importIMAPFields(struct mailimap_body_fields * fields, IMAPPart * IMAPPart::attachmentWithIMAPBody1PartBasic(struct mailimap_body_type_basic * basic, struct mailimap_body_ext_1part * extension) { - IMAPPart * attachment; - String * mimeType; - - attachment = new IMAPPart(); + IMAPPart * attachment; + String * mimeType; + + attachment = new IMAPPart(); attachment->importIMAPFields(basic->bd_fields, extension); mimeType = NULL; - switch (basic->bd_media_basic->med_type) { - case MAILIMAP_MEDIA_BASIC_APPLICATION: + switch (basic->bd_media_basic->med_type) { + case MAILIMAP_MEDIA_BASIC_APPLICATION: mimeType = String::stringWithUTF8Format("application/%s", basic->bd_media_basic->med_subtype); break; - case MAILIMAP_MEDIA_BASIC_AUDIO: + case MAILIMAP_MEDIA_BASIC_AUDIO: mimeType = String::stringWithUTF8Format("audio/%s", basic->bd_media_basic->med_subtype); break; - case MAILIMAP_MEDIA_BASIC_IMAGE: + case MAILIMAP_MEDIA_BASIC_IMAGE: mimeType = String::stringWithUTF8Format("image/%s", basic->bd_media_basic->med_subtype); break; - case MAILIMAP_MEDIA_BASIC_MESSAGE: + case MAILIMAP_MEDIA_BASIC_MESSAGE: mimeType = String::stringWithUTF8Format("message/%s", basic->bd_media_basic->med_subtype); break; - case MAILIMAP_MEDIA_BASIC_VIDEO: + case MAILIMAP_MEDIA_BASIC_VIDEO: mimeType = String::stringWithUTF8Format("video/%s", basic->bd_media_basic->med_subtype); break; - case MAILIMAP_MEDIA_BASIC_OTHER: + case MAILIMAP_MEDIA_BASIC_OTHER: mimeType = String::stringWithUTF8Format("%s/%s", basic->bd_media_basic->med_basic_type, basic->bd_media_basic->med_subtype); break; - } + } attachment->setMimeType(mimeType); - + return (IMAPPart *) attachment->autorelease(); } IMAPPart * IMAPPart::attachmentWithIMAPBody1PartText(struct mailimap_body_type_text * text, struct mailimap_body_ext_1part * extension) { - IMAPPart * attachment; - - attachment = new IMAPPart(); + IMAPPart * attachment; + + attachment = new IMAPPart(); attachment->importIMAPFields(text->bd_fields, extension); - attachment->setMimeType(String::stringWithUTF8Format("text/%s", text->bd_media_text)); - + attachment->setMimeType(String::stringWithUTF8Format("text/%s", text->bd_media_text)); + return (IMAPPart *) attachment->autorelease(); } diff --git a/src/core/imap/MCIMAPPart.h b/src/core/imap/MCIMAPPart.h index eddc661a..039f620c 100644 --- a/src/core/imap/MCIMAPPart.h +++ b/src/core/imap/MCIMAPPart.h @@ -8,56 +8,57 @@ #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(); - + + 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(); - + virtual void setEncoding(Encoding encoding); + virtual Encoding encoding(); + public: // subclass behavior - IMAPPart(IMAPPart * other); - virtual Object * copy(); + 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, + 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, + 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, + 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, + static IMAPPart * attachmentWithIMAPBody1PartBasic(struct mailimap_body_type_basic * basic, struct mailimap_body_ext_1part * extension); - static IMAPPart * attachmentWithIMAPBody1PartText(struct mailimap_body_type_text * text, + 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, + static IMAPMultipart * attachmentWithIMAPBodyMultipart(struct mailimap_body_type_mpart * body_mpart, String * partID); - }; + }; + } #endif diff --git a/src/core/imap/MCIMAPProgressCallback.h b/src/core/imap/MCIMAPProgressCallback.h index cb68ddd1..22427afe 100644 --- a/src/core/imap/MCIMAPProgressCallback.h +++ b/src/core/imap/MCIMAPProgressCallback.h @@ -5,14 +5,15 @@ #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) {}; - }; + + 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 diff --git a/src/core/imap/MCIMAPSearchExpression.h b/src/core/imap/MCIMAPSearchExpression.h index ed1c4b36..35b326b8 100644 --- a/src/core/imap/MCIMAPSearchExpression.h +++ b/src/core/imap/MCIMAPSearchExpression.h @@ -8,7 +8,7 @@ #ifdef __cplusplus namespace mailcore { - + class IMAPSearchExpression : public Object { public: IMAPSearchExpression(); @@ -20,7 +20,7 @@ namespace mailcore { virtual uint64_t longNumber(); virtual time_t date(); virtual IndexSet * uids(); - + virtual IMAPSearchExpression * leftExpression(); virtual IMAPSearchExpression * rightExpression(); diff --git a/src/core/imap/MCIMAPSession.cc b/src/core/imap/MCIMAPSession.cc index 205d53eb..2a4d2ca5 100755 --- a/src/core/imap/MCIMAPSession.cc +++ b/src/core/imap/MCIMAPSession.cc @@ -2068,7 +2068,7 @@ IMAPSyncResult * IMAPSession::fetchMessages(String * folder, IMAPMessagesRequest needsGmailLabels = false; needsGmailMessageID = false; needsGmailThreadID = false; - + fetch_type = mailimap_fetch_type_new_fetch_att_list_empty(); fetch_att = mailimap_fetch_att_new_uid(); mailimap_fetch_type_new_fetch_att_list_add(fetch_type, fetch_att); diff --git a/src/core/imap/MCIMAPSession.h b/src/core/imap/MCIMAPSession.h index a8a7279b..24e80967 100755 --- a/src/core/imap/MCIMAPSession.h +++ b/src/core/imap/MCIMAPSession.h @@ -258,6 +258,7 @@ namespace mailcore { bool enableFeature(String * feature); void enableFeatures(); }; + } #endif diff --git a/src/core/imap/MCIMAPSyncResult.h b/src/core/imap/MCIMAPSyncResult.h index b511b0bd..186984ab 100644 --- a/src/core/imap/MCIMAPSyncResult.h +++ b/src/core/imap/MCIMAPSyncResult.h @@ -15,12 +15,12 @@ #ifdef __cplusplus namespace mailcore { - + class IMAPSyncResult : public Object { - public: - IMAPSyncResult(); - virtual ~IMAPSyncResult(); - + public: + IMAPSyncResult(); + virtual ~IMAPSyncResult(); + virtual void setModifiedOrAddedMessages(Array * /* IMAPMessage */ messages); virtual Array * /* IMAPMessage */ modifiedOrAddedMessages(); diff --git a/src/core/pop/MCPOPMessageInfo.cc b/src/core/pop/MCPOPMessageInfo.cc index a1b1dcfe..418d159d 100644 --- a/src/core/pop/MCPOPMessageInfo.cc +++ b/src/core/pop/MCPOPMessageInfo.cc @@ -4,8 +4,8 @@ using namespace mailcore; void POPMessageInfo::init() { - mIndex = 0; - mSize = 0; + mIndex = 0; + mSize = 0; mUid = NULL; } diff --git a/src/core/pop/MCPOPMessageInfo.h b/src/core/pop/MCPOPMessageInfo.h index f7bb9f18..55ac149f 100644 --- a/src/core/pop/MCPOPMessageInfo.h +++ b/src/core/pop/MCPOPMessageInfo.h @@ -7,34 +7,34 @@ #ifdef __cplusplus namespace mailcore { - - class POPMessageInfo : public Object { - public: - POPMessageInfo(); - virtual ~POPMessageInfo(); - - virtual void setIndex(unsigned int index); - virtual unsigned int index(); - - virtual void setSize(unsigned int size); - virtual unsigned int size(); - - virtual void setUid(String * uid); - virtual String * uid(); + + class POPMessageInfo : public Object { + public: + POPMessageInfo(); + virtual ~POPMessageInfo(); + + virtual void setIndex(unsigned int index); + virtual unsigned int index(); + + virtual void setSize(unsigned int size); + virtual unsigned int size(); + + virtual void setUid(String * uid); + virtual String * uid(); public: // subclass behavior - POPMessageInfo(POPMessageInfo * other); - virtual String * description(); - virtual Object * copy(); + POPMessageInfo(POPMessageInfo * other); + virtual String * description(); + virtual Object * copy(); - private: - unsigned int mIndex; - unsigned int mSize; - String * mUid; - - void init(); - }; - + private: + unsigned int mIndex; + unsigned int mSize; + String * mUid; + + void init(); + }; + } #endif diff --git a/src/core/pop/MCPOPProgressCallback.h b/src/core/pop/MCPOPProgressCallback.h index 5a46b38e..6cc205d9 100644 --- a/src/core/pop/MCPOPProgressCallback.h +++ b/src/core/pop/MCPOPProgressCallback.h @@ -5,13 +5,14 @@ #ifdef __cplusplus namespace mailcore { - - class POPSession; - - class POPProgressCallback { - public: - virtual void bodyProgress(POPSession * session, unsigned int current, unsigned int maximum) {}; - }; + + class POPSession; + + class POPProgressCallback { + public: + virtual void bodyProgress(POPSession * session, unsigned int current, unsigned int maximum) {}; + }; + } #endif diff --git a/src/core/pop/MCPOPSession.cc b/src/core/pop/MCPOPSession.cc index b73d4148..12b0b032 100644 --- a/src/core/pop/MCPOPSession.cc +++ b/src/core/pop/MCPOPSession.cc @@ -20,15 +20,15 @@ enum { void POPSession::init() { - mHostname = NULL; - mPort = 0; - mUsername = NULL; - mPassword = NULL; - mAuthType = AuthTypeSASLNone; - mConnectionType = ConnectionTypeClear; + mHostname = NULL; + mPort = 0; + mUsername = NULL; + mPassword = NULL; + mAuthType = AuthTypeSASLNone; + mConnectionType = ConnectionTypeClear; mCheckCertificateEnabled = true; mTimeout = 30; - + mPop = NULL; mCapabilities = POPCapabilityNone; mProgressCallback = NULL; @@ -171,21 +171,21 @@ static void logger(mailpop3 * pop3, int log_type, const char * buffer, size_t si void POPSession::setup() { - mPop = mailpop3_new(0, NULL); + mPop = mailpop3_new(0, NULL); mailpop3_set_progress_callback(mPop, POPSession::body_progress, this); mailpop3_set_logger(mPop, logger, this); } void POPSession::unsetup() { - if (mPop != NULL) { + if (mPop != NULL) { if (mPop->pop3_stream != NULL) { mailstream_close(mPop->pop3_stream); mPop->pop3_stream = NULL; } - mailpop3_free(mPop); - mPop = NULL; - } + mailpop3_free(mPop); + mPop = NULL; + } } void POPSession::connectIfNeeded(ErrorCode * pError) @@ -316,10 +316,10 @@ void POPSession::login(ErrorCode * pError) * pError = ErrorAuthentication; return; } - + r = mailpop3_pass(mPop, utf8password); break; - + case AuthTypeSASLCRAMMD5: r = mailpop3_auth(mPop, "CRAM-MD5", MCUTF8(hostname()), @@ -328,7 +328,7 @@ void POPSession::login(ErrorCode * pError) utf8username, utf8username, utf8password, NULL); break; - + case AuthTypeSASLPlain: r = mailpop3_auth(mPop, "PLAIN", MCUTF8(hostname()), @@ -337,7 +337,7 @@ void POPSession::login(ErrorCode * pError) utf8username, utf8username, utf8password, NULL); break; - + case AuthTypeSASLGSSAPI: // needs to be tested r = mailpop3_auth(mPop, "GSSAPI", @@ -347,7 +347,7 @@ void POPSession::login(ErrorCode * pError) utf8username, utf8username, utf8password, NULL /* realm */); break; - + case AuthTypeSASLDIGESTMD5: r = mailpop3_auth(mPop, "DIGEST-MD5", MCUTF8(hostname()), @@ -356,7 +356,7 @@ void POPSession::login(ErrorCode * pError) utf8username, utf8username, utf8password, NULL); break; - + case AuthTypeSASLLogin: r = mailpop3_auth(mPop, "LOGIN", MCUTF8(hostname()), @@ -365,7 +365,7 @@ void POPSession::login(ErrorCode * pError) utf8username, utf8username, utf8password, NULL); break; - + case AuthTypeSASLSRP: r = mailpop3_auth(mPop, "SRP", MCUTF8(hostname()), @@ -374,7 +374,7 @@ void POPSession::login(ErrorCode * pError) utf8username, utf8username, utf8password, NULL); break; - + case AuthTypeSASLNTLM: r = mailpop3_auth(mPop, "NTLM", MCUTF8(hostname()), @@ -383,7 +383,7 @@ void POPSession::login(ErrorCode * pError) utf8username, utf8username, utf8password, NULL /* realm */); break; - + case AuthTypeSASLKerberosV4: r = mailpop3_auth(mPop, "KERBEROS_V4", MCUTF8(hostname()), @@ -401,7 +401,7 @@ void POPSession::login(ErrorCode * pError) * pError = ErrorAuthentication; return; } - + mState = STATE_LOGGEDIN; * pError = ErrorNone; } @@ -425,16 +425,16 @@ Array * POPSession::fetchMessages(ErrorCode * pError) * pError = ErrorFetchMessageList; return NULL; } - + Array * result = Array::array(); for(unsigned int i = 0 ; i < carray_count(msg_list) ; i ++) { struct mailpop3_msg_info * msg_info; String * uid; - + msg_info = (struct mailpop3_msg_info *) carray_get(msg_list, i); if (msg_info->msg_uidl == NULL) continue; - + uid = String::stringWithUTF8Characters(msg_info->msg_uidl); POPMessageInfo * info = new POPMessageInfo(); diff --git a/src/core/pop/MCPOPSession.h b/src/core/pop/MCPOPSession.h index 2f16e45b..0b27a1bc 100644 --- a/src/core/pop/MCPOPSession.h +++ b/src/core/pop/MCPOPSession.h @@ -12,9 +12,8 @@ namespace mailcore { class POPMessageInfo; class POPProgressCallback; class MessageHeader; - + class POPSession : public Object { - public: POPSession(); virtual ~POPSession(); diff --git a/src/core/provider/MCMailProvider.h b/src/core/provider/MCMailProvider.h index 81b816e9..c4eeec43 100644 --- a/src/core/provider/MCMailProvider.h +++ b/src/core/provider/MCMailProvider.h @@ -14,56 +14,57 @@ #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(); - + 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); - + virtual bool isMainFolder(String * folderPath, String * prefix); + public: // subclass behavior - MailProvider(MailProvider * other); - virtual String * description(); - virtual Object * copy(); - + MailProvider(MailProvider * other); + virtual String * description(); + virtual Object * copy(); + public: // private - virtual void setIdentifier(String * identifier); - virtual void fillWithInfo(HashMap * info); + virtual void setIdentifier(String * identifier); + virtual void fillWithInfo(HashMap * info); + + private: + String * mIdentifier; + Array * /* String */ mDomainMatch; + Array * /* NetService */ mImapServices; + Array * /* NetService */ mSmtpServices; + Array * /* NetService */ mPopServices; + HashMap * mMailboxPaths; + Set * mMxSet; - private: - String * mIdentifier; - Array * /* String */ mDomainMatch; - Array * /* NetService */ mImapServices; - Array * /* NetService */ mSmtpServices; - Array * /* NetService */ mPopServices; - HashMap * mMailboxPaths; - Set * mMxSet; - - void init(); + void init(); }; + }; #endif diff --git a/src/core/provider/MCMailProvidersManager.cc b/src/core/provider/MCMailProvidersManager.cc index 5214b284..0d7938e4 100644 --- a/src/core/provider/MCMailProvidersManager.cc +++ b/src/core/provider/MCMailProvidersManager.cc @@ -14,11 +14,11 @@ using namespace mailcore; void MailProvidersManager::init() { - mProviders = new HashMap(); + mProviders = new HashMap(); } MailProvidersManager::MailProvidersManager() { - init(); + init(); } MailProvidersManager * MailProvidersManager::sharedManager() @@ -30,42 +30,41 @@ MailProvidersManager * MailProvidersManager::sharedManager() MailProvider * MailProvidersManager::providerForEmail(String * email) { - mc_foreachhashmapValue(MailProvider, provider, mProviders) { + mc_foreachhashmapValue(MailProvider, provider, mProviders) { if (provider->matchEmail(email)) return provider; - } - - return NULL; + } + + return NULL; } MailProvider * MailProvidersManager::providerForMX(String * hostname) { - mc_foreachhashmapValue(MailProvider, provider, mProviders) { + mc_foreachhashmapValue(MailProvider, provider, mProviders) { if (provider->matchMX(hostname)) return provider; - } - - return NULL; + } + + return NULL; } MailProvider * MailProvidersManager::providerForIdentifier(String * identifier) { - return (MailProvider *) mProviders->objectForKey(identifier); + return (MailProvider *) mProviders->objectForKey(identifier); } void MailProvidersManager::registerProviders(HashMap * providers) { - mc_foreachhashmapKeyAndValue(String, identifier, HashMap, providerInfo, providers) { + mc_foreachhashmapKeyAndValue(String, identifier, HashMap, providerInfo, providers) { MailProvider * provider = MailProvider::providerWithInfo(providerInfo); provider->setIdentifier(identifier); - //MCLog("register %s", MCUTF8DESC(identifier)); mProviders->setObjectForKey(identifier, provider); - } + } } void MailProvidersManager::registerProvidersWithFilename(String * filename) { - HashMap * providersInfos; + HashMap * providersInfos; providersInfos = (HashMap *) JSON::objectFromJSONData(Data::dataWithContentsOfFile(filename)); registerProviders(providersInfos); diff --git a/src/core/provider/MCMailProvidersManager.h b/src/core/provider/MCMailProvidersManager.h index 23127148..98f00cdd 100644 --- a/src/core/provider/MCMailProvidersManager.h +++ b/src/core/provider/MCMailProvidersManager.h @@ -14,27 +14,27 @@ #ifdef __cplusplus namespace mailcore { - class MailProvider; - - class MailProvidersManager : public Object { + + class MailProvider; + + class MailProvidersManager : public Object { + public: + static MailProvidersManager * sharedManager(); - 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(); - }; + 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 diff --git a/src/core/provider/MCNetService.h b/src/core/provider/MCNetService.h index d3aa5dd7..7fb4e5a7 100644 --- a/src/core/provider/MCNetService.h +++ b/src/core/provider/MCNetService.h @@ -15,6 +15,7 @@ #ifdef __cplusplus namespace mailcore { + class NetService : public Object { public: @@ -49,6 +50,7 @@ namespace mailcore { void init(); void fillWithInfo(HashMap * info); }; + } #endif diff --git a/src/core/renderer/MCAddressDisplay.cc b/src/core/renderer/MCAddressDisplay.cc index 27229e18..dd2d559a 100644 --- a/src/core/renderer/MCAddressDisplay.cc +++ b/src/core/renderer/MCAddressDisplay.cc @@ -31,12 +31,12 @@ String * AddressDisplay::shortDisplayStringForAddress(Address * address) String * AddressDisplay::veryShortDisplayStringForAddress(Address * address) { if ((address->displayName() != NULL) && (address->displayName()->length() > 0)) { - Array * components; - String * senderName; + Array * components; + String * senderName; - senderName = address->displayName(); + senderName = address->displayName(); senderName = (String *) senderName->copy()->autorelease(); - + senderName->replaceOccurrencesOfString(MCSTR(","), MCSTR(" ")); senderName->replaceOccurrencesOfString(MCSTR("'"), MCSTR(" ")); senderName->replaceOccurrencesOfString(MCSTR("\""), MCSTR(" ")); @@ -45,10 +45,10 @@ String * AddressDisplay::veryShortDisplayStringForAddress(Address * address) return MCLOCALIZEDSTRING(MCSTR("invalid")); } return (String *) components->objectAtIndex(0); - } + } else if (address->mailbox()) { - return address->mailbox(); - } + return address->mailbox(); + } else { return MCLOCALIZEDSTRING(MCSTR("invalid")); } @@ -56,7 +56,7 @@ String * AddressDisplay::veryShortDisplayStringForAddress(Address * address) String * AddressDisplay::displayStringForAddresses(Array * addresses) { - return Address::nonEncodedRFC822StringForAddresses(addresses); + return Address::nonEncodedRFC822StringForAddresses(addresses); } String * AddressDisplay::shortDisplayStringForAddresses(Array * addresses) diff --git a/src/core/renderer/MCAddressDisplay.h b/src/core/renderer/MCAddressDisplay.h index 3fe6856d..0e69377a 100644 --- a/src/core/renderer/MCAddressDisplay.h +++ b/src/core/renderer/MCAddressDisplay.h @@ -16,7 +16,6 @@ namespace mailcore { class AddressDisplay { - public: static String * displayStringForAddress(Address * address); static String * shortDisplayStringForAddress(Address * address); diff --git a/src/core/renderer/MCDateFormatter.cc b/src/core/renderer/MCDateFormatter.cc index 17e4c290..2882977d 100644 --- a/src/core/renderer/MCDateFormatter.cc +++ b/src/core/renderer/MCDateFormatter.cc @@ -204,7 +204,7 @@ void DateFormatter::prepare() #if USE_COREFOUNDATION if (mAppleDateFormatter != NULL) return; - + CFStringRef localeIdentifier = NULL; CFLocaleRef localeRef = NULL; if (mLocale != NULL) { diff --git a/src/core/renderer/MCDateFormatter.h b/src/core/renderer/MCDateFormatter.h index 4c5a7140..e120702a 100644 --- a/src/core/renderer/MCDateFormatter.h +++ b/src/core/renderer/MCDateFormatter.h @@ -32,10 +32,10 @@ namespace mailcore { class DateFormatter : public Object { public: - DateFormatter(); - virtual ~DateFormatter(); - - static DateFormatter * dateFormatter(); + DateFormatter(); + virtual ~DateFormatter(); + + static DateFormatter * dateFormatter(); virtual void setDateStyle(DateFormatStyle style); virtual DateFormatStyle dateStyle(); diff --git a/src/core/renderer/MCHTMLBodyRendererTemplateCallback.h b/src/core/renderer/MCHTMLBodyRendererTemplateCallback.h index 7cb9ae10..5c2115f8 100644 --- a/src/core/renderer/MCHTMLBodyRendererTemplateCallback.h +++ b/src/core/renderer/MCHTMLBodyRendererTemplateCallback.h @@ -15,7 +15,7 @@ #ifdef __cplusplus namespace mailcore { - + class HTMLBodyRendererTemplateCallback : public Object, public HTMLRendererTemplateCallback { public: virtual String * templateForMainHeader(MessageHeader * header); diff --git a/src/core/renderer/MCHTMLRenderer.h b/src/core/renderer/MCHTMLRenderer.h index f76510e8..a9f49e89 100644 --- a/src/core/renderer/MCHTMLRenderer.h +++ b/src/core/renderer/MCHTMLRenderer.h @@ -34,6 +34,7 @@ namespace mailcore { static Array * /* AbstractPart */ attachmentsForMessage(AbstractMessage * message); static Array * /* AbstractPart */ htmlInlineAttachmentsForMessage(AbstractMessage * message); }; + }; #endif diff --git a/src/core/renderer/MCHTMLRendererCallback.cc b/src/core/renderer/MCHTMLRendererCallback.cc index 5147e934..bf408d4f 100644 --- a/src/core/renderer/MCHTMLRendererCallback.cc +++ b/src/core/renderer/MCHTMLRendererCallback.cc @@ -260,5 +260,5 @@ bool HTMLRendererTemplateCallback::canPreviewPart(AbstractPart * part) bool HTMLRendererTemplateCallback::shouldShowPart(AbstractPart * part) { - return true; + return true; } diff --git a/src/core/renderer/MCHTMLRendererCallback.h b/src/core/renderer/MCHTMLRendererCallback.h index 84292dad..1d04c8d4 100644 --- a/src/core/renderer/MCHTMLRendererCallback.h +++ b/src/core/renderer/MCHTMLRendererCallback.h @@ -41,14 +41,14 @@ namespace mailcore { virtual String * templateForEmbeddedMessage(AbstractMessagePart * part); virtual String * templateForEmbeddedMessageHeader(MessageHeader * header); virtual String * templateForAttachmentSeparator(); - + // 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 diff --git a/src/core/renderer/MCSizeFormatter.h b/src/core/renderer/MCSizeFormatter.h index a51373ae..0eb40f6b 100644 --- a/src/core/renderer/MCSizeFormatter.h +++ b/src/core/renderer/MCSizeFormatter.h @@ -14,6 +14,7 @@ #ifdef __cplusplus namespace mailcore { + class String; class SizeFormatter : public Object { diff --git a/src/core/rfc822/MCMessageBuilder.cc b/src/core/rfc822/MCMessageBuilder.cc index ecec743c..384bb4e5 100644 --- a/src/core/rfc822/MCMessageBuilder.cc +++ b/src/core/rfc822/MCMessageBuilder.cc @@ -21,20 +21,20 @@ part_new_empty(struct mailmime_content * content, static struct mailmime * get_multipart_alternative(const char * boundary_prefix) { - struct mailmime * mime; - - mime = part_multiple_new("multipart/alternative", boundary_prefix); - - return mime; + struct mailmime * mime; + + mime = part_multiple_new("multipart/alternative", boundary_prefix); + + return mime; } static struct mailmime * get_multipart_related(const char * boundary_prefix) { - struct mailmime * mime; - - mime = part_multiple_new("multipart/related", boundary_prefix); - - return mime; + struct mailmime * mime; + + mime = part_multiple_new("multipart/related", boundary_prefix); + + return mime; } static int add_attachment(struct mailmime * mime, @@ -134,41 +134,41 @@ err: static struct mailmime * get_text_part(const char * mime_type, const char * charset, const char * content_id, const char * description, - const char * text, size_t length, int encoding_type) -{ - struct mailmime_fields * mime_fields; - struct mailmime * mime; - struct mailmime_content * content; - struct mailmime_parameter * param; - struct mailmime_disposition * disposition; - struct mailmime_mechanism * encoding; - char * dup_content_id; + const char * text, size_t length, int encoding_type) +{ + struct mailmime_fields * mime_fields; + struct mailmime * mime; + struct mailmime_content * content; + struct mailmime_parameter * param; + struct mailmime_disposition * disposition; + struct mailmime_mechanism * encoding; + char * dup_content_id; char * dup_description; - encoding = mailmime_mechanism_new(encoding_type, NULL); - disposition = mailmime_disposition_new_with_data(MAILMIME_DISPOSITION_TYPE_INLINE, - NULL, NULL, NULL, NULL, (size_t) -1); + encoding = mailmime_mechanism_new(encoding_type, NULL); + disposition = mailmime_disposition_new_with_data(MAILMIME_DISPOSITION_TYPE_INLINE, + NULL, NULL, NULL, NULL, (size_t) -1); dup_content_id = NULL; if (content_id != NULL) dup_content_id = strdup(content_id); dup_description = NULL; if (dup_description != NULL) dup_description = strdup(description); - mime_fields = mailmime_fields_new_with_data(encoding, + mime_fields = mailmime_fields_new_with_data(encoding, dup_content_id, dup_description, disposition, NULL); - - content = mailmime_content_new_with_str(mime_type); - if (charset == NULL) { - param = mailmime_param_new_with_data((char *) "charset", (char *) "utf-8"); - } - else { - param = mailmime_param_new_with_data((char *) "charset", (char *) charset); - } - clist_append(content->ct_parameters, param); - mime = part_new_empty(content, mime_fields, NULL, 1); - mailmime_set_body_text(mime, (char *) text, length); - - return mime; + + content = mailmime_content_new_with_str(mime_type); + if (charset == NULL) { + param = mailmime_param_new_with_data((char *) "charset", (char *) "utf-8"); + } + else { + param = mailmime_param_new_with_data((char *) "charset", (char *) charset); + } + clist_append(content->ct_parameters, param); + mime = part_new_empty(content, mime_fields, NULL, 1); + mailmime_set_body_text(mime, (char *) text, length); + + return mime; } static struct mailmime * get_plain_text_part(const char * mime_type, const char * charset, const char * content_id, @@ -204,44 +204,44 @@ static struct mailmime * get_file_part(const char * filename, const char * mime_ const char * content_description, const char * text, size_t length) { - char * disposition_name; - int encoding_type; - struct mailmime_disposition * disposition; - struct mailmime_mechanism * encoding; - struct mailmime_content * content; - struct mailmime * mime; - struct mailmime_fields * mime_fields; - char * dup_content_id; + char * disposition_name; + int encoding_type; + struct mailmime_disposition * disposition; + struct mailmime_mechanism * encoding; + struct mailmime_content * content; + struct mailmime * mime; + struct mailmime_fields * mime_fields; + char * dup_content_id; char * dup_content_description; - disposition_name = NULL; - if (filename != NULL) { - disposition_name = strdup(filename); - } - if (is_inline) { - disposition = mailmime_disposition_new_with_data(MAILMIME_DISPOSITION_TYPE_INLINE, - disposition_name, NULL, NULL, NULL, (size_t) -1); - } - else { - disposition = mailmime_disposition_new_with_data(MAILMIME_DISPOSITION_TYPE_ATTACHMENT, - disposition_name, NULL, NULL, NULL, (size_t) -1); - } - content = mailmime_content_new_with_str(mime_type); - - encoding_type = MAILMIME_MECHANISM_BASE64; - encoding = mailmime_mechanism_new(encoding_type, NULL); + disposition_name = NULL; + if (filename != NULL) { + disposition_name = strdup(filename); + } + if (is_inline) { + disposition = mailmime_disposition_new_with_data(MAILMIME_DISPOSITION_TYPE_INLINE, + disposition_name, NULL, NULL, NULL, (size_t) -1); + } + else { + disposition = mailmime_disposition_new_with_data(MAILMIME_DISPOSITION_TYPE_ATTACHMENT, + disposition_name, NULL, NULL, NULL, (size_t) -1); + } + content = mailmime_content_new_with_str(mime_type); + + encoding_type = MAILMIME_MECHANISM_BASE64; + encoding = mailmime_mechanism_new(encoding_type, NULL); dup_content_id = NULL; if (content_id != NULL) dup_content_id = strdup(content_id); dup_content_description = NULL; if (content_description != NULL) dup_content_description = strdup(content_description); - mime_fields = mailmime_fields_new_with_data(encoding, - dup_content_id, dup_content_description, disposition, NULL); - mime = part_new_empty(content, mime_fields, NULL, 1); - mailmime_set_body_text(mime, (char *) text, length); - - return mime; + mime_fields = mailmime_fields_new_with_data(encoding, + dup_content_id, dup_content_description, disposition, NULL); + mime = part_new_empty(content, mime_fields, NULL, 1); + mailmime_set_body_text(mime, (char *) text, length); + + return mime; } #define MIME_ENCODED_STR(str) (str != NULL ? str->encodedMIMEHeaderValue()->bytes() : NULL) @@ -481,11 +481,11 @@ void MessageBuilder::init() { mHTMLBody = NULL; mTextBody = NULL; - mAttachments = NULL; - mRelatedAttachments = NULL; + mAttachments = NULL; + mRelatedAttachments = NULL; mBoundaryPrefix = NULL; } - + MessageBuilder::MessageBuilder() { init(); @@ -509,7 +509,7 @@ MessageBuilder::~MessageBuilder() MC_SAFE_RELEASE(mRelatedAttachments); MC_SAFE_RELEASE(mBoundaryPrefix); } - + String * MessageBuilder::description() { String * result = String::string(); diff --git a/src/core/rfc822/MCMessageBuilder.h b/src/core/rfc822/MCMessageBuilder.h index 6981e295..f592a7f3 100644 --- a/src/core/rfc822/MCMessageBuilder.h +++ b/src/core/rfc822/MCMessageBuilder.h @@ -8,37 +8,37 @@ #ifdef __cplusplus namespace mailcore { - - class Attachment; + + 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. + + 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 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(); @@ -47,20 +47,20 @@ namespace mailcore { virtual String * plainTextBodyRendering(bool stripWhitespace); public: // subclass behavior - MessageBuilder(MessageBuilder * other); - virtual String * description(); - virtual Object * copy(); + 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); - }; - + private: + String * mHTMLBody; + String * mTextBody; + Array * /* Attachment */ mAttachments; + Array * /* Attachment */ mRelatedAttachments; + String * mBoundaryPrefix; + void init(); + Data * dataAndFilterBcc(bool filterBcc); + }; + }; #endif diff --git a/src/core/rfc822/MCMessageParser.h b/src/core/rfc822/MCMessageParser.h index 7243730b..783799af 100644 --- a/src/core/rfc822/MCMessageParser.h +++ b/src/core/rfc822/MCMessageParser.h @@ -9,19 +9,19 @@ #ifdef __cplusplus namespace mailcore { - + class HTMLRendererTemplateCallback; - class MessageParser : public AbstractMessage { - public: - static MessageParser * messageParserWithData(Data * data); - static MessageParser * messageParserWithContentsOfFile(String * filename); - - MessageParser(Data * data); - virtual ~MessageParser(); - - virtual AbstractPart * mainPart(); - virtual Data * data(); + class MessageParser : public AbstractMessage { + public: + static MessageParser * messageParserWithData(Data * data); + static MessageParser * messageParserWithContentsOfFile(String * filename); + + MessageParser(Data * data); + virtual ~MessageParser(); + + virtual AbstractPart * mainPart(); + virtual Data * data(); virtual String * htmlRendering(HTMLRendererTemplateCallback * htmlCallback = NULL); virtual String * htmlBodyRendering(); @@ -30,20 +30,20 @@ namespace mailcore { virtual String * plainTextBodyRendering(bool stripWhitespace); public: // subclass behavior - MessageParser(MessageParser * other); - virtual String * description(); - virtual Object * copy(); + MessageParser(MessageParser * other); + virtual String * description(); + virtual Object * copy(); virtual AbstractPart * partForContentID(String * contentID); virtual AbstractPart * partForUniqueID(String * uniqueID); - private: - Data * mData; - AbstractPart * mMainPart; - void init(); - - }; - + private: + Data * mData; + AbstractPart * mMainPart; + void init(); + + }; + }; #endif diff --git a/src/core/rfc822/MCMessagePart.h b/src/core/rfc822/MCMessagePart.h index 6dd5eb7f..6311e5e2 100644 --- a/src/core/rfc822/MCMessagePart.h +++ b/src/core/rfc822/MCMessagePart.h @@ -8,16 +8,17 @@ #ifdef __cplusplus namespace mailcore { - - class MessagePart : public AbstractMessagePart { - public: - MessagePart(); - virtual ~MessagePart(); + + class MessagePart : public AbstractMessagePart { + public: + MessagePart(); + virtual ~MessagePart(); public: // subclass behavior - MessagePart(MessagePart * other); - virtual Object * copy(); - }; + MessagePart(MessagePart * other); + virtual Object * copy(); + }; + } #endif diff --git a/src/core/rfc822/MCMultipart.h b/src/core/rfc822/MCMultipart.h index f65e8993..1eada13d 100644 --- a/src/core/rfc822/MCMultipart.h +++ b/src/core/rfc822/MCMultipart.h @@ -8,16 +8,17 @@ #ifdef __cplusplus namespace mailcore { - - class Multipart : public AbstractMultipart { - public: - Multipart(); - virtual ~Multipart(); - + + class Multipart : public AbstractMultipart { + public: + Multipart(); + virtual ~Multipart(); + public: // subclass behavior - Multipart(Multipart * other); - virtual Object * copy(); - }; + Multipart(Multipart * other); + virtual Object * copy(); + }; + } #endif diff --git a/src/core/security/MCCertificateUtils.h b/src/core/security/MCCertificateUtils.h index 0fcd9749..a62d6b6e 100644 --- a/src/core/security/MCCertificateUtils.h +++ b/src/core/security/MCCertificateUtils.h @@ -13,9 +13,9 @@ #include <MailCore/MCString.h> namespace mailcore { - + bool checkCertificate(mailstream * stream, String * hostname); - + } #endif diff --git a/src/core/smtp/MCSMTPProgressCallback.h b/src/core/smtp/MCSMTPProgressCallback.h index d1c85e41..dd1b6ec5 100644 --- a/src/core/smtp/MCSMTPProgressCallback.h +++ b/src/core/smtp/MCSMTPProgressCallback.h @@ -5,13 +5,14 @@ #ifdef __cplusplus namespace mailcore { - - class SMTPSession; - - class SMTPProgressCallback { - public: - virtual void bodyProgress(SMTPSession * session, unsigned int current, unsigned int maximum) {}; - }; + + class SMTPSession; + + class SMTPProgressCallback { + public: + virtual void bodyProgress(SMTPSession * session, unsigned int current, unsigned int maximum) {}; + }; + } #endif diff --git a/src/core/smtp/MCSMTPSession.h b/src/core/smtp/MCSMTPSession.h index 04153c7a..f5396ebb 100644 --- a/src/core/smtp/MCSMTPSession.h +++ b/src/core/smtp/MCSMTPSession.h @@ -12,7 +12,7 @@ namespace mailcore { class Address; class SMTPProgressCallback; class MessageBuilder; - + class SMTPSession : public Object { public: SMTPSession(); @@ -20,27 +20,27 @@ namespace mailcore { 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(); diff --git a/src/core/zip/MCZip.cc b/src/core/zip/MCZip.cc index 03e1f2ad..6f368182 100644 --- a/src/core/zip/MCZip.cc +++ b/src/core/zip/MCZip.cc @@ -14,15 +14,15 @@ static ErrorCode addFile(zipFile file, String * path); ErrorCode mailcore::CreateZipFileFromFolder(String * zipFilename, String * path) { - zipFile file = zipOpen(zipFilename->fileSystemRepresentation(), APPEND_STATUS_CREATE); - if (file == NULL) { + zipFile file = zipOpen(zipFilename->fileSystemRepresentation(), APPEND_STATUS_CREATE); + if (file == NULL) { return ErrorFile; - } + } addFile(file, path); - int err = zipClose(file, NULL); - if (err != ZIP_OK) { + int err = zipClose(file, NULL); + if (err != ZIP_OK) { return ErrorFile; } @@ -64,17 +64,17 @@ static ErrorCode addFile(zipFile file, String * path) time(&clock); struct tm timevalue; - zip_fileinfo zi; + zip_fileinfo zi; gmtime_r(&clock, &timevalue); - zi.tmz_date.tm_sec = timevalue.tm_sec; - zi.tmz_date.tm_min = timevalue.tm_min; - zi.tmz_date.tm_hour = timevalue.tm_hour; - zi.tmz_date.tm_mday = timevalue.tm_mday; - zi.tmz_date.tm_mon = timevalue.tm_mon; - zi.tmz_date.tm_year = timevalue.tm_year; - zi.internal_fa = 0; - zi.external_fa = 0; - zi.dosDate = 0; + zi.tmz_date.tm_sec = timevalue.tm_sec; + zi.tmz_date.tm_min = timevalue.tm_min; + zi.tmz_date.tm_hour = timevalue.tm_hour; + zi.tmz_date.tm_mday = timevalue.tm_mday; + zi.tmz_date.tm_mon = timevalue.tm_mon; + zi.tmz_date.tm_year = timevalue.tm_year; + zi.internal_fa = 0; + zi.external_fa = 0; + zi.dosDate = 0; err = zipOpenNewFileInZip3(file, path->lastPathComponent()->fileSystemRepresentation(), &zi, NULL, 0, NULL, 0, NULL, @@ -113,7 +113,7 @@ static ErrorCode addFile(zipFile file, String * path) fclose(f); - err = zipCloseFileInZip(file); + err = zipCloseFileInZip(file); if (err != ZIP_OK) { return ErrorFile; } diff --git a/src/core/zip/MCZip.h b/src/core/zip/MCZip.h index 28dcf39e..f51d1a98 100644 --- a/src/core/zip/MCZip.h +++ b/src/core/zip/MCZip.h @@ -6,10 +6,12 @@ #include <MailCore/MCBaseTypes.h> namespace mailcore { + ErrorCode CreateZipFileFromFolder(String * zipFilename, String * folder); String * CreateTemporaryZipFileFromFolder(String * folder); void RemoveTemporaryZipFile(String * zipFilename); + }; #endif diff --git a/src/objc/abstract/MCOAbstractPart.mm b/src/objc/abstract/MCOAbstractPart.mm index a2dcaeeb..d55422d5 100644 --- a/src/objc/abstract/MCOAbstractPart.mm +++ b/src/objc/abstract/MCOAbstractPart.mm @@ -85,6 +85,6 @@ MCO_OBJC_SYNTHESIZE_BOOL(setInlineAttachment, isInlineAttachment) - (NSString *) decodedStringForData:(NSData *)data { - return [NSString mco_stringWithMCString:MCO_NATIVE_INSTANCE->decodedStringForData([data mco_mcData])]; + return [NSString mco_stringWithMCString:MCO_NATIVE_INSTANCE->decodedStringForData([data mco_mcData])]; } @end diff --git a/src/objc/abstract/MCOAddress.mm b/src/objc/abstract/MCOAddress.mm index 4bdcea03..679df967 100644 --- a/src/objc/abstract/MCOAddress.mm +++ b/src/objc/abstract/MCOAddress.mm @@ -99,12 +99,12 @@ MCO_SYNTHESIZE_NSCODING + (NSArray *) addressesWithRFC822String:(NSString *)string { - return [NSArray mco_arrayWithMCArray:mailcore::Address::addressesWithRFC822String(string.mco_mcString)]; + return [NSArray mco_arrayWithMCArray:mailcore::Address::addressesWithRFC822String(string.mco_mcString)]; } + (NSArray *) addressesWithNonEncodedRFC822String:(NSString *)string { - return [NSArray mco_arrayWithMCArray:mailcore::Address::addressesWithNonEncodedRFC822String(string.mco_mcString)]; + return [NSArray mco_arrayWithMCArray:mailcore::Address::addressesWithNonEncodedRFC822String(string.mco_mcString)]; } @@ -165,12 +165,12 @@ MCO_OBJC_SYNTHESIZE_STRING(setMailbox, mailbox) - (NSString *) mco_RFC822StringForAddresses { - return [NSString mco_stringWithMCString:mailcore::Address::RFC822StringForAddresses([self mco_mcArray])]; + return [NSString mco_stringWithMCString:mailcore::Address::RFC822StringForAddresses([self mco_mcArray])]; } - (NSString *) mco_nonEncodedRFC822StringForAddresses { - return [NSString mco_stringWithMCString:mailcore::Address::nonEncodedRFC822StringForAddresses([self mco_mcArray ])]; + return [NSString mco_stringWithMCString:mailcore::Address::nonEncodedRFC822StringForAddresses([self mco_mcArray ])]; } @end diff --git a/src/objc/imap/MCOIMAPAppendMessageOperation.mm b/src/objc/imap/MCOIMAPAppendMessageOperation.mm index 72fb0343..042324b3 100644 --- a/src/objc/imap/MCOIMAPAppendMessageOperation.mm +++ b/src/objc/imap/MCOIMAPAppendMessageOperation.mm @@ -50,9 +50,9 @@ typedef void (^CompletionType)(NSError *error, uint32_t createdUID); - (void) cancel { - [_completionBlock release]; - _completionBlock = nil; - [super cancel]; + [_completionBlock release]; + _completionBlock = nil; + [super cancel]; } - (void) operationCompleted diff --git a/src/objc/imap/MCOIMAPCapabilityOperation.mm b/src/objc/imap/MCOIMAPCapabilityOperation.mm index 75f28610..1f718895 100644 --- a/src/objc/imap/MCOIMAPCapabilityOperation.mm +++ b/src/objc/imap/MCOIMAPCapabilityOperation.mm @@ -46,9 +46,9 @@ typedef void (^CompletionType)(NSError *error, MCOIndexSet * capabilities); - (void) cancel { - [_completionBlock release]; - _completionBlock = nil; - [super cancel]; + [_completionBlock release]; + _completionBlock = nil; + [super cancel]; } - (void) operationCompleted diff --git a/src/objc/imap/MCOIMAPCopyMessagesOperation.mm b/src/objc/imap/MCOIMAPCopyMessagesOperation.mm index eeee2e4a..9e9874f4 100644 --- a/src/objc/imap/MCOIMAPCopyMessagesOperation.mm +++ b/src/objc/imap/MCOIMAPCopyMessagesOperation.mm @@ -47,9 +47,9 @@ typedef void (^CompletionType)(NSError *error, MCOIndexSet * destUids); - (void) cancel { - [_completionBlock release]; - _completionBlock = nil; - [super cancel]; + [_completionBlock release]; + _completionBlock = nil; + [super cancel]; } - (void) operationCompleted diff --git a/src/objc/imap/MCOIMAPFetchContentOperation.mm b/src/objc/imap/MCOIMAPFetchContentOperation.mm index 14867548..791307ca 100644 --- a/src/objc/imap/MCOIMAPFetchContentOperation.mm +++ b/src/objc/imap/MCOIMAPFetchContentOperation.mm @@ -49,9 +49,9 @@ typedef void (^CompletionType)(NSError *error, NSData * data); - (void) cancel { - [_completionBlock release]; - _completionBlock = nil; - [super cancel]; + [_completionBlock release]; + _completionBlock = nil; + [super cancel]; } - (void) operationCompleted diff --git a/src/objc/imap/MCOIMAPFetchFoldersOperation.mm b/src/objc/imap/MCOIMAPFetchFoldersOperation.mm index facccca3..b0965401 100644 --- a/src/objc/imap/MCOIMAPFetchFoldersOperation.mm +++ b/src/objc/imap/MCOIMAPFetchFoldersOperation.mm @@ -51,9 +51,9 @@ typedef void (^CompletionType)(NSError *error, NSArray *folder); - (void) cancel { - [_completionBlock release]; - _completionBlock = nil; - [super cancel]; + [_completionBlock release]; + _completionBlock = nil; + [super cancel]; } - (void)operationCompleted diff --git a/src/objc/imap/MCOIMAPFetchMessagesOperation.mm b/src/objc/imap/MCOIMAPFetchMessagesOperation.mm index b310c022..bd86d99b 100644 --- a/src/objc/imap/MCOIMAPFetchMessagesOperation.mm +++ b/src/objc/imap/MCOIMAPFetchMessagesOperation.mm @@ -46,9 +46,9 @@ typedef void (^CompletionType)(NSError *error, NSArray * messages, MCOIndexSet * - (void) cancel { - [_completionBlock release]; - _completionBlock = nil; - [super cancel]; + [_completionBlock release]; + _completionBlock = nil; + [super cancel]; } - (void) operationCompleted diff --git a/src/objc/imap/MCOIMAPFetchNamespaceOperation.mm b/src/objc/imap/MCOIMAPFetchNamespaceOperation.mm index 33ff132c..5e5e9954 100644 --- a/src/objc/imap/MCOIMAPFetchNamespaceOperation.mm +++ b/src/objc/imap/MCOIMAPFetchNamespaceOperation.mm @@ -46,9 +46,9 @@ typedef void (^CompletionType)(NSError *error, NSDictionary * namespaces); - (void) cancel { - [_completionBlock release]; - _completionBlock = nil; - [super cancel]; + [_completionBlock release]; + _completionBlock = nil; + [super cancel]; } - (void) operationCompleted diff --git a/src/objc/imap/MCOIMAPFolderInfoOperation.mm b/src/objc/imap/MCOIMAPFolderInfoOperation.mm index dffff6fa..7ea8e887 100644 --- a/src/objc/imap/MCOIMAPFolderInfoOperation.mm +++ b/src/objc/imap/MCOIMAPFolderInfoOperation.mm @@ -47,9 +47,9 @@ typedef void (^CompletionType)(NSError *error, MCOIMAPFolderInfo *info); - (void) cancel { - [_completionBlock release]; - _completionBlock = nil; - [super cancel]; + [_completionBlock release]; + _completionBlock = nil; + [super cancel]; } - (void) operationCompleted diff --git a/src/objc/imap/MCOIMAPFolderStatus.mm b/src/objc/imap/MCOIMAPFolderStatus.mm index 7cd1597d..1214bdff 100644 --- a/src/objc/imap/MCOIMAPFolderStatus.mm +++ b/src/objc/imap/MCOIMAPFolderStatus.mm @@ -14,7 +14,7 @@ #define nativeType mailcore::IMAPFolderStatus @implementation MCOIMAPFolderStatus { - mailcore::IMAPFolderStatus * _nativeStatus; + mailcore::IMAPFolderStatus * _nativeStatus; } + (void) load diff --git a/src/objc/imap/MCOIMAPIdentityOperation.mm b/src/objc/imap/MCOIMAPIdentityOperation.mm index b5d65f9a..c21c68ab 100644 --- a/src/objc/imap/MCOIMAPIdentityOperation.mm +++ b/src/objc/imap/MCOIMAPIdentityOperation.mm @@ -46,9 +46,9 @@ typedef void (^CompletionType)(NSError *error, NSDictionary * serverIdentity); - (void) cancel { - [_completionBlock release]; - _completionBlock = nil; - [super cancel]; + [_completionBlock release]; + _completionBlock = nil; + [super cancel]; } - (void) operationCompleted diff --git a/src/objc/imap/MCOIMAPIdleOperation.mm b/src/objc/imap/MCOIMAPIdleOperation.mm index eddf1fcf..e9cb2dec 100644 --- a/src/objc/imap/MCOIMAPIdleOperation.mm +++ b/src/objc/imap/MCOIMAPIdleOperation.mm @@ -46,9 +46,9 @@ typedef void (^CompletionType)(NSError *error); - (void) cancel { - [_completionBlock release]; - _completionBlock = nil; - [super cancel]; + [_completionBlock release]; + _completionBlock = nil; + [super cancel]; } - (void) operationCompleted diff --git a/src/objc/imap/MCOIMAPOperation.mm b/src/objc/imap/MCOIMAPOperation.mm index fafec6f2..7cbdd79f 100644 --- a/src/objc/imap/MCOIMAPOperation.mm +++ b/src/objc/imap/MCOIMAPOperation.mm @@ -35,9 +35,9 @@ typedef void (^CompletionType)(NSError *error); - (void) cancel { - [_completionBlock release]; - _completionBlock = nil; - [super cancel]; + [_completionBlock release]; + _completionBlock = nil; + [super cancel]; } - (void) operationCompleted diff --git a/src/objc/imap/MCOIMAPSearchOperation.mm b/src/objc/imap/MCOIMAPSearchOperation.mm index 4117a7a7..b605ea3a 100644 --- a/src/objc/imap/MCOIMAPSearchOperation.mm +++ b/src/objc/imap/MCOIMAPSearchOperation.mm @@ -47,9 +47,9 @@ typedef void (^CompletionType)(NSError *error, MCOIndexSet * searchResult); - (void) cancel { - [_completionBlock release]; - _completionBlock = nil; - [super cancel]; + [_completionBlock release]; + _completionBlock = nil; + [super cancel]; } - (void) operationCompleted diff --git a/src/objc/provider/MCOMailProvider.mm b/src/objc/provider/MCOMailProvider.mm index da328dad..73be461f 100644 --- a/src/objc/provider/MCOMailProvider.mm +++ b/src/objc/provider/MCOMailProvider.mm @@ -18,7 +18,7 @@ #import "NSObject+MCO.h" @implementation MCOMailProvider { - mailcore::MailProvider * _provider; + mailcore::MailProvider * _provider; } #define nativeType mailcore::MailProvider @@ -41,22 +41,22 @@ - (id) initWithInfo:(NSDictionary *)info { - self = [super init]; - - _provider = mailcore::MailProvider::providerWithInfo([info mco_mcHashMap]); + self = [super init]; + + _provider = mailcore::MailProvider::providerWithInfo([info mco_mcHashMap]); _provider->retain(); - - return self; + + return self; } - (id) initWithMCProvider:(mailcore::MailProvider *)provider { - self = [super init]; - - _provider = provider; + self = [super init]; + + _provider = provider; _provider->retain(); - - return self; + + return self; } MCO_OBJC_SYNTHESIZE_STRING(setIdentifier, identifier); @@ -78,12 +78,12 @@ MCO_OBJC_SYNTHESIZE_STRING(setIdentifier, identifier); - (BOOL) matchEmail:(NSString *)email { - return _provider->matchEmail(email.mco_mcString); + return _provider->matchEmail(email.mco_mcString); } - (BOOL) matchMX:(NSString *)hostname { - return _provider->matchMX(hostname.mco_mcString); + return _provider->matchMX(hostname.mco_mcString); } - (NSString *) sentMailFolderPath @@ -123,7 +123,7 @@ MCO_OBJC_SYNTHESIZE_STRING(setIdentifier, identifier); - (BOOL) isMainFolder:(NSString *)folderPath prefix:(NSString *)prefix { - return _provider->isMainFolder(folderPath.mco_mcString, prefix.mco_mcString); + return _provider->isMainFolder(folderPath.mco_mcString, prefix.mco_mcString); } @end diff --git a/src/objc/provider/MCOMailProvidersManager.mm b/src/objc/provider/MCOMailProvidersManager.mm index 7dc38e77..c61b25cf 100644 --- a/src/objc/provider/MCOMailProvidersManager.mm +++ b/src/objc/provider/MCOMailProvidersManager.mm @@ -36,7 +36,7 @@ if (filename) { mailcore::MailProvidersManager::sharedManager()->registerProvidersWithFilename(filename.mco_mcString); } - + return self; } |