diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mailnews/mapi/mapihook/src/msgMapiMain.h | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/mailnews/mapi/mapihook/src/msgMapiMain.h')
-rw-r--r-- | comm/mailnews/mapi/mapihook/src/msgMapiMain.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/comm/mailnews/mapi/mapihook/src/msgMapiMain.h b/comm/mailnews/mapi/mapihook/src/msgMapiMain.h new file mode 100644 index 0000000000..fcca6ca541 --- /dev/null +++ b/comm/mailnews/mapi/mapihook/src/msgMapiMain.h @@ -0,0 +1,80 @@ +/* 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 MSG_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 "nsTHashMap.h" +#include "nsClassHashtable.h" +#include "nsString.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; + + nsTHashMap<nsCStringHashKey, uint32_t> m_ProfileMap; + nsClassHashtable<nsUint32HashKey, nsMAPISession> m_SessionMap; + nsMAPIConfiguration(); + ~nsMAPIConfiguration(); + + public: + static nsMAPIConfiguration* GetMAPIConfiguration(); + void OpenConfiguration(); + int16_t RegisterSession(uint32_t aHwnd, const nsCString& aUserName, + const nsCString& 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: + uint32_t m_nShared; + nsCString m_pIdKey; + nsCString m_pProfileName; + nsCString m_pPassword; + void* m_listContext; // used by findNext + + public: + nsMAPISession(uint32_t aHwnd, const nsCString& aUserName, + const nsCString& aPassword, bool aForceDownLoad, + const char* aKey); + uint32_t IncrementSession(); + uint32_t DecrementSession(); + uint32_t GetSessionCount(); + char16_t* 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_ |