aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2015-01-03 23:10:15 -0800
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2015-01-03 23:10:24 -0800
commitda10b9124b52e34ac49edd1120bc04926e0a44e6 (patch)
treee0b788d613d7cac4408a983dfedd55721fbdc187 /src/core
parenta54deab9ad377fb36b21ec1fd67a67cb71824ea9 (diff)
Refactoring, fixed #1013
Diffstat (limited to 'src/core')
-rw-r--r--src/core/basetypes/MCIndexSet.h4
-rw-r--r--src/core/basetypes/MCMainThreadAndroid.cpp6
-rw-r--r--src/core/basetypes/com_libmailcore_MainThreadUtils.h37
-rw-r--r--src/core/renderer/MCHTMLRendererCallback.cpp8
-rw-r--r--src/core/renderer/MCHTMLRendererCallback.h7
-rw-r--r--src/core/rfc822/MCMessageParser.cpp15
-rw-r--r--src/core/rfc822/MCMessageParser.h1
7 files changed, 34 insertions, 44 deletions
diff --git a/src/core/basetypes/MCIndexSet.h b/src/core/basetypes/MCIndexSet.h
index e76517db..2e2f4892 100644
--- a/src/core/basetypes/MCIndexSet.h
+++ b/src/core/basetypes/MCIndexSet.h
@@ -21,7 +21,7 @@ namespace mailcore {
class MAILCORE_EXPORT IndexSet : public Object {
public:
IndexSet();
- IndexSet(IndexSet * o);
+ virtual ~IndexSet();
static IndexSet * indexSet();
static IndexSet * indexSetWithRange(Range range);
@@ -45,7 +45,7 @@ namespace mailcore {
virtual void removeAllIndexes();
public: // subclass behavior
- virtual ~IndexSet();
+ IndexSet(IndexSet * o);
virtual String * description();
virtual Object * copy();
virtual HashMap * serializable();
diff --git a/src/core/basetypes/MCMainThreadAndroid.cpp b/src/core/basetypes/MCMainThreadAndroid.cpp
index 36792cb1..cc41bb88 100644
--- a/src/core/basetypes/MCMainThreadAndroid.cpp
+++ b/src/core/basetypes/MCMainThreadAndroid.cpp
@@ -18,6 +18,7 @@
#include "MCAssert.h"
#include "MCLog.h"
#include "MCAutoreleasePool.h"
+#include "TypesUtils.h"
using namespace mailcore;
@@ -53,6 +54,7 @@ JNIEXPORT void JNICALL Java_com_libmailcore_MainThreadUtils_setupNative(JNIEnv *
jclass localClass = env->FindClass("com/libmailcore/MainThreadUtils");
s_mainThreadUtilsClass = reinterpret_cast<jclass>(env->NewGlobalRef(localClass));
MCAssert(s_mainThreadUtilsClass != NULL);
+ MCTypesUtilsInit();
pool->release();
}
@@ -101,10 +103,10 @@ void mailcore::callOnMainThreadAndWait(void (* function)(void *), void * context
jmethodID mid = env->GetMethodID(s_mainThreadUtilsClass, "runOnMainThreadAndWait", "(J)V");
MCAssert(mid != NULL);
env->CallVoidMethod(s_mainThreadUtils, mid, (jlong) data);
-
+
// Wait.
mailsem_down(data->sem);
-
+
mailsem_free(data->sem);
free(data);
}
diff --git a/src/core/basetypes/com_libmailcore_MainThreadUtils.h b/src/core/basetypes/com_libmailcore_MainThreadUtils.h
deleted file mode 100644
index 327d9910..00000000
--- a/src/core/basetypes/com_libmailcore_MainThreadUtils.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class com_libmailcore_MainThreadUtils */
-
-#ifndef _Included_com_libmailcore_MainThreadUtils
-#define _Included_com_libmailcore_MainThreadUtils
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: com_libmailcore_MainThreadUtils
- * Method: setupNative
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_com_libmailcore_MainThreadUtils_setupNative
- (JNIEnv *, jobject);
-
-/*
- * Class: com_libmailcore_MainThreadUtils
- * Method: runIdentifier
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_com_libmailcore_MainThreadUtils_runIdentifier
- (JNIEnv *, jobject, jlong);
-
-/*
- * Class: com_libmailcore_MainThreadUtils
- * Method: runIdentifierAndNotify
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_com_libmailcore_MainThreadUtils_runIdentifierAndNotify
- (JNIEnv *, jobject, jlong);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/src/core/renderer/MCHTMLRendererCallback.cpp b/src/core/renderer/MCHTMLRendererCallback.cpp
index edaf7e92..fb492c9e 100644
--- a/src/core/renderer/MCHTMLRendererCallback.cpp
+++ b/src/core/renderer/MCHTMLRendererCallback.cpp
@@ -15,6 +15,14 @@
using namespace mailcore;
+HTMLRendererTemplateCallback::HTMLRendererTemplateCallback()
+{
+}
+
+HTMLRendererTemplateCallback::~HTMLRendererTemplateCallback()
+{
+}
+
mailcore::HashMap * HTMLRendererTemplateCallback::templateValuesForHeader(mailcore::MessageHeader * header)
{
mailcore::HashMap * result = mailcore::HashMap::hashMap();
diff --git a/src/core/renderer/MCHTMLRendererCallback.h b/src/core/renderer/MCHTMLRendererCallback.h
index 7c20f18a..a12a3e45 100644
--- a/src/core/renderer/MCHTMLRendererCallback.h
+++ b/src/core/renderer/MCHTMLRendererCallback.h
@@ -24,14 +24,17 @@ namespace mailcore {
public:
HTMLRendererIMAPCallback() {}
virtual ~HTMLRendererIMAPCallback() {}
-
+
virtual Data * dataForIMAPPart(String * folder, IMAPPart * part) { return NULL; }
virtual void prefetchAttachmentIMAPPart(String * folder, IMAPPart * part) {}
virtual void prefetchImageIMAPPart(String * folder, IMAPPart * part) {}
};
-
+
class MAILCORE_EXPORT HTMLRendererTemplateCallback {
public:
+ HTMLRendererTemplateCallback();
+ virtual ~HTMLRendererTemplateCallback();
+
virtual bool canPreviewPart(AbstractPart * part);
virtual bool shouldShowPart(AbstractPart * part);
diff --git a/src/core/rfc822/MCMessageParser.cpp b/src/core/rfc822/MCMessageParser.cpp
index 404bc862..71071c02 100644
--- a/src/core/rfc822/MCMessageParser.cpp
+++ b/src/core/rfc822/MCMessageParser.cpp
@@ -72,6 +72,11 @@ void MessageParser::setBytes(char * dataBytes, unsigned int dataLength)
mailmessage_free(msg);
}
+MessageParser::MessageParser()
+{
+ init();
+}
+
MessageParser::MessageParser(Data * data)
{
init();
@@ -118,7 +123,9 @@ String * MessageParser::description()
String * result = String::string();
result->appendUTF8Format("<%s:%p ", MCUTF8(className()), this);
result->appendUTF8Format("<%p>", mMainPart);
- result->appendString(mMainPart->description());
+ if (mMainPart != NULL) {
+ result->appendString(mMainPart->description());
+ }
result->appendUTF8Characters(">");
return result;
@@ -140,11 +147,17 @@ Object * MessageParser::copy()
AbstractPart * MessageParser::partForContentID(String * contentID)
{
+ if (mainPart() == NULL) {
+ return NULL;
+ }
return mainPart()->partForContentID(contentID);
}
AbstractPart * MessageParser::partForUniqueID(String * uniqueID)
{
+ if (mainPart() == NULL) {
+ return NULL;
+ }
return mainPart()->partForUniqueID(uniqueID);
}
diff --git a/src/core/rfc822/MCMessageParser.h b/src/core/rfc822/MCMessageParser.h
index 8d2fe4a6..048cee60 100644
--- a/src/core/rfc822/MCMessageParser.h
+++ b/src/core/rfc822/MCMessageParser.h
@@ -20,6 +20,7 @@ namespace mailcore {
static MessageParser * messageParserWithData(Data * data);
static MessageParser * messageParserWithContentsOfFile(String * filename);
+ MessageParser();
MessageParser(Data * data);
virtual ~MessageParser();