aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Paul Young <paulyoungonline@gmail.com>2013-06-29 00:25:58 -0400
committerGravatar Paul Young <paulyoungonline@gmail.com>2013-06-29 00:25:58 -0400
commit7ee045b6cefac380bfc1dc5f9dd8948c651c0c8d (patch)
tree05bd382d19fadea9982cc7ec5f77314ea3be0e28
parent3dafb66675de3e0ee1913605ef4c8227c8b7f129 (diff)
WIP: Message Renderer Helper
* Created a generic message renderer helper class. * Renamed "msg" to "message" in session rendering methods.
-rw-r--r--build-mac/mailcore2.xcodeproj/project.pbxproj8
-rw-r--r--src/core/imap/MCIMAPSession.cc12
-rw-r--r--src/core/imap/MCIMAPSession.h8
-rw-r--r--src/core/renderer/MCMessageRendererHelper.cpp41
-rw-r--r--src/core/renderer/MCMessageRendererHelper.h39
5 files changed, 100 insertions, 8 deletions
diff --git a/build-mac/mailcore2.xcodeproj/project.pbxproj b/build-mac/mailcore2.xcodeproj/project.pbxproj
index 02657c45..28557af4 100644
--- a/build-mac/mailcore2.xcodeproj/project.pbxproj
+++ b/build-mac/mailcore2.xcodeproj/project.pbxproj
@@ -673,6 +673,8 @@
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 */; };
F87F190C16BB62B00012652F /* MCOIMAPFetchFoldersOperation.mm in Sources */ = {isa = PBXBuildFile; fileRef = F87F190B16BB62B00012652F /* MCOIMAPFetchFoldersOperation.mm */; };
F8EA941716BB1C9D0011AC6F /* MCOIMAPSession.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = F8EA941416BAED6E0011AC6F /* MCOIMAPSession.h */; };
/* End PBXBuildFile section */
@@ -1449,6 +1451,8 @@
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>"; };
F87F190816BB62690012652F /* MCOIMAPFetchFoldersOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCOIMAPFetchFoldersOperation.h; sourceTree = "<group>"; };
F87F190B16BB62B00012652F /* MCOIMAPFetchFoldersOperation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MCOIMAPFetchFoldersOperation.mm; sourceTree = "<group>"; };
F8EA941416BAED6E0011AC6F /* MCOIMAPSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCOIMAPSession.h; sourceTree = "<group>"; };
@@ -1545,6 +1549,8 @@
C63CD68416BE148B00DB18F1 /* MCHTMLRendererCallback.cc */,
C63CD68516BE148B00DB18F1 /* MCHTMLRendererCallback.h */,
C63CD68716BE1AB600DB18F1 /* MCRenderer.h */,
+ DAD1C7D6177E92650011AC59 /* MCMessageRendererHelper.cpp */,
+ DAD1C7D7177E92650011AC59 /* MCMessageRendererHelper.h */,
);
path = renderer;
sourceTree = "<group>";
@@ -2487,6 +2493,7 @@
9EF9AB11175F319A0027FA3B /* MCIMAPFolderStatusOperation.cc in Sources */,
9EF9AB19175F36600027FA3B /* MCOIMAPFolderStatusOperation.mm in Sources */,
9E774D891767C7F60065EB9B /* MCIMAPFolderStatus.cc in Sources */,
+ DAD1C7D8177E92650011AC59 /* MCMessageRendererHelper.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2669,6 +2676,7 @@
9EF9AB12175F319A0027FA3B /* MCIMAPFolderStatusOperation.cc in Sources */,
9EF9AB1A175F36600027FA3B /* MCOIMAPFolderStatusOperation.mm in Sources */,
9E774D8A1767C7F60065EB9B /* MCIMAPFolderStatus.cc in Sources */,
+ DAD1C7D9177E92650011AC59 /* MCMessageRendererHelper.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/src/core/imap/MCIMAPSession.cc b/src/core/imap/MCIMAPSession.cc
index 784def6e..5afb8702 100644
--- a/src/core/imap/MCIMAPSession.cc
+++ b/src/core/imap/MCIMAPSession.cc
@@ -16,6 +16,8 @@
#include "MCIMAPFolderStatus.h"
#include "MCConnectionLogger.h"
#include "MCConnectionLoggerUtils.h"
+#include "MCHTMLRenderer.h"
+#include "MCMessageRendererHelper.h"
using namespace mailcore;
@@ -2999,22 +3001,24 @@ ConnectionLogger * IMAPSession::connectionLogger()
return mConnectionLogger;
}
-String * htmlRendering(IMAPMessage * msg, String * folder)
+String * htmlRendering(IMAPMessage * message, String * folder)
{
+ MessageRendererHelper * messageRendererHelper = new MessageRendererHelper;
+ HTMLRenderer::htmlForIMAPMessage(folder, message, messageRendererHelper->dataCallback, messageRendererHelper->htmlCallback);
}
-String * htmlBodyRendering(IMAPMessage * msg, String * folder)
+String * htmlBodyRendering(IMAPMessage * message, String * folder)
{
}
-String * plainTextRendering(IMAPMessage * msg, String * folder)
+String * plainTextRendering(IMAPMessage * message, String * folder)
{
}
-String * plainTextBodyRendering(IMAPMessage * msg, String * folder)
+String * plainTextBodyRendering(IMAPMessage * message, String * folder)
{
}
diff --git a/src/core/imap/MCIMAPSession.h b/src/core/imap/MCIMAPSession.h
index 9d1cf0a2..5d72f551 100644
--- a/src/core/imap/MCIMAPSession.h
+++ b/src/core/imap/MCIMAPSession.h
@@ -136,11 +136,11 @@ namespace mailcore {
virtual void setConnectionLogger(ConnectionLogger * logger);
virtual ConnectionLogger * connectionLogger();
- virtual String * htmlRendering(IMAPMessage * msg, String * folder);
- virtual String * htmlBodyRendering(IMAPMessage * msg, String * folder);
+ virtual String * htmlRendering(IMAPMessage * message, String * folder);
+ virtual String * htmlBodyRendering(IMAPMessage * message, String * folder);
- virtual String * plainTextRendering(IMAPMessage * msg, String * folder);
- virtual String * plainTextBodyRendering(IMAPMessage * msg, String * folder);
+ virtual String * plainTextRendering(IMAPMessage * message, String * folder);
+ virtual String * plainTextBodyRendering(IMAPMessage * message, String * folder);
public: // private
virtual void loginIfNeeded(ErrorCode * pError);
diff --git a/src/core/renderer/MCMessageRendererHelper.cpp b/src/core/renderer/MCMessageRendererHelper.cpp
new file mode 100644
index 00000000..46392e8f
--- /dev/null
+++ b/src/core/renderer/MCMessageRendererHelper.cpp
@@ -0,0 +1,41 @@
+//
+// 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()
+{
+ mSession = NULL;
+}
+
+MessageRendererHelper::~MessageRendererHelper()
+{
+ MC_SAFE_RELEASE(mSession);
+}
+
+void MessageRendererHelper::setSession(IMAPSession * session)
+{
+ mSession = session;
+}
+
+IMAPSession MessageRendererHelper::session()
+{
+ return mSession;
+}
+
+HTMLRendererIMAPCallback * MessageRendererHelper::dataCallback()
+{
+
+}
+
+HTMLRendererTemplateCallback * MessageRendererHelper::htmlCallback()
+{
+
+}
diff --git a/src/core/renderer/MCMessageRendererHelper.h b/src/core/renderer/MCMessageRendererHelper.h
new file mode 100644
index 00000000..54c2952f
--- /dev/null
+++ b/src/core/renderer/MCMessageRendererHelper.h
@@ -0,0 +1,39 @@
+//
+// 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 "MCIMAPSession.h"
+
+#ifdef __cplusplus
+
+namespace mailcore {
+
+ class MessageRendererHelper {
+ public:
+ MessageRendererHelper();
+ virtual ~MessageRendererHelper();
+
+ virtual void setSession(IMAPSession * session);
+ virtual IMAPSession session();
+
+ virtual HTMLRendererIMAPCallback * dataCallback();
+ virtual HTMLRendererTemplateCallback * htmlCallback();
+
+ private:
+ IMAPSession * mSession;
+
+ }
+}
+
+#endif
+
+#endif