00001 #ifndef mapi_utilsH
00002 #define mapi_utilsH
00003
00004
00005 void mapi_EnsureLibraries();
00006 void mapi_EnsureStores(const std::string libpath);
00007 void mapi_EnsureFolders(HWND h, const std::string profile, const std::string store);
00008 void mapi_EnsureFolders(HWND h, const std::string pst_fn);
00009 void mapi_EnsureFinished();
00010
00011 bool isrtfhtml(const char *buf,unsigned int len);
00012 void decodertfhtml(char *buf,unsigned int *len);
00013
00014
00015
00016 class mapi_TEntryid
00017 { public:
00018 unsigned int size;
00019 ENTRYID *ab;
00020 mapi_TEntryid() {ab=0;size=0;}
00021 mapi_TEntryid(SPropValue *v) {ab=0;size=0; if (v->ulPropTag!=PR_ENTRYID) return; set(v->Value.bin.cb,(ENTRYID*)v->Value.bin.lpb);}
00022 mapi_TEntryid(const mapi_TEntryid &e) {ab=0;size=0; set(e.size,e.ab);}
00023 mapi_TEntryid(unsigned int asize,ENTRYID *eid) {ab=0;size=0; set(asize,eid);}
00024 mapi_TEntryid &operator= (const mapi_TEntryid *e) {set(e->size,e->ab); return *this;}
00025 mapi_TEntryid &operator= (const SPropValue *v) {set(0,0); if (PROP_TYPE(v->ulPropTag)!=PT_BINARY) return *this; set(v->Value.bin.cb,(ENTRYID*)v->Value.bin.lpb); return *this;}
00026 ~mapi_TEntryid() {set(0,0);}
00027 void set(unsigned int asize, ENTRYID *eid) {if (ab!=0) delete[] ((char*)ab); size=asize; if (eid==0) ab=0; else {ab=(ENTRYID*)(new char[size]);memcpy(ab,eid,size);}}
00028 void clear() {set(0,0);}
00029 bool isempty() const {return (ab==0 || size==0);}
00030 bool isequal(IMAPISession *sesh, mapi_TEntryid const &e) const
00031 { if (isempty() || e.isempty()) return false;
00032 ULONG res; HRESULT hr = sesh->CompareEntryIDs(size,ab,e.size,e.ab,0,&res);
00033 if (hr!=S_OK) return false;
00034 return (res!=0);
00035 }
00036 };
00037
00038
00039 typedef struct {std::string name, path; bool supported;} mapi_TLibraryInfo;
00040
00041 enum mapi_TFolderType {mftInbox,mftOutbox,mftSent,mftDeleted,mftCalendar,mftContacts,mftJournal,mftNotes,mftTasks,mftSpecial,mftMail,mftStuff};
00042 typedef struct {int depth; std::string name, path; mapi_TFolderType type; mapi_TEntryid eid;} mapi_TFolderInfo;
00043
00044 enum mapi_TStoreType {mstProfile, mstProfileSecret, mstStore};
00045 typedef struct {std::string profile, store; mapi_TStoreType type;} mapi_TStoreInfo;
00046
00047
00048 extern std::list<mapi_TLibraryInfo> mapi_Libraries;
00049
00050 extern std::list<mapi_TStoreInfo> mapi_Stores;
00051
00052 typedef HRESULT (STDMETHODCALLTYPE RTFSYNC)(LPMESSAGE lpMessage, ULONG ulFlags, BOOL FAR *lpfMessageUpdated);
00053 typedef HRESULT (STDMETHODCALLTYPE WRAPCOMPRESSEDRTFSTREAM)(LPSTREAM lpCompressedRTFStream, ULONG ulFlags, LPSTREAM FAR *lpUncompressedRTFStream);
00054 extern RTFSYNC *pRTFSync;
00055 extern WRAPCOMPRESSEDRTFSTREAM *pWrapCompressedRTFStream;
00056 extern MAPIFREEBUFFER *pMAPIFreeBuffer;
00057
00058 extern IMAPISession *mapi_session;
00059 extern IMsgStore *mapi_msgstore;
00060 extern std::list<mapi_TFolderInfo> mapi_Folders;
00061 extern mapi_TEntryid eid_deleted;
00062
00063
00064
00065
00066
00067
00068
00069
00070 HRESULT pHrGetOneProp(LPMAPIPROP lpMapiProp, ULONG ulPropTag, LPSPropValue FAR *lppProp);
00071 void pFreeProws(LPSRowSet lpRows);
00072 HRESULT pHrQueryAllRows(LPMAPITABLE lpTable, LPSPropTagArray lpPropTags, LPSRestriction lpRestriction, LPSSortOrderSet lpSortOrderSet, LONG crowsMax, LPSRowSet FAR *lppRows);
00073
00074
00075
00076 #ifndef PR_BODY_HTML
00077 #define PR_BODY_HTML (PROP_TAG(PT_TSTRING,0x1013))
00078 #endif
00079
00080 #ifndef PR_ATTACH_CONTENT_ID
00081 #define PR_ATTACH_CONTENT_ID (PROP_TAG(PT_TSTRING,0x3712))
00082 #endif
00083
00084 #ifndef PR_ATTACH_CONTENT_LOCATION
00085 #define PR_ATTACH_CONTENT_LOCATION (PROP_TAG(PT_TSTRING,0x3713))
00086 #endif
00087
00088 #ifndef PR_ATTACH_FLAGS
00089 #define PR_ATTACH_FLAGS (PROP_TAG(PT_LONG,0x3714))
00090 #endif
00091
00092 #ifndef PR_ATTACH_TRANSPORT_NAME
00093 #define PR_ATTACH_TRANSPORT_NAME (PROP_TAG(PT_TSTRING,0x370C))
00094 #endif
00095
00096 #ifndef PR_ATTACH_MIME_SEQUENCE
00097 #define PR_ATTACH_MIME_SEQUENCE (PROP_TAG(PT_LONG,0x3710))
00098 #endif
00099
00100 #ifndef PR_SMTP_MESSAGE_ID
00101 #define PR_SMTP_MESSAGE_ID (PROP_TAG(PT_TSTRING,0x1035))
00102 #endif
00103
00104
00105
00106 #endif
00107