aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Paul Young <paulyoungonline@gmail.com>2013-07-06 16:48:39 -0400
committerGravatar Paul Young <paulyoungonline@gmail.com>2013-07-06 16:48:39 -0400
commitff02bb072177705d888207920e4ca084792a9bb6 (patch)
tree0722a7880126bfce2b5951c1999639d063315903 /src/core
parent69d1e3a8a4d3ac5edd042edfc3af638dc40deac1 (diff)
Added error checking.
* Made pError a pointer to ErrorCode.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/imap/MCIMAPSession.cc31
-rw-r--r--src/core/imap/MCIMAPSession.h8
2 files changed, 25 insertions, 14 deletions
diff --git a/src/core/imap/MCIMAPSession.cc b/src/core/imap/MCIMAPSession.cc
index 5d0a5ef1..d5df70cb 100644
--- a/src/core/imap/MCIMAPSession.cc
+++ b/src/core/imap/MCIMAPSession.cc
@@ -3022,11 +3022,13 @@ ConnectionLogger * IMAPSession::connectionLogger()
return mConnectionLogger;
}
-String * IMAPSession::htmlRendering(IMAPMessage * message, String * folder, ErrorCode pError)
+String * IMAPSession::htmlRendering(IMAPMessage * message, String * folder, ErrorCode * pError)
{
- HTMLRendererIMAPDataCallback * dataCallback = new HTMLRendererIMAPDataCallback();
- pError = dataCallback->error();
+ if (* pError != ErrorNone) {
+ return NULL;
+ }
+ HTMLRendererIMAPDataCallback * dataCallback = new HTMLRendererIMAPDataCallback(this, message->uid());
String * htmlString = HTMLRenderer::htmlForIMAPMessage(folder,
message,
dataCallback,
@@ -3036,12 +3038,14 @@ String * IMAPSession::htmlRendering(IMAPMessage * message, String * folder, Erro
return htmlString;
}
-String * IMAPSession::htmlBodyRendering(IMAPMessage * message, String * folder, ErrorCode pError)
+String * IMAPSession::htmlBodyRendering(IMAPMessage * message, String * folder, ErrorCode * pError)
{
- HTMLRendererIMAPDataCallback * dataCallback = new HTMLRendererIMAPDataCallback();
+ if (* pError != ErrorNone) {
+ return NULL;
+ }
+
+ HTMLRendererIMAPDataCallback * dataCallback = new HTMLRendererIMAPDataCallback(this, message->uid());
HTMLBodyRendererTemplateCallback * htmlCallback = new HTMLBodyRendererTemplateCallback();
-
- pError = dataCallback->error();
String * htmlBodyString = HTMLRenderer::htmlForIMAPMessage(folder,
message,
@@ -3053,16 +3057,23 @@ String * IMAPSession::htmlBodyRendering(IMAPMessage * message, String * folder,
return htmlBodyString;
}
-String * IMAPSession::plainTextRendering(IMAPMessage * message, String * folder, ErrorCode pError)
+String * IMAPSession::plainTextRendering(IMAPMessage * message, String * folder, ErrorCode * pError)
{
+ if (* pError != ErrorNone) {
+ return NULL;
+ }
+
String * htmlString = htmlRendering(message, folder, pError);
String * plainTextString = htmlString->flattenHTML();
-
return plainTextString;
}
-String * IMAPSession::plainTextBodyRendering(IMAPMessage * message, String * folder, ErrorCode pError)
+String * IMAPSession::plainTextBodyRendering(IMAPMessage * message, String * folder, ErrorCode * pError)
{
+ if (* pError != ErrorNone) {
+ return NULL;
+ }
+
String * htmlBodyString = htmlBodyRendering(message, folder, pError);
String * plainTextBodyString = htmlBodyString->flattenHTML();
diff --git a/src/core/imap/MCIMAPSession.h b/src/core/imap/MCIMAPSession.h
index f38d607e..09732edd 100644
--- a/src/core/imap/MCIMAPSession.h
+++ b/src/core/imap/MCIMAPSession.h
@@ -142,17 +142,17 @@ namespace mailcore {
virtual ConnectionLogger * connectionLogger();
/** HTML rendering of the body of the message to be displayed in a web view.*/
- virtual String * htmlRendering(IMAPMessage * message, String * folder, ErrorCode pError);
+ virtual String * htmlRendering(IMAPMessage * message, String * folder, ErrorCode * pError);
/** HTML rendering of the body of the message.*/
- virtual String * htmlBodyRendering(IMAPMessage * message, String * folder, ErrorCode pError);
+ virtual String * htmlBodyRendering(IMAPMessage * message, String * folder, ErrorCode * pError);
/** Text rendering of the message.*/
- virtual String * plainTextRendering(IMAPMessage * message, String * folder, ErrorCode pError);
+ virtual String * plainTextRendering(IMAPMessage * message, String * folder, ErrorCode * pError);
/** Text rendering of the body of the message. All end of line will be removed and white spaces cleaned up.
This method can be used to generate the summary of the message.*/
- virtual String * plainTextBodyRendering(IMAPMessage * message, String * folder, ErrorCode pError);
+ virtual String * plainTextBodyRendering(IMAPMessage * message, String * folder, ErrorCode * pError);
public: // private
virtual void loginIfNeeded(ErrorCode * pError);