summaryrefslogtreecommitdiffstats
path: root/mailnews/mapi/mapihook/src/msgMapiMain.h
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-03 00:17:46 -0400
committerMatt A. Tobin <email@mattatobin.com>2019-11-03 00:17:46 -0400
commit302bf1b523012e11b60425d6eee1221ebc2724eb (patch)
treeb191a895f8716efcbe42f454f37597a545a6f421 /mailnews/mapi/mapihook/src/msgMapiMain.h
parent21b3f6247403c06f85e1f45d219f87549862198f (diff)
downloadUXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar
UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.gz
UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.lz
UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.xz
UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.zip
Issue #1258 - Part 1: Import mailnews, ldap, and mork from comm-esr52.9.1
Diffstat (limited to 'mailnews/mapi/mapihook/src/msgMapiMain.h')
-rw-r--r--mailnews/mapi/mapihook/src/msgMapiMain.h86
1 files changed, 86 insertions, 0 deletions
diff --git a/mailnews/mapi/mapihook/src/msgMapiMain.h b/mailnews/mapi/mapihook/src/msgMapiMain.h
new file mode 100644
index 000000000..be74c5db1
--- /dev/null
+++ b/mailnews/mapi/mapihook/src/msgMapiMain.h
@@ -0,0 +1,86 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef MSG_MAPI_MAIN_H_
+#define NSG_MAPI_MAIN_H_
+
+#define MAX_NAME_LEN 256
+#define MAX_PW_LEN 256
+#define MAX_SESSIONS 50
+#define MAPI_SENDCOMPLETE_EVENT "SendCompletionEvent"
+
+#define MAPI_PROPERTIES_CHROME "chrome://messenger-mapi/locale/mapi.properties"
+#define PREF_MAPI_WARN_PRIOR_TO_BLIND_SEND "mapi.blind-send.warn"
+#define PREF_MAPI_BLIND_SEND_ENABLED "mapi.blind-send.enabled"
+
+#include "nspr.h"
+#include "nsDataHashtable.h"
+#include "nsClassHashtable.h"
+#include "nsStringGlue.h"
+
+class nsMAPISession;
+
+class nsMAPIConfiguration
+{
+private :
+
+ static uint32_t session_generator;
+ static uint32_t sessionCount;
+ static nsMAPIConfiguration *m_pSelfRef;
+ PRLock *m_Lock;
+ uint32_t m_nMaxSessions;
+
+ nsDataHashtable<nsStringHashKey, uint32_t> m_ProfileMap;
+ nsClassHashtable<nsUint32HashKey, nsMAPISession> m_SessionMap;
+ nsMAPIConfiguration();
+ ~nsMAPIConfiguration();
+
+public :
+ static nsMAPIConfiguration *GetMAPIConfiguration();
+ void OpenConfiguration();
+ int16_t RegisterSession(uint32_t aHwnd, const char16_t *aUserName, \
+ const char16_t *aPassword, bool aForceDownLoad, \
+ bool aNewSession, uint32_t *aSession, const char *aIdKey);
+ bool IsSessionValid(uint32_t aSessionID);
+ bool UnRegisterSession(uint32_t aSessionID);
+ char16_t *GetPassword(uint32_t aSessionID);
+ void GetIdKey(uint32_t aSessionID, nsCString& aKey);
+ void *GetMapiListContext(uint32_t aSessionID);
+ void SetMapiListContext(uint32_t aSessionID, void *mapiListContext);
+
+ // a util func
+ static HRESULT GetMAPIErrorFromNSError (nsresult res) ;
+};
+
+class nsMAPISession
+{
+ friend class nsMAPIConfiguration;
+
+ private :
+ bool m_bIsForcedDownLoad;
+ bool m_bApp_or_Service;
+ uint32_t m_hAppHandle;
+ uint32_t m_nShared;
+ nsCString m_pIdKey;
+ nsString m_pProfileName;
+ nsString m_pPassword;
+ int32_t m_messageIndex;
+ void *m_listContext; // used by findNext
+
+ public :
+ nsMAPISession(uint32_t aHwnd, const char16_t *aUserName, \
+ const char16_t *aPassword, \
+ bool aForceDownLoad, const char *aKey);
+ uint32_t IncrementSession();
+ uint32_t DecrementSession();
+ uint32_t GetSessionCount();
+ char16_t *nsMAPISession::GetPassword();
+ void GetIdKey(nsCString& aKey);
+ ~nsMAPISession();
+ // For enumerating Messages...
+ void SetMapiListContext( void *listContext) { m_listContext = listContext; }
+ void *GetMapiListContext( ) { return m_listContext; }
+};
+
+#endif // MSG_MAPI_MAIN_H_