diff options
Diffstat (limited to 'mailnews/import/oexpress/WabObject.h')
-rw-r--r-- | mailnews/import/oexpress/WabObject.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/mailnews/import/oexpress/WabObject.h b/mailnews/import/oexpress/WabObject.h new file mode 100644 index 000000000..482615697 --- /dev/null +++ b/mailnews/import/oexpress/WabObject.h @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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 WabObject_h___ +#define WabObject_h___ + +#include "nscore.h" +#include "nsStringGlue.h" +#include "nsIFile.h" + +#include <windows.h> +#include <wab.h> + + +class CWabIterator { +public: + virtual nsresult EnumUser(const char16_t *pName, LPENTRYID pEid, ULONG cbEid) = 0; + virtual nsresult EnumList(const char16_t *pName, LPENTRYID pEid, ULONG cbEid, LPMAPITABLE lpTable) = 0; +}; + + +class CWAB +{ +public: + CWAB(nsIFile *fileName); + ~CWAB(); + + bool Loaded(void) { return m_bInitialized;} + + HRESULT IterateWABContents(CWabIterator *pIter, int *pDone); + + // Methods for User entries + LPDISTLIST GetDistList(ULONG cbEid, LPENTRYID pEid); + void ReleaseDistList(LPDISTLIST pList) { if (pList) pList->Release();} + LPMAILUSER GetUser(ULONG cbEid, LPENTRYID pEid); + void ReleaseUser(LPMAILUSER pUser) { if (pUser) pUser->Release();} + LPSPropValue GetUserProperty(LPMAILUSER pUser, ULONG tag); + LPSPropValue GetListProperty(LPDISTLIST pList, ULONG tag); + void FreeProperty(LPSPropValue pVal) { if (pVal) m_lpWABObject->FreeBuffer(pVal);} + void GetValueString(LPSPropValue pVal, nsString& val); + void GetValueTime(LPSPropValue pVal, PRTime& val); + + void CStrToUnicode(const char *pStr, nsString& result); + + // Utility stuff used by iterate + void FreeProws(LPSRowSet prows); + + bool IsAvailable(); + +private: + char16_t * m_pUniBuff; + int m_uniBuffLen; + bool m_bInitialized; + HINSTANCE m_hinstWAB; + LPWABOPEN m_lpfnWABOpen; + LPADRBOOK m_lpAdrBook; + LPWABOBJECT m_lpWABObject; +}; + +#endif // WABOBJECT_INCLUDED + + |