diff options
-rw-r--r-- | build-mac/mailcore2.xcodeproj/project.pbxproj | 8 | ||||
-rw-r--r-- | src/core/imap/MCIMAPSession.cc | 10 | ||||
-rw-r--r-- | src/core/imap/MCIMAPSession.h | 5 | ||||
-rw-r--r-- | src/core/renderer/MCMessageRendererHelper.cpp | 33 | ||||
-rw-r--r-- | src/core/renderer/MCMessageRendererHelper.h | 38 |
5 files changed, 12 insertions, 82 deletions
diff --git a/build-mac/mailcore2.xcodeproj/project.pbxproj b/build-mac/mailcore2.xcodeproj/project.pbxproj index 846b2ccb..0c4cb130 100644 --- a/build-mac/mailcore2.xcodeproj/project.pbxproj +++ b/build-mac/mailcore2.xcodeproj/project.pbxproj @@ -675,8 +675,6 @@ C6F61FB61702B5290073032E /* MCOIMAPBaseOperation.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6F61FB31702AB2A0073032E /* MCOIMAPBaseOperation.h */; }; DA0F1C7B177C07B300F0D3B4 /* MCIMAPMessageRenderingOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = DA0F1C79177C07B300F0D3B4 /* MCIMAPMessageRenderingOperation.cc */; }; DA0F1C7C177C07B300F0D3B4 /* MCIMAPMessageRenderingOperation.cc in Sources */ = {isa = PBXBuildFile; fileRef = DA0F1C79177C07B300F0D3B4 /* MCIMAPMessageRenderingOperation.cc */; }; - DAD1C7D8177E92650011AC59 /* MCMessageRendererHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DAD1C7D6177E92650011AC59 /* MCMessageRendererHelper.cpp */; }; - DAD1C7D9177E92650011AC59 /* MCMessageRendererHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DAD1C7D6177E92650011AC59 /* MCMessageRendererHelper.cpp */; }; DAD28C8B1783CFFC00F2BB8F /* MCHTMLBodyRendererCallback.cc in Sources */ = {isa = PBXBuildFile; fileRef = DAD28C891783CFFC00F2BB8F /* MCHTMLBodyRendererCallback.cc */; }; DAD28C8C1783CFFC00F2BB8F /* MCHTMLBodyRendererCallback.cc in Sources */ = {isa = PBXBuildFile; fileRef = DAD28C891783CFFC00F2BB8F /* MCHTMLBodyRendererCallback.cc */; }; F87F190C16BB62B00012652F /* MCOIMAPFetchFoldersOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = F87F190B16BB62B00012652F /* MCOIMAPFetchFoldersOperation.mm */; }; @@ -1457,8 +1455,6 @@ C6F61FB41702AB2F0073032E /* MCOIMAPBaseOperation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCOIMAPBaseOperation.mm; sourceTree = "<group>"; }; DA0F1C79177C07B300F0D3B4 /* MCIMAPMessageRenderingOperation.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCIMAPMessageRenderingOperation.cc; sourceTree = "<group>"; }; DA0F1C7A177C07B300F0D3B4 /* MCIMAPMessageRenderingOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCIMAPMessageRenderingOperation.h; sourceTree = "<group>"; }; - DAD1C7D6177E92650011AC59 /* MCMessageRendererHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCMessageRendererHelper.cpp; sourceTree = "<group>"; }; - DAD1C7D7177E92650011AC59 /* MCMessageRendererHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCMessageRendererHelper.h; sourceTree = "<group>"; }; DAD28C891783CFFC00F2BB8F /* MCHTMLBodyRendererCallback.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MCHTMLBodyRendererCallback.cc; sourceTree = "<group>"; }; DAD28C8A1783CFFC00F2BB8F /* MCHTMLBodyRendererCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCHTMLBodyRendererCallback.h; sourceTree = "<group>"; }; F87F190816BB62690012652F /* MCOIMAPFetchFoldersOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCOIMAPFetchFoldersOperation.h; sourceTree = "<group>"; }; @@ -1557,8 +1553,6 @@ C63CD68416BE148B00DB18F1 /* MCHTMLRendererCallback.cc */, C63CD68516BE148B00DB18F1 /* MCHTMLRendererCallback.h */, C63CD68716BE1AB600DB18F1 /* MCRenderer.h */, - DAD1C7D6177E92650011AC59 /* MCMessageRendererHelper.cpp */, - DAD1C7D7177E92650011AC59 /* MCMessageRendererHelper.h */, DAD28C891783CFFC00F2BB8F /* MCHTMLBodyRendererCallback.cc */, DAD28C8A1783CFFC00F2BB8F /* MCHTMLBodyRendererCallback.h */, ); @@ -2505,7 +2499,6 @@ 9EF9AB11175F319A0027FA3B /* MCIMAPFolderStatusOperation.cc in Sources */, 9EF9AB19175F36600027FA3B /* MCOIMAPFolderStatusOperation.mm in Sources */, 9E774D891767C7F60065EB9B /* MCIMAPFolderStatus.cc in Sources */, - DAD1C7D8177E92650011AC59 /* MCMessageRendererHelper.cpp in Sources */, DAD28C8B1783CFFC00F2BB8F /* MCHTMLBodyRendererCallback.cc in Sources */, BD63713B177DFF080094121B /* MCLibetpan.cpp in Sources */, ); @@ -2690,7 +2683,6 @@ 9EF9AB12175F319A0027FA3B /* MCIMAPFolderStatusOperation.cc in Sources */, 9EF9AB1A175F36600027FA3B /* MCOIMAPFolderStatusOperation.mm in Sources */, 9E774D8A1767C7F60065EB9B /* MCIMAPFolderStatus.cc in Sources */, - DAD1C7D9177E92650011AC59 /* MCMessageRendererHelper.cpp in Sources */, DAD28C8C1783CFFC00F2BB8F /* MCHTMLBodyRendererCallback.cc in Sources */, BD63713C177DFF080094121B /* MCLibetpan.cpp in Sources */, ); diff --git a/src/core/imap/MCIMAPSession.cc b/src/core/imap/MCIMAPSession.cc index ce2263c4..fa22dfc7 100644 --- a/src/core/imap/MCIMAPSession.cc +++ b/src/core/imap/MCIMAPSession.cc @@ -349,6 +349,8 @@ void IMAPSession::init() mProgressCallback = NULL; mProgressItemsCount = 0; mConnectionLogger = NULL; + mDataCallback = new HTMLRendererIMAPCallback(); + mHtmlCallback = new HTMLBodyRendererTemplateCallback(); } IMAPSession::IMAPSession() @@ -366,6 +368,8 @@ IMAPSession::~IMAPSession() MC_SAFE_RELEASE(mDefaultNamespace); MC_SAFE_RELEASE(mCurrentFolder); pthread_mutex_destroy(&mIdleLock); + MC_SAFE_RELEASE(mDataCallback); + MC_SAFE_RELEASE(mHtmlCallback); } void IMAPSession::setHostname(String * hostname) @@ -3027,7 +3031,7 @@ String * IMAPSession::htmlRendering(IMAPMessage * message, String * folder) MessageRendererHelper * messageRendererHelper = new MessageRendererHelper; String * htmlString = HTMLRenderer::htmlForIMAPMessage(folder, message, - messageRendererHelper->dataCallback(), + mDataCallback, NULL); return htmlString; @@ -3039,8 +3043,8 @@ String * IMAPSession::htmlBodyRendering(IMAPMessage * message, String * folder) String * htmlBodyString = HTMLRenderer::htmlForIMAPMessage(folder, message, - messageRendererHelper->dataCallback(), - messageRendererHelper->htmlBodyCallback()); + mDataCallback, + mHtmlBodyCallback); return htmlBodyString; } diff --git a/src/core/imap/MCIMAPSession.h b/src/core/imap/MCIMAPSession.h index 53510b0b..a2b9cc60 100644 --- a/src/core/imap/MCIMAPSession.h +++ b/src/core/imap/MCIMAPSession.h @@ -5,6 +5,8 @@ #include <MailCore/MCBaseTypes.h> #include <MailCore/MCMessageConstants.h> #include <MailCore/MCIMAPMessage.h> +#include <MailCore/MCHTMLRendererCallback.h> +#include <MailCore/MCHTMLBodyRendererCallback.h> #ifdef __cplusplus @@ -192,6 +194,9 @@ namespace mailcore { unsigned int mProgressItemsCount; ConnectionLogger * mConnectionLogger; + HTMLRendererIMAPCallback * mDataCallback; + HTMLBodyRendererTemplateCallback * mHtmlCallback; + void init(); void bodyProgress(unsigned int current, unsigned int maximum); void itemsProgress(unsigned int current, unsigned int maximum); diff --git a/src/core/renderer/MCMessageRendererHelper.cpp b/src/core/renderer/MCMessageRendererHelper.cpp deleted file mode 100644 index bd4a1745..00000000 --- a/src/core/renderer/MCMessageRendererHelper.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// -// MCMessageRendererHelper.cpp -// mailcore2 -// -// Created by Paul Young on 28/06/2013. -// Copyright (c) 2013 MailCore. All rights reserved. -// - -#include "MCMessageRendererHelper.h" - -using namespace mailcore; - -MessageRendererHelper::MessageRendererHelper() -{ - mDataCallback = new HTMLRendererIMAPCallback(); - mHtmlCallback = new HTMLBodyRendererTemplateCallback(); -} - -MessageRendererHelper::~MessageRendererHelper() -{ - MC_SAFE_RELEASE(mDataCallback); - MC_SAFE_RELEASE(mHtmlCallback); -} - -HTMLRendererIMAPCallback * MessageRendererHelper::dataCallback() -{ - return mDataCallback; -} - -HTMLBodyRendererTemplateCallback * MessageRendererHelper::htmlBodyCallback() -{ - return mHtmlCallback; -} diff --git a/src/core/renderer/MCMessageRendererHelper.h b/src/core/renderer/MCMessageRendererHelper.h deleted file mode 100644 index 716c91a2..00000000 --- a/src/core/renderer/MCMessageRendererHelper.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// MCMessageRendererHelper.h -// mailcore2 -// -// Created by Paul Young on 28/06/2013. -// Copyright (c) 2013 MailCore. All rights reserved. -// - -#ifndef __MAILCORE_MCMESSAGERENDERERHELPER_H_ - -#define __MAILCORE_MCMESSAGERENDERERHELPER_H_ - -#include "MCHTMLRendererCallback.h" -#include "MCHTMLBodyRendererCallback.h" -#include "MCIMAPSession.h" - -#ifdef __cplusplus - -namespace mailcore { - - class MessageRendererHelper { - public: - MessageRendererHelper(); - ~MessageRendererHelper(); - - virtual HTMLRendererIMAPCallback * dataCallback(); - virtual HTMLBodyRendererTemplateCallback * htmlBodyCallback(); - - private: - HTMLRendererIMAPCallback * mDataCallback; - HTMLBodyRendererTemplateCallback * mHtmlCallback; - - }; -} - -#endif - -#endif |