Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

2455 lines
131 KiB

//--------------------------------------------------------------------------
// OEStore.idl
//--------------------------------------------------------------------------
import "ocidl.idl";
import "objidl.idl";
import "imnact.idl";
import "mimeole.idl";
import "imnxport.idl";
import "directdb.idl";
//--------------------------------------------------------------------------
// Dependencies
//--------------------------------------------------------------------------
cpp_quote("#include <stddef.h> // for offsetof")
//--------------------------------------------------------------------------
// Interfaces
//--------------------------------------------------------------------------
interface IStoreCallback;
interface IMessageStore;
interface IMessageTable;
interface IMessageTableNotify;
interface IMessageFolder;
interface IMessageServer;
interface IEnumerateFolders;
interface IImnAccount;
interface IStoreNamespace;
interface IStoreFolder;
//--------------------------------------------------------------------------
// Class Ids and Interface Ids
//--------------------------------------------------------------------------
cpp_quote("// {101A8FB9-F1B9-11d1-9A56-00C04FA309D4}")
cpp_quote("DEFINE_GUID(CLSID_MessageStore, 0x101a8fb9, 0xf1b9, 0x11d1, 0x9a, 0x56, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
cpp_quote("")
cpp_quote("// {522E4F81-2C98-11d2-AACA-006097D474C4}")
cpp_quote("DEFINE_GUID(IID_INewsStore, 0x522e4f81, 0x2c98, 0x11d2, 0xaa, 0xca, 0x0, 0x60, 0x97, 0xd4, 0x74, 0xc4);")
cpp_quote("")
cpp_quote("// {06AE7A01-6C5B-11d2-AD88-0080C7B6E3C5}")
cpp_quote("DEFINE_GUID(IID_IIMAPStore, 0x6ae7a01, 0x6c5b, 0x11d2, 0xad, 0x88, 0x0, 0x80, 0xc7, 0xb6, 0xe3, 0xc5);")
cpp_quote("")
cpp_quote("// {E883FC75-EC08-11d1-9A53-00C04FA309D4}")
cpp_quote("DEFINE_GUID(IID_IMessageStore, 0xe883fc75, 0xec08, 0x11d1, 0x9a, 0x53, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
cpp_quote("")
cpp_quote("// {E883FC76-EC08-11d1-9A53-00C04FA309D4}")
cpp_quote("DEFINE_GUID(IID_IMessageFolder, 0xe883fc76, 0xec08, 0x11d1, 0x9a, 0x53, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
cpp_quote("")
cpp_quote("// {E883FC77-EC08-11d1-9A53-00C04FA309D4}")
cpp_quote("DEFINE_GUID(IID_IPop3UidlStore, 0xe883fc77, 0xec08, 0x11d1, 0x9a, 0x53, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
cpp_quote("")
cpp_quote("// {816C1167-F649-11d1-9A57-00C04FA309D4}")
cpp_quote("DEFINE_GUID(IID_IMessageTableNotify, 0x816c1167, 0xf649, 0x11d1, 0x9a, 0x57, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
cpp_quote("")
cpp_quote("// {B4B796AA-EC1C-11d1-9A54-00C04FA309D4}")
cpp_quote("DEFINE_GUID(IID_IMessageTable, 0xb4b796aa, 0xec1c, 0x11d1, 0x9a, 0x54, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
cpp_quote("")
cpp_quote("// {CFAD2437-EC54-11d1-9A54-00C04FA309D4}")
cpp_quote("DEFINE_GUID(IID_IStoreCallback, 0xcfad2437, 0xec54, 0x11d1, 0x9a, 0x54, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
cpp_quote("")
cpp_quote("// {CFAD2438-EC54-11d1-9A54-00C04FA309D4}")
cpp_quote("DEFINE_GUID(IID_IMessageServer, 0xcfad2438, 0xec54, 0x11d1, 0x9a, 0x54, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
cpp_quote("")
cpp_quote("// {A6630A5E-046A-11d2-ACEF-00C04FA31009}")
cpp_quote("DEFINE_GUID(SID_MessageServer, 0xa6630a5e, 0x46a, 0x11d2, 0xac, 0xef, 0x0, 0xc0, 0x4f, 0xa3, 0x10, 0x9);")
cpp_quote("")
cpp_quote("// {7C9FB7A1-2C9E-11d2-AACA-006097D474C4}")
cpp_quote("DEFINE_GUID(SID_LocalMessageFolder, 0x7c9fb7a1, 0x2c9e, 0x11d2, 0xaa, 0xca, 0x0, 0x60, 0x97, 0xd4, 0x74, 0xc4);")
cpp_quote("")
cpp_quote("// {28B44B1D-07A9-11d2-9A63-00C04FA309D4}")
cpp_quote("DEFINE_GUID(IID_ICallbackTimeout, 0x28b44b1d, 0x7a9, 0x11d2, 0x9a, 0x63, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
cpp_quote("")
cpp_quote("// {8551C145-0C39-11d2-9A6A-00C04FA309D4}")
cpp_quote("DEFINE_GUID(IID_IEnumerateFolders, 0x8551c145, 0xc39, 0x11d2, 0x9a, 0x6a, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
cpp_quote("")
cpp_quote("// {E70C92A9-4BFD-11d1-8A95-00C04FB951F3}")
cpp_quote("DEFINE_GUID(CLSID_StoreNamespace, 0xe70c92a9, 0x4bfd, 0x11d1, 0x8a, 0x95, 0x0, 0xc0, 0x4f, 0xb9, 0x51, 0xf3);")
cpp_quote("")
cpp_quote("// {E70C92AA-4BFD-11d1-8A95-00C04FB951F3}")
cpp_quote("DEFINE_GUID(IID_IStoreNamespace, 0xe70c92aa, 0x4bfd, 0x11d1, 0x8a, 0x95, 0x0, 0xc0, 0x4f, 0xb9, 0x51, 0xf3);")
cpp_quote("")
cpp_quote("// {E70C92AC-4BFD-11d1-8A95-00C04FB951F3}")
cpp_quote("DEFINE_GUID(IID_IStoreFolder, 0xe70c92ac, 0x4bfd, 0x11d1, 0x8a, 0x95, 0x0, 0xc0, 0x4f, 0xb9, 0x51, 0xf3);")
cpp_quote("")
cpp_quote("// {BE09F473-7FEB-11d2-9962-00C04FA309D4}")
cpp_quote("DEFINE_GUID(CLSID_MigrateMessageStore, 0xbe09f473, 0x7feb, 0x11d2, 0x99, 0x62, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
//--------------------------------------------------------------------------
// OEStore Database Extenstion CLSIDs
//--------------------------------------------------------------------------
cpp_quote("// {6F74FDC5-E366-11d1-9A4E-00C04FA309D4}")
cpp_quote("DEFINE_GUID(CLSID_MessageDatabase, 0x6f74fdc5, 0xe366, 0x11d1, 0x9a, 0x4e, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
cpp_quote("")
cpp_quote("// {6F74FDC6-E366-11d1-9A4E-00C04FA309D4}")
cpp_quote("DEFINE_GUID(CLSID_FolderDatabase, 0x6f74fdc6, 0xe366, 0x11d1, 0x9a, 0x4e, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
cpp_quote("")
cpp_quote("// {6F74FDC7-E366-11d1-9A4E-00C04FA309D4}")
cpp_quote("DEFINE_GUID(CLSID_Pop3UidlDatabase, 0x6f74fdc7, 0xe366, 0x11d1, 0x9a, 0x4e, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
cpp_quote("")
cpp_quote("// {5488C4BE-2247-11d2-9A7D-00C04FA309D4}")
cpp_quote("DEFINE_GUID(CLSID_StreamDatabase, 0x5488c4be, 0x2247, 0x11d2, 0x9a, 0x7d, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
//--------------------------------------------------------------------------
// HRESULT Macros
//--------------------------------------------------------------------------
cpp_quote("#ifndef FACILITY_INTERNET")
cpp_quote("#define FACILITY_INTERNET 12")
cpp_quote("#endif")
cpp_quote("#ifndef HR_E")
cpp_quote("#define HR_E(n) MAKE_SCODE(SEVERITY_ERROR, FACILITY_INTERNET, n)")
cpp_quote("#endif")
cpp_quote("#ifndef HR_S")
cpp_quote("#define HR_S(n) MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_INTERNET, n)")
cpp_quote("#endif")
cpp_quote("#ifndef HR_CODE")
cpp_quote("#define HR_CODE(hr) (INT)(hr & 0xffff)")
cpp_quote("#endif")
cpp_quote("")
cpp_quote("// --------------------------------------------------------------------------------")
cpp_quote("// Error Codes")
cpp_quote("// --------------------------------------------------------------------------------")
cpp_quote("#define STORE_E_BUSY HR_E(100)")
cpp_quote("#define STORE_E_OFFLINE HR_E(101)")
cpp_quote("#define STORE_E_BADFOLDERNAME HR_E(102)")
cpp_quote("#define STORE_E_INVALIDPARENT HR_E(103)")
cpp_quote("#define STORE_E_CANTDELETESPECIAL HR_E(104)")
cpp_quote("#define STORE_E_CANTMOVESERVERS HR_E(105)")
cpp_quote("#define STORE_E_CANTMOVESPECIAL HR_E(106)")
cpp_quote("#define STORE_E_CANTRENAMESPECIAL HR_E(107)")
cpp_quote("#define STORE_E_NOBODY HR_E(108)")
cpp_quote("#define STORE_E_NOSERVERCOPY HR_E(109)") // CMessageClass should do std copy
cpp_quote("#define STORE_E_NOTINITIALIZED HR_E(110)") // Must initialize object first
cpp_quote("#define STORE_E_OPERATION_CANCELED HR_E(111)")
cpp_quote("#define STORE_E_FILENOEXIST HR_E(112)")
cpp_quote("#define STORE_E_EXPIRED HR_E(113)")
cpp_quote("#define STORE_E_NOSERVERSUPPORT HR_E(114)") // Server cannot support requested operation
cpp_quote("#define STORE_E_NOTRANSLATION HR_E(115)") // New fldr has non-USASCII, parent is FOLDER_NOTRANSLATEUTF7
cpp_quote("#define STORE_E_NOREMOTESPECIALFLDR HR_E(116)") // User has disabled this special folder for this remote server
cpp_quote("#define STORE_E_IMAP_HC_NOSLASH HR_E(117)") // No '/' characters permitted in folder name (hierarchy char)
cpp_quote("#define STORE_E_IMAP_HC_NOBACKSLASH HR_E(118)") // No '\' characters permitted in folder name (hierarchy char)
cpp_quote("#define STORE_E_IMAP_HC_NODOT HR_E(119)") // No '.' characters permitted in folder name (hierarchy char)
cpp_quote("#define STORE_E_IMAP_HC_NOHC HR_E(120)") // Some other character is HC: not permitted in folder name
// Not to exceed 300
cpp_quote("// --------------------------------------------------------------------------------")
cpp_quote("// Success Codes")
cpp_quote("// --------------------------------------------------------------------------------")
cpp_quote("#define STORE_S_NOTOPEN HR_S(500)")
cpp_quote("#define STORE_S_ALREADYEXISTS HR_S(507)")
cpp_quote("#define STORE_S_ALREADYPENDING HR_S(508)")
cpp_quote("#define STORE_S_NOOP HR_S(509)") // OK, nothing to do
cpp_quote("#define STORE_S_IN_USE HR_S(510)") // in use by another client
// Not to exceed 800
cpp_quote("// --------------------------------------------------------------------------------")
cpp_quote("// String Definition Macros")
cpp_quote("// --------------------------------------------------------------------------------")
cpp_quote("#ifdef __cplusplus")
cpp_quote("#define EXTERN_C extern \"C\"")
cpp_quote("#else")
cpp_quote("#define EXTERN_C extern")
cpp_quote("#endif")
cpp_quote("")
cpp_quote("#ifndef STRCONSTA")
cpp_quote("#ifdef DEFINE_STRCONST")
cpp_quote("#define STRCONSTA(x,y) EXTERN_C const char x[] = y")
cpp_quote("#define STRCONSTW(x,y) EXTERN_C const WCHAR x[] = L##y")
cpp_quote("#else")
cpp_quote("#define STRCONSTA(x,y) EXTERN_C const char x[]")
cpp_quote("#define STRCONSTW(x,y) EXTERN_C const WCHAR x[]")
cpp_quote("#endif")
cpp_quote("#endif")
cpp_quote("")
cpp_quote("// --------------------------------------------------------------------------------")
cpp_quote("// rfc822 Headers")
cpp_quote("// --------------------------------------------------------------------------------")
cpp_quote("STRCONSTA(STR_LOCALSTORE, \"LocalStore\");")
//--------------------------------------------------------------------------
// sizeofMember
//--------------------------------------------------------------------------
cpp_quote("#define sizeofMember(s,m) sizeof(((s *)0)->m)")
//--------------------------------------------------------------------------
// DECLARE_HANDLE Macro
//--------------------------------------------------------------------------
#ifndef DECLARE_HANDLE
#define DECLARE_HANDLE(name) \
struct name##__ { DWORD unused; }; \
typedef struct name##__ _far* name
#endif
// OE team hasn't fixed their idl to avoid the Win64 midl warnings - turn it off
midl_pragma warning(disable:2395)
//--------------------------------------------------------------------------
// OEStore Type Library
//--------------------------------------------------------------------------
[
uuid(E462D143-5162-11d1-8A95-00C04FB951F3),
helpstring("Microsoft Outlook Express Store Type Library 1.0"),
version(1.0)
]
library OESTORE
{
//----------------------------------------------------------------------
// Standard Type Library Stuff
//----------------------------------------------------------------------
importlib("stdole2.tlb");
//----------------------------------------------------------------------
// Stream Store Version
//----------------------------------------------------------------------
const DWORD STREAM_STORE_VERSION = 5;
//----------------------------------------------------------------------
// STREAMUSERDATA
//----------------------------------------------------------------------
typedef struct tagSTREAMUSERDATA {
BYTE rgbReserved[512];
} STREAMUSERDATA, *LPSTREAMUSERDATA;
//----------------------------------------------------------------------
// STMCOLID
//----------------------------------------------------------------------
typedef enum tagSTMCOLID {
STMCOL_ID=0,
STMCOL_REFCOUNT,
STMCOL_STREAM,
STMCOL_OFFSETS,
STMCOL_LAST
} STMCOLID;
//----------------------------------------------------------------------
// STREAMINFO
//----------------------------------------------------------------------
typedef struct tagSTREAMINFO {
BYTE *pAllocated;
BYTE bVersion;
DWORD idStream;
FILEADDRESS faStream;
DWORD cRefCount;
BLOB Offsets;
} STREAMINFO, *LPSTREAMINFO;
//----------------------------------------------------------------------
// Stream Property Store Binding Table
//----------------------------------------------------------------------
cpp_quote("BEGIN_COLUMN_ARRAY(g_rgStmTblColumns, STMCOL_LAST)")
cpp_quote(" DEFINE_COLUMN(STMCOL_ID, CDT_UNIQUE, STREAMINFO, idStream)")
cpp_quote(" DEFINE_COLUMN(STMCOL_REFCOUNT, CDT_DWORD, STREAMINFO, cRefCount)")
cpp_quote(" DEFINE_COLUMN(STMCOL_STREAM, CDT_STREAM, STREAMINFO, faStream)")
cpp_quote(" DEFINE_COLUMN(STMCOL_OFFSETS, CDT_VARBLOB, STREAMINFO, Offsets)")
cpp_quote("END_COLUMN_ARRAY")
//----------------------------------------------------------------------
// Folder Table Primary Index Definition
//----------------------------------------------------------------------
cpp_quote("BEGIN_TABLE_INDEX(g_StmTblPrimaryIndex, 1)")
cpp_quote(" DEFINE_KEY(STMCOL_ID, 0, 0)")
cpp_quote("END_TABLE_INDEX")
//----------------------------------------------------------------------
// Folder Record Format
//----------------------------------------------------------------------
cpp_quote("BEGIN_TABLE_SCHEMA(g_StreamTableSchema, CLSID_StreamDatabase, STREAMINFO)")
cpp_quote(" SCHEMA_PROPERTY(STREAM_STORE_VERSION)")
cpp_quote(" SCHEMA_PROPERTY(TSF_RESETIFBADVERSION | TSF_HASSTREAMS)")
cpp_quote(" SCHEMA_PROPERTY(sizeof(STREAMUSERDATA))")
cpp_quote(" SCHEMA_PROPERTY(offsetof(STREAMINFO, idStream))")
cpp_quote(" SCHEMA_PROPERTY(STMCOL_LAST)")
cpp_quote(" SCHEMA_PROPERTY(g_rgStmTblColumns)")
cpp_quote(" SCHEMA_PROPERTY(&g_StmTblPrimaryIndex)")
cpp_quote(" SCHEMA_PROPERTY(NULL)")
cpp_quote("END_TABLE_SCHEMA")
//------------------------------------------------------------------
// Extern'ed Record Formats
//------------------------------------------------------------------
cpp_quote("extern const TABLESCHEMA g_StreamTableSchema;")
//----------------------------------------------------------------------
// IMessageStore
//----------------------------------------------------------------------
cpp_quote("#ifndef __LPMESSAGESTORE_DEFINED")
cpp_quote("#define __LPMESSAGESTORE_DEFINED")
[
object,
uuid(E883FC75-EC08-11d1-9A53-00C04FA309D4),
pointer_default(unique)
]
interface IMessageStore : IDatabase
{
//------------------------------------------------------------------
// Pointer to an interface of this type
//------------------------------------------------------------------
typedef IMessageStore *LPMESSAGESTORE;
//------------------------------------------------------------------
// Folder Database Version
//------------------------------------------------------------------
const DWORD FOLDER_DATABASE_VERSION = 5;
//------------------------------------------------------------------
// FOLDERID
//------------------------------------------------------------------
DECLARE_HANDLE(FOLDERID);
typedef FOLDERID *LPFOLDERID;
//------------------------------------------------------------------
// FOLDERID Constants
//------------------------------------------------------------------
const FOLDERID FOLDERID_ROOT = (FOLDERID)0x00000000;
const FOLDERID FOLDERID_LOCAL_STORE = (FOLDERID)0x00000001;
const FOLDERID FOLDERID_INVALID = (FOLDERID)-1;
//------------------------------------------------------------------
// Constants
//------------------------------------------------------------------
const DWORD CCHMAX_FOLDER_NAME = 259;
const DWORD CCHMAX_FOLDER_FILE = 260;
//------------------------------------------------------------------
// STOREUSERDATA
//------------------------------------------------------------------
typedef struct tagSTOREUSERDATA {
FILETIME ftCreated;
BYTE fConvertedToDBX;
BYTE rgbReserved[255];
} STOREUSERDATA, *LPSTOREUSERDATA;
//------------------------------------------------------------------
// FLDCOLID
//------------------------------------------------------------------
typedef enum tagFLDCOLID {
FLDCOL_ID=0,
FLDCOL_PARENT,
FLDCOL_NAME,
FLDCOL_FILE,
FLDCOL_DESCRIPTION,
FLDCOL_ACCOUNTID,
FLDCOL_FLAGS,
FLDCOL_MESSAGES,
FLDCOL_UNREAD,
FLDCOL_SPECIAL,
FLDCOL_TYPE,
FLDCOL_HIERARCHY,
FLDCOL_LISTSTAMP,
FLDCOL_SERVERHIGH,
FLDCOL_SERVERLOW,
FLDCOL_SERVERCOUNT,
FLDCOL_CLIENTHIGH,
FLDCOL_CLIENTLOW,
FLDCOL_NOTDOWNLOADED,
FLDCOL_REQUESTED,
FLDCOL_URLCOMPONENT,
FLDCOL_READ,
FLDCOL_THREADUNREAD,
FLDCOL_VIEWUNREAD,
FLDCOL_STATUSMSGDELTA,
FLDCOL_STATUSUNREADDELTA,
FLDCOL_WATCHEDHIGH,
FLDCOL_WATCHEDUNREAD,
FLDCOL_WATCHED,
FLDCOL_LAST
} FLDCOLID;
//------------------------------------------------------------------
// Folder Flags - Reuse the commented out stuff
//------------------------------------------------------------------
typedef DWORD FLDRFLAGS;
cpp_quote("#define FOLDER_SUBSCRIBED 0x00000001 // Indicates that a folder is subscribed")
// cpp_quote("#define FOLDER_HASSUBCHILD 0x00000002 // Indicates that a folder has an eventual subscribed child")
cpp_quote("#define FOLDER_CHILDRENKNOWN 0x00000004 // Indicates that LIST % already issued to get immediate children")
cpp_quote("#define FOLDER_SERVER 0x00000008 // Folder is a server node")
cpp_quote("#define FOLDER_HASCHILDREN 0x00000010 // The folder has children - doesn't specify subscribed state")
cpp_quote("#define FOLDER_CANDELETE 0x00000020 // The folder can be deleted")
cpp_quote("#define FOLDER_FINDRESULTS 0x00000040 // This is a search Folder)")
//cpp_quote("#define FOLDER_LOCALSTORE 0x00000080 // This is a store and it is the local store")
cpp_quote("#define FOLDER_HIDDEN 0x00000100 // The Folder Node should be hidden from the user")
cpp_quote("#define FOLDER_DROPTARGET 0x00000200 // Can drop to")
cpp_quote("#define FOLDER_HASNEWGROUPS 0x00000400 // Has new groups (news server only)")
cpp_quote("#define FOLDER_DOWNLOADHEADERS 0x00000800 // Synchronize new headers")
cpp_quote("#define FOLDER_DOWNLOADNEW 0x00001000 // Synchronize message bodies")
cpp_quote("#define FOLDER_DOWNLOADALL 0x00002000 // Synchronize all")
cpp_quote("#define FOLDER_MODERATED 0x00004000 // The folder is moderated (newsgroups)")
cpp_quote("#define FOLDER_BLOCKED 0x00008000 // The folder is blocked (newsgroups)")
cpp_quote("#define FOLDER_NOPOSTING 0x00010000 // The folder can not be posted to")
//cpp_quote("#define FOLDER_DEFAULTNEWSSTORE 0x00020000 // The folder is a store and is the default news store")
cpp_quote("#define FOLDER_CANRENAME 0x00040000 // Can Rename this folder")
cpp_quote("#define FOLDER_NOCHILDCREATE 0x00080000 // Child folders can not be created")
cpp_quote("#define FOLDER_CANHAVESPECIAL 0x00100000 // Only set with FOLDER_SERVER to note that the server can have special folders")
cpp_quote("#define FOLDER_NEW 0x00200000 // The folder is new (newsgroups)")
cpp_quote("#define FOLDER_SHOWALL 0x00400000 // Show all folders for this account (IMAP server)")
cpp_quote("#define FOLDER_EXPANDTREE 0x00800000 // Expand state of folder list treeview")
cpp_quote("#define FOLDER_NOSELECT 0x01000000 // Folder cannot be selected (IMAP)")
cpp_quote("#define FOLDER_NONEXISTENT 0x02000000 // Folder does not exist (IMAP)")
cpp_quote("#define FOLDER_NOTRANSLATEUTF7 0x04000000 // Folder name must NOT be converted to UTF7 (IMAP)")
cpp_quote("#define FOLDER_CREATEONDEMAND 0x08000000 // Folder was created offline, needs to be created on server")
cpp_quote("#define FOLDER_MSNSERVER 0x10000000 // Folder is a server associated with MSN.com")
//----------------------------------------------------------------------
// SPECIALFOLDER - How to identify a special folder
//----------------------------------------------------------------------
typedef BYTE SPECIALFOLDER;
const SPECIALFOLDER FOLDER_NOTSPECIAL = 0;
const SPECIALFOLDER FOLDER_INBOX = 1;
const SPECIALFOLDER FOLDER_OUTBOX = 2;
const SPECIALFOLDER FOLDER_SENT = 3;
const SPECIALFOLDER FOLDER_DELETED = 4;
const SPECIALFOLDER FOLDER_DRAFT = 5;
const SPECIALFOLDER FOLDER_ERRORS = 6;
const SPECIALFOLDER FOLDER_JUNK = 7;
const SPECIALFOLDER FOLDER_MSNPROMO = 8;
const SPECIALFOLDER FOLDER_BULKMAIL = 9;
const SPECIALFOLDER FOLDER_MAX = 10;
//------------------------------------------------------------------
// FOLDERTYPE
//------------------------------------------------------------------
typedef BYTE FOLDERTYPE;
const FOLDERTYPE FOLDER_ROOTNODE = 4;
const FOLDERTYPE FOLDER_LOCAL = 3;
const FOLDERTYPE FOLDER_HTTPMAIL = 2;
const FOLDERTYPE FOLDER_IMAP = 1;
const FOLDERTYPE FOLDER_NEWS = 0;
const FOLDERTYPE FOLDER_TYPESMAX = 5;
const FOLDERTYPE FOLDER_INVALID = 0xFF;
//------------------------------------------------------------------
// FOLDERINFO
//------------------------------------------------------------------
typedef struct tagFOLDERINFO {
BYTE *pAllocated;
BYTE bVersion;
FOLDERID idFolder;
FOLDERID idParent;
LPSTR pszName;
LPSTR pszFile;
LPSTR pszDescription;
LPSTR pszAccountId; // Server Nodes Only
LPSTR pszUrlComponent;
FLDRFLAGS dwFlags;
DWORD cMessages;
DWORD cUnread;
DWORD cWatched;
DWORD cThreadUnreadOld;
DWORD cViewUnreadOld;
DWORD cWatchedUnread;
SPECIALFOLDER tySpecial;
FOLDERTYPE tyFolder;
BYTE bHierarchy;
DWORD dwListStamp;
DWORD dwServerHigh; // highest numbered article on server (news)
DWORD dwServerLow; // lowest numbered article on server (news)
DWORD dwServerCount; // count of articles on server (news)
DWORD dwClientHigh; // highest numbered article known to client (news)
DWORD dwClientLow; // lowest numbered article known to client (news)
DWORD dwStatusMsgDelta; // total number of msgs added via STATUS resp. (IMAP)
DWORD dwStatusUnreadDelta; // number of unread added via STATUS resp. (IMAP)
DWORD dwNotDownloaded;
BLOB Requested;
BLOB Read;
DWORD dwClientWatchedHigh; // Highest numbered article we've checked for watch info (news)
} FOLDERINFO, *LPFOLDERINFO;
//------------------------------------------------------------------
// Folder Record Members
//------------------------------------------------------------------
cpp_quote("BEGIN_COLUMN_ARRAY(g_rgFldTblColumns, FLDCOL_LAST)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_ID, CDT_UNIQUE, FOLDERINFO, idFolder)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_PARENT, CDT_DWORD, FOLDERINFO, idParent)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_NAME, CDT_VARSTRA, FOLDERINFO, pszName)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_FILE, CDT_VARSTRA, FOLDERINFO, pszFile)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_DESCRIPTION, CDT_VARSTRA, FOLDERINFO, pszDescription)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_ACCOUNTID, CDT_VARSTRA, FOLDERINFO, pszAccountId)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_FLAGS, CDT_FLAGS, FOLDERINFO, dwFlags)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_MESSAGES, CDT_DWORD, FOLDERINFO, cMessages)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_UNREAD, CDT_DWORD, FOLDERINFO, cUnread)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_SPECIAL, CDT_BYTE, FOLDERINFO, tySpecial)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_TYPE, CDT_BYTE, FOLDERINFO, tyFolder)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_HIERARCHY, CDT_BYTE, FOLDERINFO, bHierarchy)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_LISTSTAMP, CDT_DWORD, FOLDERINFO, dwListStamp)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_SERVERHIGH, CDT_DWORD, FOLDERINFO, dwServerHigh)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_SERVERLOW, CDT_DWORD, FOLDERINFO, dwServerLow)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_SERVERCOUNT, CDT_DWORD, FOLDERINFO, dwServerCount)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_CLIENTHIGH, CDT_DWORD, FOLDERINFO, dwClientHigh)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_CLIENTLOW, CDT_DWORD, FOLDERINFO, dwClientLow)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_NOTDOWNLOADED, CDT_DWORD, FOLDERINFO, dwNotDownloaded)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_REQUESTED, CDT_VARBLOB, FOLDERINFO, Requested)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_URLCOMPONENT, CDT_VARSTRA, FOLDERINFO, pszUrlComponent)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_READ, CDT_VARBLOB, FOLDERINFO, Read)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_THREADUNREAD, CDT_DWORD, FOLDERINFO, cThreadUnreadOld)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_VIEWUNREAD, CDT_DWORD, FOLDERINFO, cViewUnreadOld)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_STATUSMSGDELTA, CDT_DWORD, FOLDERINFO, dwStatusMsgDelta)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_STATUSUNREADDELTA, CDT_DWORD, FOLDERINFO, dwStatusUnreadDelta)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_WATCHEDHIGH, CDT_DWORD, FOLDERINFO, dwClientWatchedHigh)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_WATCHEDUNREAD, CDT_DWORD, FOLDERINFO, cWatchedUnread)")
cpp_quote(" DEFINE_COLUMN(FLDCOL_WATCHED, CDT_DWORD, FOLDERINFO, cWatched)")
cpp_quote("END_COLUMN_ARRAY")
//------------------------------------------------------------------
// Folder Database Symbol Table for Regular Expression Support
//------------------------------------------------------------------
cpp_quote("BEGIN_SYMBOL_TABLE(g_FldSymbolTable, 2)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_DWORD, \"FOLDER_SUBSCRIBED\", FOLDER_SUBSCRIBED)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_COLUMN, \"FLDCOL_FLAGS\", FLDCOL_FLAGS)")
cpp_quote("END_SYMBOL_TABLE")
//------------------------------------------------------------------
// Foldername - parent folderid index
//------------------------------------------------------------------
cpp_quote("#define IINDEX_ALL 1")
cpp_quote("#define IINDEX_SUBSCRIBED 2")
//------------------------------------------------------------------
// Folder Table Primary Index Definition
//------------------------------------------------------------------
cpp_quote("BEGIN_TABLE_INDEX(g_FldTblPrimaryIndex, 1)")
cpp_quote(" DEFINE_KEY(FLDCOL_ID, 0, 0)")
cpp_quote("END_TABLE_INDEX")
//------------------------------------------------------------------
// ParentId/FolderName Index
//------------------------------------------------------------------
cpp_quote("BEGIN_TABLE_INDEX(g_FolderNameIndex, 2)")
cpp_quote(" DEFINE_KEY(FLDCOL_PARENT, 0, 0)")
cpp_quote(" DEFINE_KEY(FLDCOL_NAME, COMPARE_ASANSI | COMPARE_IGNORECASE, 0)")
cpp_quote("END_TABLE_INDEX")
//------------------------------------------------------------------
// Folder Record Format
//------------------------------------------------------------------
cpp_quote("BEGIN_TABLE_SCHEMA(g_FolderTableSchema, CLSID_FolderDatabase, FOLDERINFO)")
cpp_quote(" SCHEMA_PROPERTY(FOLDER_DATABASE_VERSION)")
cpp_quote(" SCHEMA_PROPERTY(TSF_RESETIFBADVERSION | TSF_HASEXTENSION)")
cpp_quote(" SCHEMA_PROPERTY(sizeof(STOREUSERDATA))")
cpp_quote(" SCHEMA_PROPERTY(offsetof(FOLDERINFO, idFolder))")
cpp_quote(" SCHEMA_PROPERTY(FLDCOL_LAST)")
cpp_quote(" SCHEMA_PROPERTY(g_rgFldTblColumns)")
cpp_quote(" SCHEMA_PROPERTY(&g_FldTblPrimaryIndex)")
cpp_quote(" SCHEMA_PROPERTY(&g_FldSymbolTable)")
cpp_quote("END_TABLE_SCHEMA")
//------------------------------------------------------------------
// Extern'ed Record Formats
//------------------------------------------------------------------
cpp_quote("extern const TABLESCHEMA g_FolderTableSchema;")
cpp_quote("extern const TABLEINDEX g_FolderNameIndex;")
//------------------------------------------------------------------
// CONNECT_STATE
//------------------------------------------------------------------
typedef enum tagCONNECT_STATE {
CONNECT_STATE_DISCONNECT = 0,
CONNECT_STATE_CONNECT,
CONNECT_STATE_LAST
} CONNECT_STATE;
//------------------------------------------------------------------
// CREATEFOLDERFLAGS
//------------------------------------------------------------------
typedef DWORD CREATEFOLDERFLAGS;
cpp_quote("#define CREATE_FOLDER_UNIQUIFYNAME 0x00000002")
cpp_quote("#define CREATE_FOLDER_LOCALONLY 0x00000004")
//------------------------------------------------------------------
// STOREVALIDATEFLAGS
//------------------------------------------------------------------
typedef DWORD STOREVALIDATEFLAGS;
cpp_quote("#define STORE_VALIDATE_DONTSYNCWITHACCOUNTS 0x00000001")
//------------------------------------------------------------------
// RENAMEFOLDERFLAGS
//------------------------------------------------------------------
typedef DWORD RENAMEFOLDERFLAGS;
//------------------------------------------------------------------
// MOVEFOLDERFLAGS
//------------------------------------------------------------------
typedef DWORD MOVEFOLDERFLAGS;
//------------------------------------------------------------------
// OPENFOLDERFLAGS
//------------------------------------------------------------------
typedef DWORD OPENFOLDERFLAGS;
cpp_quote("#define OPEN_FOLDER_NOCREATE 0x00000001")
//------------------------------------------------------------------
// DELETEFOLDERFLAGS
//------------------------------------------------------------------
typedef DWORD DELETEFOLDERFLAGS;
cpp_quote("#define DELETE_FOLDER_CHILDRENONLY 0x00000001")
cpp_quote("#define DELETE_FOLDER_RECURSIVE 0x00000002")
cpp_quote("#define DELETE_FOLDER_NOTRASHCAN 0x00000004")
cpp_quote("#define DELETE_FOLDER_DELETESPECIAL 0x00000008")
//------------------------------------------------------------------
// SYNCSTOREFLAGS
//------------------------------------------------------------------
typedef DWORD SYNCSTOREFLAGS;
cpp_quote("#define SYNC_STORE_REFRESH 0x00000001")
cpp_quote("#define SYNC_STORE_GET_DESCRIPTIONS 0x00000002")
//------------------------------------------------------------------
// SETMESSAGEFLAGSFLAGS
//------------------------------------------------------------------
typedef DWORD SETMESSAGEFLAGSFLAGS;
cpp_quote("#define SET_MESSAGE_FLAGS_FORCE 0x00000001")
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
HRESULT Initialize(
[in] LPCSTR pszDirectory);
HRESULT Validate(
[in] STOREVALIDATEFLAGS dwFlags);
HRESULT GetDirectory(
[in] LPSTR pszDirectory,
[in] DWORD cchMaxDir);
HRESULT Synchronize(
[in] FOLDERID idFolder,
[in] SYNCSTOREFLAGS dwFlags,
[in] IStoreCallback *pCallback);
HRESULT FindServerId(
[in] LPCSTR pszAcctId,
[out] LPFOLDERID pidServer);
HRESULT CreateServer(
[in] IImnAccount *pAccount,
[in] FLDRFLAGS dwFlags,
[out] LPFOLDERID pidFolder);
HRESULT CreateFolder(
[in] CREATEFOLDERFLAGS dwCreateFlags,
[in,out] LPFOLDERINFO pInfo,
[in] IStoreCallback *pCallback);
HRESULT OpenSpecialFolder(
[in] FOLDERID idStore,
[in] IMessageServer *pServer,
[in] SPECIALFOLDER tySpecial,
[out] IMessageFolder **ppFolder);
HRESULT OpenFolder(
[in] FOLDERID idFolder,
[in] IMessageServer *pServer,
[in] OPENFOLDERFLAGS dwFlags,
[out] IMessageFolder **ppFolder);
HRESULT MoveFolder(
[in] FOLDERID idFolder,
[in] FOLDERID idParentNew,
[in] MOVEFOLDERFLAGS dwFlags,
[in] IStoreCallback *pCallback);
HRESULT RenameFolder(
[in] FOLDERID idFolder,
[in] LPCSTR pszName,
[in] RENAMEFOLDERFLAGS dwFlags,
[in] IStoreCallback *pCallback);
HRESULT DeleteFolder(
[in] FOLDERID idFolder,
[in] DELETEFOLDERFLAGS dwFlags,
[in] IStoreCallback *pCallback);
HRESULT GetFolderInfo(
[in] FOLDERID idFolder,
[in,out] LPFOLDERINFO pInfo); // Call IMessageStore::FreeRecord on success
HRESULT GetSpecialFolderInfo(
[in] FOLDERID idStore,
[in] SPECIALFOLDER tySpecial,
[in,out] LPFOLDERINFO pInfo); // Call IMessageStore::FreeRecord on success
HRESULT SubscribeToFolder(
[in] FOLDERID idFolder,
[in] BOOL fSubscribe,
[in] IStoreCallback *pCallback);
HRESULT GetFolderCounts(
[in] FOLDERID idFolder,
[in] IStoreCallback *pCallback);
HRESULT UpdateFolderCounts(
[in] FOLDERID idFolder,
[in] LONG lMsgs,
[in] LONG lUnread,
[in] LONG lWatchedUnread,
[in] LONG lWatched);
HRESULT EnumChildren(
[in] FOLDERID idParent,
[in] BOOL fSubscribed,
[out] IEnumerateFolders **ppEnum);
HRESULT GetNewGroups(
[in] FOLDERID idFolder,
[in] LPSYSTEMTIME pSysTime,
[in] IStoreCallback *pCallback);
}
cpp_quote("#endif // __LPMESSAGESTORE_DEFINED")
//----------------------------------------------------------------------
// IEnumerateFolders
//----------------------------------------------------------------------
cpp_quote("#ifndef __LPENUMERATEFOLDERS_DEFINED")
cpp_quote("#define __LPENUMERATEFOLDERS_DEFINED")
[
object,
uuid(8551C145-0C39-11d2-9A6A-00C04FA309D4),
pointer_default(unique)
]
interface IEnumerateFolders : IUnknown
{
//------------------------------------------------------------------
// Pointer to an interface of this type
//------------------------------------------------------------------
typedef IEnumerateFolders *LPENUMERATEFOLDERS;
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
HRESULT Next(
[in] ULONG cFetch,
[in,out] LPFOLDERINFO prgInfo,
[out] ULONG *pcFetched);
HRESULT Skip(
[in] ULONG cItems);
HRESULT Reset(void);
HRESULT Clone(
[out] IEnumerateFolders **ppEnum);
HRESULT Count(
[out] ULONG *pcItems);
}
cpp_quote("#endif // __LPENUMERATEFOLDERS_DEFINED")
//----------------------------------------------------------------------
// IMessageFolder
//----------------------------------------------------------------------
cpp_quote("#ifndef __LPMESSAGEFOLDER_DEFINED")
cpp_quote("#define __LPMESSAGEFOLDER_DEFINED")
[
object,
uuid(E883FC76-EC08-11d1-9A53-00C04FA309D4),
pointer_default(unique)
]
interface IMessageFolder : IDatabase
{
//------------------------------------------------------------------
// Pointer to an interface of this type
//------------------------------------------------------------------
typedef IMessageFolder *LPMESSAGEFOLDER;
//------------------------------------------------------------------
// Types
//------------------------------------------------------------------
DECLARE_HANDLE(MESSAGEID);
typedef MESSAGEID *LPMESSAGEID;
//------------------------------------------------------------------
// MESSAGEID Constants
//------------------------------------------------------------------
const MESSAGEID MESSAGEID_INVALID = (MESSAGEID)-1;
//------------------------------------------------------------------
// Message Database Version
//------------------------------------------------------------------
const DWORD MESSAGE_DATABASE_VERSION = 5;
const DWORD CB_COLUMNS = 256;
//------------------------------------------------------------------
// MSGTABLECOLID
//------------------------------------------------------------------
typedef enum tagMSGTABLECOLID {
MSGCOL_ID=0,
MSGCOL_FLAGS,
MSGCOL_DATE,
MSGCOL_LINECOUNT,
MSGCOL_STREAM,
MSGCOL_NORMALSUBJ,
MSGCOL_DOWNLOADTIME,
MSGCOL_MESSAGEID,
MSGCOL_SUBJECT,
MSGCOL_FROMHEADER,
MSGCOL_REFERENCES,
MSGCOL_XREF,
MSGCOL_SERVER,
MSGCOL_DISPLAYFROM,
MSGCOL_EMAILFROM,
MSGCOL_LANGUAGE,
MSGCOL_PRIORITY,
MSGCOL_SIZE,
MSGCOL_RECEIVEDDATE,
MSGCOL_DISPLAYTO,
MSGCOL_EMAILTO,
MSGCOL_PARTIALINFO,
MSGCOL_POP3UIDL,
MSGCOL_USERNAMEOLD,
MSGCOL_PARTIALID,
MSGCOL_FORWARDTO,
MSGCOL_ACCOUNTNAME,
MSGCOL_ACCOUNTID,
MSGCOL_OFFSETTABLE,
MSGCOL_HIGHLIGHT,
MSGCOL_FOLDER,
MSGCOL_FINDFOLDER,
MSGCOL_FINDSOURCE,
MSGCOL_PARENTOLD,
MSGCOL_THREADIDOLD,
MSGCOL_URLCOMPONENT,
MSGCOL_STREAMIDOLD,
MSGCOL_VERSION,
MSGCOL_MSOESREC,
MSGCOL_LASTID
} MSGTABLECOLID;
//----------------------------------------------------------------------
// RULEID
//----------------------------------------------------------------------
DECLARE_HANDLE(RULEID);
typedef RULEID *LPRULEID;
const RULEID RULEID_INVALID = (RULEID) -1;
//------------------------------------------------------------------
// FOLDERUSERDATA - 1560 Bytes Long
//------------------------------------------------------------------
typedef struct tagFOLDERUSERDATA {
DWORD fInitialized; // 4 Has this folder been initialized yet
FOLDERTYPE tyFolder; // the folder type
CHAR szAcctId[CCHMAX_ACCOUNT_NAME]; // 276 Account Id that folder belongs to
CHAR szFolder[CCHMAX_FOLDER_NAME]; // 532 Folder Name
SPECIALFOLDER tySpecial; // 536 Special Folder Type
DWORD fSubscribed; // 540 Is the folder subscribed ?
DWORD idSort; // 544 Current View Sort Order
DWORD fAscending; // 548 Current view is ascending ?
DWORD fThreaded; // 552 Current view is threaded
RULEID ridFilter; // 556 Current Filter for this Folder
DWORD dwFilterVersion; // 560 Version of the filter
FOLDERID idFolder; // 564 Id of this folder
DWORD fWelcomeAdded; // 568 I have already added a welcome message...
DWORD dwUIDValidity; // 572 IMAP: Tells us if current acache is invalid
DWORD idMsgSelected; // The last Selected row
BYTE rgbColumns[CB_COLUMNS]; // Persisted Column Set
DWORD dwReserved1; // Used for sorting children
DWORD dwReserved2; // Reserved
DWORD fExpandAll; // Expand All Threads?
DWORD dwReserved3; // Do we have a dead filter?
BYTE fViewCounts; // Converted to view counts
BYTE fNewThreadModel; // Converted to shared stream table ?
BYTE fWatchedCounts; // Converted to watched unread counts?
BYTE fTotalWatched; // Total Watched has been migrated.
BYTE fShowDeleted; // Current view shows deleted messages
BYTE fShowReplies; // Current view shows message replies
BYTE fNoIndexes; // No more indexes
BYTE rgReserved[717]; // Reserved
} FOLDERUSERDATA, *LPFOLDERUSERDATA;
//------------------------------------------------------------------
// ARF_ article flags - These are the MSGFLAGS
//------------------------------------------------------------------
typedef DWORD MESSAGEFLAGS;
cpp_quote("#define ARF_HASBODY 0x00000001")
cpp_quote("#define ARF_ARTICLE_EXPIRED 0x00000002")
cpp_quote("#define ARF_KEEPBODY 0x00000004")
cpp_quote("#define ARF_UNSENT 0x00000008")
cpp_quote("#define ARF_MIGRATED 0x00000010")
cpp_quote("#define ARF_FLAGGED 0x00000020")
cpp_quote("#define ARF_ENDANGERED 0x00000040")
cpp_quote("#define ARF_READ 0x00000080")
cpp_quote("#define ARF_DOWNLOAD 0x00000100")
//cpp_quote("#define ARF_VISIBLE 0x00000200")
cpp_quote("#define ARF_NOSECUI 0x00000400")
cpp_quote("#define ARF_NEWSMSG 0x00000800")
cpp_quote("#define ARF_SIGNED 0x00001000")
cpp_quote("#define ARF_ENCRYPTED 0x00002000")
cpp_quote("#define ARF_HASATTACH 0x00004000")
cpp_quote("#define ARF_VOICEMAIL 0x00008000")
cpp_quote("#define ARF_SUBMITTED 0x00010000")
cpp_quote("#define ARF_RECEIVED 0x00020000")
cpp_quote("#define ARF_RCPTSENT 0x00040000")
cpp_quote("#define ARF_REPLIED 0x00080000")
cpp_quote("#define ARF_FORWARDED 0x00100000")
//cpp_quote("#define ARF_EXPANDED 0x00200000")
cpp_quote("#define ARF_WATCH 0x00400000")
cpp_quote("#define ARF_IGNORE 0x00800000")
//cpp_quote("#define ARF_HASCHILDREN 0x01000000")
cpp_quote("#define ARF_RCPT_PROCESSED 0x01000000")
cpp_quote("#define ARF_DELETED_OFFLINE 0x02000000")
cpp_quote("#define ARF_PARTIAL_RECVTIME 0x04000000")
cpp_quote("#define ARF_ALLFLAGS 0x0FFFFFFF")
//------------------------------------------------------------------
// MESSAGE_COMBINED
//------------------------------------------------------------------
const DWORD MESSAGE_COMBINED = -1;
//------------------------------------------------------------------
// MESSAGEINFO
//------------------------------------------------------------------
typedef struct tagMESSAGEINFO {
BYTE *pAllocated;
BYTE bVersion;
DWORD_PTR dwReserved;
MESSAGEID idMessage;
MESSAGEFLAGS dwFlags;
FILETIME ftSent;
DWORD cLines;
FILEADDRESS faStream;
DWORD idStreamOld;
LPSTR pszNormalSubj;
FILETIME ftDownloaded;
LPSTR pszMessageId;
LPSTR pszSubject;
LPSTR pszFromHeader;
LPSTR pszReferences;
LPSTR pszXref;
LPSTR pszServer;
LPSTR pszDisplayFrom;
LPSTR pszEmailFrom;
WORD wLanguage;
WORD wPriority; // IMSGPRIORITY
DWORD cbMessage;
FILETIME ftReceived;
LPSTR pszDisplayTo;
LPSTR pszEmailTo;
DWORD dwPartial; // Set to MESSAGE_COMBINED to indicate its a combined message
LPSTR pszUidl;
LPSTR pszUserNameOld;
LPSTR pszPartialId;
LPSTR pszForwardTo;
LPSTR pszAcctName;
LPSTR pszAcctId;
LPSTR pszUrlComponent;
BLOB Offsets;
WORD wHighlight;
LPSTR pszFolder; // Only used in a find folder
DWORD iFindFolder; // Only used in a find folder
MESSAGEID idFindSource; // Only used in a find folder
MESSAGEID idParentOld; // Used for Message Threading
BLOB ThreadIdOld; // Used for custom threaded view
BYTE bUnused; // The major version of oe in which this was downloaded by
LPSTR pszMSOESRec;
} MESSAGEINFO, *LPMESSAGEINFO;
//------------------------------------------------------------------
// Message Record Members
//------------------------------------------------------------------
cpp_quote("BEGIN_COLUMN_ARRAY(g_rgMsgTblColumns, MSGCOL_LASTID)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_ID, CDT_UNIQUE, MESSAGEINFO, idMessage)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_FLAGS, CDT_FLAGS, MESSAGEINFO, dwFlags)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_DATE, CDT_FILETIME, MESSAGEINFO, ftSent)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_LINECOUNT, CDT_DWORD, MESSAGEINFO, cLines)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_STREAM, CDT_STREAM, MESSAGEINFO, faStream)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_NORMALSUBJ, CDT_VARSTRA, MESSAGEINFO, pszNormalSubj)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_DOWNLOADTIME, CDT_FILETIME, MESSAGEINFO, ftDownloaded)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_MESSAGEID, CDT_VARSTRA, MESSAGEINFO, pszMessageId)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_SUBJECT, CDT_VARSTRA, MESSAGEINFO, pszSubject)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_FROMHEADER, CDT_VARSTRA, MESSAGEINFO, pszFromHeader)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_REFERENCES, CDT_VARSTRA, MESSAGEINFO, pszReferences)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_XREF, CDT_VARSTRA, MESSAGEINFO, pszXref)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_SERVER, CDT_VARSTRA, MESSAGEINFO, pszServer)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_DISPLAYFROM, CDT_VARSTRA, MESSAGEINFO, pszDisplayFrom)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_EMAILFROM, CDT_VARSTRA, MESSAGEINFO, pszEmailFrom)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_LANGUAGE, CDT_WORD, MESSAGEINFO, wLanguage)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_PRIORITY, CDT_WORD, MESSAGEINFO, wPriority)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_SIZE, CDT_DWORD, MESSAGEINFO, cbMessage)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_RECEIVEDDATE, CDT_FILETIME, MESSAGEINFO, ftReceived)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_DISPLAYTO, CDT_VARSTRA, MESSAGEINFO, pszDisplayTo)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_EMAILTO, CDT_VARSTRA, MESSAGEINFO, pszEmailTo)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_PARTIALINFO, CDT_DWORD, MESSAGEINFO, dwPartial)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_POP3UIDL, CDT_VARSTRA, MESSAGEINFO, pszUidl)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_USERNAMEOLD, CDT_VARSTRA, MESSAGEINFO, pszUserNameOld)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_PARTIALID, CDT_VARSTRA, MESSAGEINFO, pszPartialId)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_FORWARDTO, CDT_VARSTRA, MESSAGEINFO, pszForwardTo)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_ACCOUNTNAME, CDT_VARSTRA, MESSAGEINFO, pszAcctName)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_ACCOUNTID, CDT_VARSTRA, MESSAGEINFO, pszAcctId)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_OFFSETTABLE, CDT_VARBLOB, MESSAGEINFO, Offsets)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_HIGHLIGHT, CDT_WORD, MESSAGEINFO, wHighlight)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_FOLDER, CDT_VARSTRA, MESSAGEINFO, pszFolder)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_FINDFOLDER, CDT_DWORD, MESSAGEINFO, iFindFolder)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_FINDSOURCE, CDT_DWORD, MESSAGEINFO, idFindSource)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_PARENTOLD, CDT_DWORD, MESSAGEINFO, idParentOld)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_THREADIDOLD, CDT_VARBLOB, MESSAGEINFO, ThreadIdOld)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_URLCOMPONENT, CDT_VARSTRA, MESSAGEINFO, pszUrlComponent)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_STREAMIDOLD, CDT_DWORD, MESSAGEINFO, idStreamOld)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_VERSION, CDT_BYTE, MESSAGEINFO, bUnused)")
cpp_quote(" DEFINE_COLUMN(MSGCOL_MSOESREC, CDT_VARSTRA, MESSAGEINFO, pszMSOESRec)")
cpp_quote("END_COLUMN_ARRAY")
//------------------------------------------------------------------
// Database MethodIds
//------------------------------------------------------------------
cpp_quote("#define METHODID_ISREPLYPOSTVISIBLE 100")
cpp_quote("#define METHODID_MESSAGEAGEINDAYS 101")
//------------------------------------------------------------------
// Message Database Symbol Table for Regular Expression Support
//------------------------------------------------------------------
cpp_quote("BEGIN_SYMBOL_TABLE(g_MsgSymbolTable, 21)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_DWORD, \"ARF_READ\", ARF_READ)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_DWORD, \"ARF_HASBODY\", ARF_HASBODY)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_DWORD, \"ARF_ENDANGERED\", ARF_ENDANGERED)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_COLUMN, \"MSGCOL_FLAGS\", MSGCOL_FLAGS)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_COLUMN, \"MSGCOL_EMAILFROM\", MSGCOL_EMAILFROM)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_DWORD, \"ARF_WATCH\", ARF_WATCH)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_DWORD, \"ARF_IGNORE\", ARF_IGNORE)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_DWORD, \"ARF_HASATTACH\", ARF_HASATTACH)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_DWORD, \"ARF_SIGNED\", ARF_SIGNED)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_DWORD, \"ARF_ENCRYPTED\", ARF_ENCRYPTED)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_COLUMN, \"MSGCOL_PRIORITY\", MSGCOL_PRIORITY)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_COLUMN, \"MSGCOL_SUBJECT\", MSGCOL_SUBJECT)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_COLUMN, \"MSGCOL_FROMHEADER\", MSGCOL_FROMHEADER)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_COLUMN, \"MSGCOL_ACCOUNTID\", MSGCOL_ACCOUNTID)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_COLUMN, \"MSGCOL_LINECOUNT\", MSGCOL_LINECOUNT)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_DWORD, \"IMSG_PRI_HIGH\", IMSG_PRI_HIGH)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_DWORD, \"IMSG_PRI_LOW\", IMSG_PRI_LOW)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_COLUMN, \"MSGCOL_DISPLAYFROM\", MSGCOL_DISPLAYFROM)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_DWORD, \"ARF_FLAGGED\", ARF_FLAGGED)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_METHOD, \"MessageAgeInDays\", METHODID_MESSAGEAGEINDAYS)")
cpp_quote(" DEFINE_SYMBOL(SYMBOL_DWORD, \"ARF_DELETED_OFFLINE\", ARF_DELETED_OFFLINE)")
cpp_quote("END_SYMBOL_TABLE")
//------------------------------------------------------------------
// Index Constants
//------------------------------------------------------------------
const INDEXORDINAL IINDEX_HTTPURL = 3;
const INDEXORDINAL IINDEX_FINDER = 2;
const INDEXORDINAL IINDEX_WATCHIGNORE = 1;
//------------------------------------------------------------------
// g_MsgTblPrimaryIndex
//------------------------------------------------------------------
cpp_quote("BEGIN_TABLE_INDEX(g_MsgTblPrimaryIndex, 1)")
cpp_quote(" DEFINE_KEY(MSGCOL_ID, 0, 0)")
cpp_quote("END_TABLE_INDEX")
//------------------------------------------------------------------
// g_WatchIgnoreIndex
//------------------------------------------------------------------
cpp_quote("BEGIN_TABLE_INDEX(g_WatchIgnoreIndex, 2)")
cpp_quote(" DEFINE_KEY(MSGCOL_MESSAGEID, 0, 0)")
cpp_quote(" DEFINE_KEY(MSGCOL_ID, 0, 0)")
cpp_quote("END_TABLE_INDEX")
//------------------------------------------------------------------
// g_HttpUrlIndex
//------------------------------------------------------------------
cpp_quote("BEGIN_TABLE_INDEX(g_HttpUrlIndex, 2)")
cpp_quote(" DEFINE_KEY(MSGCOL_URLCOMPONENT, 0, 0)")
cpp_quote(" DEFINE_KEY(MSGCOL_ID, 0, 0)")
cpp_quote("END_TABLE_INDEX")
//------------------------------------------------------------------
// Message Record Format
//------------------------------------------------------------------
cpp_quote("BEGIN_TABLE_SCHEMA(g_MessageTableSchema, CLSID_MessageDatabase, MESSAGEINFO)")
cpp_quote(" SCHEMA_PROPERTY(MESSAGE_DATABASE_VERSION)")
cpp_quote(" SCHEMA_PROPERTY(TSF_HASSTREAMS | TSF_RESETIFBADVERSION | TSF_HASEXTENSION)")
cpp_quote(" SCHEMA_PROPERTY(sizeof(FOLDERUSERDATA))")
cpp_quote(" SCHEMA_PROPERTY(offsetof(MESSAGEINFO, idMessage))")
cpp_quote(" SCHEMA_PROPERTY(MSGCOL_LASTID)")
cpp_quote(" SCHEMA_PROPERTY(g_rgMsgTblColumns)")
cpp_quote(" SCHEMA_PROPERTY(&g_MsgTblPrimaryIndex)")
cpp_quote(" SCHEMA_PROPERTY(&g_MsgSymbolTable)")
cpp_quote("END_TABLE_SCHEMA")
//------------------------------------------------------------------
// Extern'ed Record Formats
//------------------------------------------------------------------
cpp_quote("extern const TABLESCHEMA g_MessageTableSchema;")
cpp_quote("extern const TABLEINDEX g_WatchIgnoreIndex;")
cpp_quote("extern const TABLEINDEX g_HttpUrlIndex;")
//----------------------------------------------------------------------
// COLUMN_ID
//----------------------------------------------------------------------
typedef enum tagCOLUMN_ID {
COLUMN_TO = 0,
COLUMN_FROM,
COLUMN_SUBJECT,
COLUMN_RECEIVED,
COLUMN_SENT,
COLUMN_SIZE,
COLUMN_FOLDER,
COLUMN_TOTAL,
COLUMN_UNREAD,
COLUMN_NEW,
COLUMN_DESCRIPTION,
COLUMN_LAST_UPDATED,
COLUMN_WASTED_SPACE,
COLUMN_ACCOUNT,
COLUMN_LINES,
COLUMN_PRIORITY,
COLUMN_ATTACHMENT,
COLUMN_SHOW,
COLUMN_DOWNLOAD,
COLUMN_NEWSGROUP,
COLUMN_FLAG,
COLUMN_SUBSCRIBE,
COLUMN_DOWNLOADMSG,
COLUMN_THREADSTATE,
COLUMN_MSGID,
COLUMN_MAX
} COLUMN_ID;
//------------------------------------------------------------------
// RESULTINFO
//------------------------------------------------------------------
typedef struct tagRESULTINFO {
HRESULT hrResult; // Result of Operation (S_OK means it succeeded)
MESSAGEID idMessage; // MessageId Of Affected Message
MESSAGEFLAGS dwFlags; // Flags of the message
} RESULTINFO, *LPRESULTINFO;
//------------------------------------------------------------------
// RESULTLIST
//------------------------------------------------------------------
typedef struct tagRESULTLIST {
DWORD cAllocated;
DWORD cMsgs;
DWORD cValid;
LPRESULTINFO prgResult;
} RESULTLIST, *LPRESULTLIST;
//----------------------------------------------------------------------
// MESSAGEIDLIST - A list of message ids (DWORDs)
//----------------------------------------------------------------------
typedef struct tagMESSAGEIDLIST {
DWORD cAllocated;
DWORD cMsgs;
LPMESSAGEID prgidMsg;
} MESSAGEIDLIST, *LPMESSAGEIDLIST;
//------------------------------------------------------------------
// FOLDERSORTINFO
//------------------------------------------------------------------
typedef struct tagFOLDERSORTINFO {
COLUMN_ID idColumn;
BOOL fAscending;
BOOL fThreaded;
BOOL fExpandAll;
RULEID ridFilter;
BOOL fShowDeleted;
BOOL fShowReplies;
} FOLDERSORTINFO, *LPFOLDERSORTINFO;
//------------------------------------------------------------------
// ADJUSTFLAGS
//------------------------------------------------------------------
typedef struct tagADJUSTFLAGS {
MESSAGEFLAGS dwRemove;
MESSAGEFLAGS dwAdd;
} ADJUSTFLAGS, *LPADJUSTFLAGS;
//------------------------------------------------------------------
// OPENMESSAGEFLAGS
//------------------------------------------------------------------
typedef DWORD OPENMESSAGEFLAGS;
cpp_quote("#define OPEN_MESSAGE_SECURE 0x00000001")
cpp_quote("#define OPEN_MESSAGE_CACHEDONLY 0x00000002")
//------------------------------------------------------------------
// SAVEMESSAGEFLAGS
//------------------------------------------------------------------
typedef DWORD SAVEMESSAGEFLAGS;
cpp_quote("#define SAVE_MESSAGE_GENID 0x00000001")
//------------------------------------------------------------------
// COPYMESSAGEFLAGS
//------------------------------------------------------------------
typedef DWORD COPYMESSAGEFLAGS;
cpp_quote("#define COPY_MESSAGE_MOVE 0x00000001")
//------------------------------------------------------------------
// DELETEMESSAGEFLAGS
//------------------------------------------------------------------
typedef DWORD DELETEMESSAGEFLAGS;
cpp_quote("#define DELETE_MESSAGE_NOTRASHCAN 0x00000001")
cpp_quote("#define DELETE_MESSAGE_UNDELETE 0x00000002 // IMAP-only, unmarks msg for deletion")
cpp_quote("#define DELETE_MESSAGE_NOPROMPT 0x00000004")
cpp_quote("#define DELETE_MESSAGE_MAYIGNORENOTRASH 0x00000008 // For HTTPMail. HTTPServer doesn't support NOTRASH yet")
cpp_quote("#define DELETE_MESSAGE_NOUIDLUPDATE 0x00000010")
//------------------------------------------------------------------
// SYNCFOLDERFLAGS
//------------------------------------------------------------------
typedef DWORD SYNCFOLDERFLAGS;
cpp_quote("#define SYNC_FOLDER_DEFAULT 0x00000000")
cpp_quote("#define SYNC_FOLDER_XXX_HEADERS 0x00000001")
cpp_quote("#define SYNC_FOLDER_NEW_HEADERS 0x00000002")
cpp_quote("#define SYNC_FOLDER_CACHED_HEADERS 0x00000004")
cpp_quote("#define SYNC_FOLDER_PURGE_DELETED 0x00000008")
cpp_quote("#define SYNC_FOLDER_ALLFLAGS 0x0000000F")
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
HRESULT Initialize(
[in] IMessageStore *pStore,
[in] IMessageServer *pServer,
[in] OPENFOLDERFLAGS dwFlags,
[in] FOLDERID idFolder);
HRESULT SetOwner(
[in] IStoreCallback *pDefaultCallback);
HRESULT Close();
HRESULT GetFolderId(
[out] LPFOLDERID pidFolder);
HRESULT GetMessageFolderId(
[in] MESSAGEID idMessage,
[out] LPFOLDERID pidFolder);
HRESULT Synchronize(
[in] SYNCFOLDERFLAGS dwFlags,
[in] DWORD cHeaders,
[in] IStoreCallback *pCallback);
HRESULT OpenMessage(
[in] MESSAGEID idMessage,
[in] OPENMESSAGEFLAGS dwFlags,
[out] IMimeMessage **ppMessage,
[in] IStoreCallback *pCallback);
HRESULT SaveMessage(
[in,out] LPMESSAGEID pidMessage,
[in] SAVEMESSAGEFLAGS dwOptions,
[in] MESSAGEFLAGS dwFlags,
[in] IStream *pStream, // Efficient if this is a Stream Opened from IDatabase::CreateStream
[in] IMimeMessage *pMessage,
[in] IStoreCallback *pCallback);
HRESULT SetMessageStream(
[in] MESSAGEID idMessage,
[in] IStream *pStream);
HRESULT SetMessageFlags(
[in] LPMESSAGEIDLIST pList,
[in] LPADJUSTFLAGS pFlags,
[in,out] LPRESULTLIST pResults,
[in] IStoreCallback *pCallback);
HRESULT CopyMessages(
[in] IMessageFolder *pDest,
[in] COPYMESSAGEFLAGS dwFlags,
[in] LPMESSAGEIDLIST pList,
[in] LPADJUSTFLAGS pFlags,
[in,out] LPRESULTLIST pResults,
[in] IStoreCallback *pCallback);
HRESULT DeleteMessages(
[in] DELETEMESSAGEFLAGS dwFlags,
[in] LPMESSAGEIDLIST pList,
[in,out] LPRESULTLIST pResults,
[in] IStoreCallback *pCallback);
HRESULT ResetFolderCounts(
[in] DWORD cMessages,
[in] DWORD cUnread,
[in] DWORD cWatchedUnread,
[in] DWORD cWatched);
HRESULT IsWatched(
[in] LPCSTR pszReferences,
[in] LPCSTR pszSubject);
HRESULT GetDatabase(
[out] IDatabase **ppDB);
HRESULT ConnectionAddRef(void);
HRESULT ConnectionRelease(void);
HRESULT GetAdBarUrl(
[in] IStoreCallback *pCallback);
}
cpp_quote("#endif // __LPMESSAGEFOLDER_DEFINED")
//----------------------------------------------------------------------
// ITimeoutCallback
//----------------------------------------------------------------------
cpp_quote("#ifndef __LPTIMEOUTCALLBACK_DEFINED")
cpp_quote("#define __LPTIMEOUTCALLBACK_DEFINED")
[
object,
uuid(28B44B1D-07A9-11d2-9A63-00C04FA309D4),
pointer_default(unique)
]
interface ITimeoutCallback : IUnknown
{
//------------------------------------------------------------------
// Pointer to an interface of this type
//------------------------------------------------------------------
typedef ITimeoutCallback *LPTIMEOUTCALLBACK;
//------------------------------------------------------------------
// TIMEOUTRESPONSE
//------------------------------------------------------------------
typedef enum tagTIMEOUTRESPONSE {
TIMEOUT_RESPONSE_STOP,
TIMEOUT_RESPONSE_WAIT
} TIMEOUTRESPONSE;
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
HRESULT OnTimeoutResponse(
[in] TIMEOUTRESPONSE eResponse);
};
cpp_quote("#endif // __LPTIMEOUTCALLBACK_DEFINED")
//----------------------------------------------------------------------
// IOperationCancel
//----------------------------------------------------------------------
cpp_quote("#ifndef __LPOPERATIONCANCEL_DEFINED")
cpp_quote("#define __LPOPERATIONCANCEL_DEFINED")
[
object,
uuid(F4DA2F80-07A0-11d2-AAB3-006097D474C4),
pointer_default(unique)
]
interface IOperationCancel : IUnknown
{
typedef enum tagCANCELTYPE {
CT_INVALID,
CT_ABORT,
CT_CANCEL
} CANCELTYPE;
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
HRESULT Cancel(
[in] CANCELTYPE tyCancel);
}
cpp_quote("#endif // __LPOPERATIONCANCEL_DEFINED")
//----------------------------------------------------------------------
// IStoreCallback
//----------------------------------------------------------------------
cpp_quote("#ifndef __LPSTORECALLBACK_DEFINED")
cpp_quote("#define __LPSTORECALLBACK_DEFINED")
[
object,
uuid(CFAD2437-EC54-11d1-9A54-00C04FA309D4),
pointer_default(unique)
]
interface IStoreCallback : IUnknown
{
//------------------------------------------------------------------
// Pointer to an interface of this type
//------------------------------------------------------------------
typedef IStoreCallback *LPSTORECALLBACK;
//------------------------------------------------------------------
// STOREOPERATION
//------------------------------------------------------------------
typedef enum tagSTOREOPERATIONTYPE
{
SOT_INVALID,
SOT_CONNECTION_STATUS, // Connect and logon to server. pszStatus = Server Name, dwCurrent = IXPSTATUS
SOT_SYNC_FOLDER, // Synchronizing fldr (new hdr DL/cached hdr upld). pszStatus = Folder Name
SOT_GET_MESSAGE, // Downloading message body into folder. pszStatus = NULL
SOT_PUT_MESSAGE, // Uploading message body into folder. pszStatus = dest Folder Name
SOT_COPYMOVE_MESSAGE, // Copying/moving msg. pszStatus = dest Folder Name
SOT_SYNCING_STORE, // Synchronizing folder list. pszStatus = Account Name, OnProgress is STEPPED (dwCurrent = 1, dwMax = 0)
SOT_CREATE_FOLDER, // Creating folder. pszStatus = New Folder Name
SOT_SEARCHING, // Searching the Store: pszStatus equals current folder name
SOT_DELETING_MESSAGES, // Deleting messages. pszStatus = NULL
SOT_SET_MESSAGEFLAGS, // Setting message flags pszStatus = NULL
SOT_MOVE_FOLDER,
SOT_DELETE_FOLDER,
SOT_RENAME_FOLDER,
SOT_SUBSCRIBE_FOLDER,
SOT_UPDATE_FOLDER,
SOT_SYNCING_DESCRIPTIONS,
SOT_GET_NEW_GROUPS,
SOT_NEW_MAIL_NOTIFICATION, // Notification of new mail arrival (returned via OnProgress only) pszStatus = NULL
SOT_PURGING_MESSAGES, // Purging messages (IMAP only at this point). pszStatus = NULL
SOT_GET_WATCH_INFO, // Searching for messages in watched threads
SOT_SORTING, // Sorting the folder pszStatus=NULL.
SOT_GET_ADURL, // Get the Ad URL from Hotmail
SOT_GET_HTTP_MINPOLLINGINTERVAL // Get the maximum polling interval
} STOREOPERATIONTYPE;
//------------------------------------------------------------------
// STOREERROR
//------------------------------------------------------------------
typedef struct tagSTOREERROR
{
HRESULT hrResult; // Error code (same val as hrComplete in OnComplete)
UINT uiServerError; // Server generated error number
HRESULT hrServerError; // Associated HRESULT of server error
DWORD dwSocketError; // Socket error as defined in winsock.h
LPSTR pszProblem; // Description of the problem
LPSTR pszDetails; // Last server response/detailed problem info
LPSTR pszAccount; // Friendly name for this account
LPSTR pszServer; // Name of the server we tried to connect to
LPSTR pszFolder; // Name of the folder/group
LPSTR pszUserName; // Plaintext name user tried to log in with
LPSTR pszProtocol; // Protocol in use
LPSTR pszConnectoid; // RAS connection name
RASCONNTYPE rasconntype; // RAS connection type
IXPTYPE ixpType; // Protocol in use (machine-identifiable)
DWORD dwPort; // Port number we tried to connect with
BOOL fSSL; // Is this an SSL secure connection?
BOOL fTrySicily; // Try using sicily authentication
DWORD dwFlags; // Various additional information
} STOREERROR, *LPSTOREERROR;
//------------------------------------------------------------------
// Constants
//------------------------------------------------------------------
cpp_quote("#define NOSTORECALLBACK NULL")
const DWORD SE_FLAG_FLUSHALL = 0x00000001; // Flush all pending operations: IMessageServer has disconnected
const DWORD CC_FLAG_DONTPROMPT = 0x00000001; // Do not prompt user during call to CanConnect
//------------------------------------------------------------------
// STOREOPERATIONINFO
//------------------------------------------------------------------
typedef struct tagSTOREOPERATIONINFO
{
DWORD cbSize;
MESSAGEID idMessage;
LPSTR pszUrl;
DWORD dwMinPollingInterval;
} STOREOPERATIONINFO, *LPSTOREOPERATIONINFO;
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
HRESULT OnBegin(
[in] STOREOPERATIONTYPE tyOperation,
[in] LPSTOREOPERATIONINFO pOpInfo,
[in] IOperationCancel *pCancel);
HRESULT OnProgress(
[in] STOREOPERATIONTYPE tyOperation,
[in] DWORD dwCurrent,
[in] DWORD dwMax,
[in] LPCSTR pszStatus);
HRESULT OnTimeout(
[in] LPINETSERVER pServer,
[in,out] LPDWORD pdwTimeout,
[in] IXPTYPE ixpServerType);
HRESULT CanConnect(
[in] LPCSTR pszAccountId,
[in] DWORD dwFlags);
HRESULT OnLogonPrompt(
[in,out] LPINETSERVER pServer,
[in] IXPTYPE ixpServerType);
HRESULT OnComplete(
[in] STOREOPERATIONTYPE tyOperation,
[in] HRESULT hrComplete,
[in] LPSTOREOPERATIONINFO pOpInfo,
[in] LPSTOREERROR pErrorInfo);
HRESULT OnPrompt(
[in] HRESULT hrError,
[in] LPCTSTR pszText,
[in] LPCTSTR pszCaption,
[in] UINT uType,
[out] INT *piUserResponse);
HRESULT GetParentWindow(
[in] DWORD dwReserved,
[out] HWND *phwndParent);
}
cpp_quote("#endif // __LPSTORECALLBACK_DEFINED")
//----------------------------------------------------------------------
// IMessageServer
//----------------------------------------------------------------------
cpp_quote("#ifndef __LPMESSAGESERVER_DEFINED")
cpp_quote("#define __LPMESSAGESERVER_DEFINED")
[
object,
uuid(86847A47-EDAF-11d1-9A54-00C04FA309D4),
pointer_default(unique)
]
interface IMessageServer : IUnknown
{
//------------------------------------------------------------------
// Pointer to an interface of this type
//------------------------------------------------------------------
typedef IMessageServer *LPMESSAGESERVER;
//------------------------------------------------------------------
// CLOSEFLAGS
//------------------------------------------------------------------
cpp_quote("#define MSGSVRF_DROP_CONNECTION 0x00000001")
cpp_quote("#define MSGSVRF_HANDS_OFF_SERVER 0x00000002")
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
HRESULT Initialize(
[in] IMessageStore *pStore,
[in] FOLDERID idStoreRoot,
[in] IMessageFolder *pFolder,
[in] FOLDERID idFolder);
HRESULT ResetFolder(
[in] IMessageFolder *pFolder,
[in] FOLDERID idFolder);
HRESULT Close(
[in] DWORD dwFlags);
HRESULT SetIdleCallback(
[in] IStoreCallback *pDefaultCallback);
HRESULT SynchronizeFolder(
[in] SYNCFOLDERFLAGS dwFlags,
[in] DWORD cHeaders,
[in] IStoreCallback *pCallback);
HRESULT GetMessage(
[in] MESSAGEID idMessage,
[in] IStoreCallback *pCallback);
HRESULT PutMessage(
[in] FOLDERID idFolder,
[in] MESSAGEFLAGS dwFlags,
[in] LPFILETIME pftReceived,
[in] IStream *pStream,
[in] IStoreCallback *pCallback);
HRESULT CopyMessages(
[in] IMessageFolder *pDest,
[in] COPYMESSAGEFLAGS dwOptions,
[in] LPMESSAGEIDLIST pList,
[in] LPADJUSTFLAGS pFlags,
[in] IStoreCallback *pCallback);
HRESULT DeleteMessages(
[in] DELETEMESSAGEFLAGS dwOptions,
[in] LPMESSAGEIDLIST pList,
[in] IStoreCallback *pCallback);
HRESULT SetMessageFlags(
[in] LPMESSAGEIDLIST pList,
[in] LPADJUSTFLAGS pFlags,
[in] SETMESSAGEFLAGSFLAGS dwFlags,
[in] IStoreCallback *pCallback);
HRESULT GetServerMessageFlags(
[in,out] MESSAGEFLAGS *pFlags);
HRESULT SynchronizeStore(
[in] FOLDERID idParent,
[in] SYNCSTOREFLAGS dwFlags,
[in] IStoreCallback *pCallback);
HRESULT CreateFolder(
[in] FOLDERID idParent,
[in] SPECIALFOLDER tySpecial,
[in] LPCSTR pszName,
[in] FLDRFLAGS dwFlags,
[in] IStoreCallback *pCallback);
HRESULT MoveFolder(
[in] FOLDERID idFolder,
[in] FOLDERID idParentNew,
[in] IStoreCallback *pCallback);
HRESULT RenameFolder(
[in] FOLDERID idFolder,
[in] LPCSTR pszName,
[in] IStoreCallback *pCallback);
HRESULT DeleteFolder(
[in] FOLDERID idFolder,
[in] DELETEFOLDERFLAGS dwFlags,
[in] IStoreCallback *pCallback);
HRESULT SubscribeToFolder(
[in] FOLDERID idFolder,
[in] BOOL fSubscribe,
[in] IStoreCallback *pCallback);
HRESULT GetFolderCounts(
[in] FOLDERID idFolder,
[in] IStoreCallback *pCallback);
HRESULT GetNewGroups(
[in] LPSYSTEMTIME pSysTime,
[in] IStoreCallback *pCallback);
HRESULT ConnectionAddRef();
HRESULT ConnectionRelease();
HRESULT GetWatchedInfo(
[in] FOLDERID idFolder,
[in] IStoreCallback *pCallback);
HRESULT GetAdBarUrl(
[in] IStoreCallback *pCallback);
HRESULT GetMinPollingInterval(
[in] IStoreCallback *pCallback);
}
cpp_quote("#endif // __LPMESSAGESERVER_DEFINED")
//----------------------------------------------------------------------
// IIMAPStore
//----------------------------------------------------------------------
cpp_quote("#ifndef __LPIMAPSTORE_DEFINED")
cpp_quote("#define __LPIMAPSTORE_DEFINED")
[
object,
uuid(06AE7A01-6C5B-11d2-AD88-0080C7B6E3C5),
pointer_default(unique)
]
interface IIMAPStore : IUnknown
{
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
HRESULT ExpungeOnExit(void);
}
cpp_quote("#endif // __LPIMAPSTORE_DEFINED")
//----------------------------------------------------------------------
// INewsStore
//----------------------------------------------------------------------
cpp_quote("#ifndef __LPNEWSSTORE_DEFINED")
cpp_quote("#define __LPNEWSSTORE_DEFINED")
[
object,
uuid(522E4F81-2C98-11d2-AACA-006097D474C4),
pointer_default(unique)
]
interface INewsStore : IUnknown
{
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
HRESULT MarkCrossposts(
[in] LPMESSAGEIDLIST pList,
[in] BOOL fRead);
}
cpp_quote("#endif // __LPNEWSSTORE_DEFINED")
//----------------------------------------------------------------------
// IPop3UidlStore
//----------------------------------------------------------------------
cpp_quote("#ifndef __LPPOP3UIDLStore_DEFINED")
cpp_quote("#define __LPMESSAGEFOLDER_DEFINED")
[
object,
uuid(E883FC77-EC08-11d1-9A53-00C04FA309D4),
pointer_default(unique)
]
interface IPop3UidlStore : IUnknown
{
//------------------------------------------------------------------
// Pointer to an interface of this type
//------------------------------------------------------------------
typedef IPop3UidlStore *LPPOP3UIDLSTORE;
//------------------------------------------------------------------
// POP3UIDL Database Version
//------------------------------------------------------------------
const DWORD POP3UIDL_DATABASE_VERSION = 5;
//------------------------------------------------------------------
// UIDL Store Record Ordinals
//------------------------------------------------------------------
typedef enum tagUIDLCOLID {
UIDLCOL_DLTIME,
UIDLCOL_DELETED,
UIDLCOL_DOWNLOADED,
UIDLCOL_UIDL,
UIDLCOL_SERVER,
UIDLCOL_ACCOUNTID,
UIDLCOL_LAST
} UIDLCOLID;
//------------------------------------------------------------------
// UIDLRECORD
//------------------------------------------------------------------
typedef struct tagUIDLRECORD {
BYTE *pAllocated;
BYTE bVersion;
BYTE fDownloaded;
BYTE fDeleted;
FILETIME ftDownload;
LPSTR pszUidl;
LPSTR pszServer;
LPSTR pszAccountId;
} UIDLRECORD, *LPUIDLRECORD;
//------------------------------------------------------------------
// UIDL Record Members
//------------------------------------------------------------------
cpp_quote("BEGIN_COLUMN_ARRAY(g_rgUidlTblColumns, UIDLCOL_LAST)")
cpp_quote(" DEFINE_COLUMN(UIDLCOL_DLTIME, CDT_FILETIME, UIDLRECORD, ftDownload)")
cpp_quote(" DEFINE_COLUMN(UIDLCOL_DELETED, CDT_BYTE, UIDLRECORD, fDeleted)")
cpp_quote(" DEFINE_COLUMN(UIDLCOL_DOWNLOADED, CDT_BYTE, UIDLRECORD, fDownloaded)")
cpp_quote(" DEFINE_COLUMN(UIDLCOL_UIDL, CDT_VARSTRA, UIDLRECORD, pszUidl)")
cpp_quote(" DEFINE_COLUMN(UIDLCOL_SERVER, CDT_VARSTRA, UIDLRECORD, pszServer)")
cpp_quote(" DEFINE_COLUMN(UIDLCOL_ACCOUNTID, CDT_VARSTRA, UIDLRECORD, pszAccountId)")
cpp_quote("END_COLUMN_ARRAY")
//------------------------------------------------------------------
// UIDL Table Primary Index Definition
//------------------------------------------------------------------
cpp_quote("BEGIN_TABLE_INDEX(g_UidlTblPrimaryIndex, 3)")
cpp_quote(" DEFINE_KEY(UIDLCOL_UIDL, COMPARE_ASANSI, 0)")
cpp_quote(" DEFINE_KEY(UIDLCOL_SERVER, COMPARE_ASANSI | COMPARE_IGNORECASE, 0)")
cpp_quote(" DEFINE_KEY(UIDLCOL_ACCOUNTID,COMPARE_ASANSI | COMPARE_IGNORECASE, 0)")
cpp_quote("END_TABLE_INDEX")
//------------------------------------------------------------------
// UIDL Record Format
//------------------------------------------------------------------
cpp_quote("BEGIN_TABLE_SCHEMA(g_UidlTableSchema, CLSID_Pop3UidlDatabase, UIDLRECORD)")
cpp_quote(" SCHEMA_PROPERTY(POP3UIDL_DATABASE_VERSION)")
cpp_quote(" SCHEMA_PROPERTY(TSF_RESETIFBADVERSION)")
cpp_quote(" SCHEMA_PROPERTY(0)")
cpp_quote(" SCHEMA_PROPERTY(0xffffffff)")
cpp_quote(" SCHEMA_PROPERTY(UIDLCOL_LAST)")
cpp_quote(" SCHEMA_PROPERTY(g_rgUidlTblColumns)")
cpp_quote(" SCHEMA_PROPERTY(&g_UidlTblPrimaryIndex)")
cpp_quote(" SCHEMA_PROPERTY(NULL)")
cpp_quote("END_TABLE_SCHEMA")
//------------------------------------------------------------------
// Extern'ed Record Formats
//------------------------------------------------------------------
cpp_quote("extern const TABLESCHEMA g_UidlTableSchema;")
}
cpp_quote("#endif // __LPPOP3UIDLSTORE_DEFINED")
//----------------------------------------------------------------------
// IMessageTable
//----------------------------------------------------------------------
cpp_quote("#ifndef __LPMESSAGETABLE_DEFINED")
cpp_quote("#define __LPMESSAGETABLE_DEFINED")
[
object,
uuid(B4B796AA-EC1C-11d1-9A54-00C04FA309D4),
pointer_default(unique)
]
interface IMessageTable : IUnknown
{
//------------------------------------------------------------------
// Pointer to an interface of this type
//------------------------------------------------------------------
typedef IMessageTable *LPMESSAGETABLE;
//----------------------------------------------------------------------
// Types
//----------------------------------------------------------------------
typedef DWORD ROWINDEX;
typedef DWORD *LPROWINDEX;
//----------------------------------------------------------------------
// GETCOUNTTYPE
//----------------------------------------------------------------------
typedef enum tagGETCOUNTTYPE {
MESSAGE_COUNT_VISIBLE,
MESSAGE_COUNT_ALL,
MESSAGE_COUNT_FILTERED,
MESSAGE_COUNT_UNREAD,
MESSAGE_COUNT_NOTDOWNLOADED
} GETCOUNTTYPE;
//----------------------------------------------------------------------
// RELATIVEROWTYPE
//----------------------------------------------------------------------
typedef enum tagRELATIVEROWTYPE {
RELATIVE_ROW_PARENT,
RELATIVE_ROW_CHILD,
RELATIVE_ROW_ROOT
} RELATIVEROWTYPE;
//----------------------------------------------------------------------
// GETNEXTTYPE
//----------------------------------------------------------------------
typedef enum tagGETNEXTTYPE {
GETNEXT_NEXT,
GETNEXT_PREVIOUS
} GETNEXTTYPE;
//----------------------------------------------------------------------
// ROWMESSAGETYPE
//----------------------------------------------------------------------
typedef enum tagROWMESSAGETYPE {
ROWMSG_ALL,
ROWMSG_NEWS,
ROWMSG_MAIL
} ROWMESSAGETYPE;
//------------------------------------------------------------------
// MARK_TYPE
//------------------------------------------------------------------
typedef enum tagMARK_TYPE {
MARK_MESSAGE_READ = 0,
MARK_MESSAGE_UNREAD,
MARK_MESSAGE_DELETED,
MARK_MESSAGE_UNDELETED,
MARK_MESSAGE_DOWNLOAD,
MARK_MESSAGE_UNDOWNLOAD,
MARK_MESSAGE_FLAGGED,
MARK_MESSAGE_UNFLAGGED,
MARK_MESSAGE_FORWARDED,
MARK_MESSAGE_UNFORWARDED,
MARK_MESSAGE_REPLIED,
MARK_MESSAGE_UNREPLIED,
MARK_MESSAGE_SECUI,
MARK_MESSAGE_NOSECUI,
MARK_MESSAGE_WATCH,
MARK_MESSAGE_IGNORE,
MARK_MESSAGE_NORMALTHREAD,
MARK_MESSAGE_RCPT_PROCESSED,
MARK_MAX
} MARK_TYPE;
//----------------------------------------------------------------------
// APPLYCHILDRENTYPE
//----------------------------------------------------------------------
typedef enum tagAPPLYCHILDRENTYPE {
APPLY_SPECIFIED, // apply only to the set of row index specified (won't recurse into children)
APPLY_CHILDREN, // apply to all specified rows and all the children of the specified rows
APPLY_COLLAPSED // apply to all specified rows and the children of any collapsed threads
} APPLYCHILDRENTYPE;
//----------------------------------------------------------------------
// GETNEXTFLAGS
//----------------------------------------------------------------------
typedef DWORD GETNEXTFLAGS;
cpp_quote("#define GETNEXT_UNREAD 0x00000001")
cpp_quote("#define GETNEXT_THREAD 0x00000002")
//----------------------------------------------------------------------
// ROWSTATE
//----------------------------------------------------------------------
typedef DWORD ROWSTATE;
cpp_quote("#define ROW_STATE_READ 0x00000001")
cpp_quote("#define ROW_STATE_DELETED 0x00000002")
cpp_quote("#define ROW_STATE_HAS_CHILDREN 0x00000004")
cpp_quote("#define ROW_STATE_EXPANDED 0x00000008")
cpp_quote("#define ROW_STATE_HAS_BODY 0x00000010")
cpp_quote("#define ROW_STATE_MARKED_DOWNLOAD 0x00000020")
cpp_quote("#define ROW_STATE_FLAGGED 0x00000040")
cpp_quote("#define ROW_STATE_WATCHED 0x00000080")
cpp_quote("#define ROW_STATE_IGNORED 0x00000100")
cpp_quote("#define ROW_STATE_VALID 0x00000200")
//----------------------------------------------------------------------
// SELECTIONSTATE
//----------------------------------------------------------------------
typedef DWORD SELECTIONSTATE;
cpp_quote("#define SELECTION_STATE_DELETABLE 0x00000200")
//----------------------------------------------------------------------
// FINDINFO Masks
//----------------------------------------------------------------------
cpp_quote("#define FIM_FROM 0x00000001")
cpp_quote("#define FIM_SUBJECT 0x00000002")
cpp_quote("#define FIM_TO 0x00000004")
cpp_quote("#define FIM_DATEFROM 0x00000008")
cpp_quote("#define FIM_DATETO 0x00000010")
cpp_quote("#define FIM_BODYTEXT 0x00000020")
cpp_quote("#define FIM_ATTACHMENT 0x00000040")
cpp_quote("#define FIM_FLAGGED 0x00000080")
cpp_quote("#define FIM_FORWARDED 0x00000100")
cpp_quote("#define FIM_REPLIED 0x00000200")
//----------------------------------------------------------------------
// FINDINFO
//----------------------------------------------------------------------
typedef struct tagFINDINFO {
DWORD cbSize;
ULONG mask;
LPSTR pszFrom;
LPSTR pszTo;
LPSTR pszSubject;
LPSTR pszBody;
FILETIME ftDateFrom;
FILETIME ftDateTo;
BOOL fSubFolders;
} FINDINFO, *LPFINDINFO;
//----------------------------------------------------------------------
// FINDNEXTFLAGS
//----------------------------------------------------------------------
typedef enum tagFINDNEXTFLAGS {
FINDNEXT_TYPEAHEAD = 0,
FINDNEXT_ALLCOLUMNS,
FINDNEXT_MAX
} FINDNEXTFLAGS;
//----------------------------------------------------------------------
// IMessageTable Methods
//----------------------------------------------------------------------
HRESULT Initialize(
[in] FOLDERID idFolder,
[in] IMessageServer *pServer,
[in] BOOL fFind,
[in] IStoreCallback *pCallback);
HRESULT StartFind(
[in] LPFINDINFO pCriteria,
[in] IStoreCallback *pCallback);
HRESULT SetOwner(
[in] IStoreCallback *pDefaultCallback);
HRESULT Close();
HRESULT Synchronize(
[in] SYNCFOLDERFLAGS dwFlags,
[in] DWORD cHeaders,
[in] IStoreCallback *pCallback);
HRESULT GetCount(
[in] GETCOUNTTYPE tyCount,
[out] DWORD *pdwCount);
HRESULT GetRow(
[in] ROWINDEX iRow,
[out] LPMESSAGEINFO *ppInfo);
HRESULT ReleaseRow(
[in,out] LPMESSAGEINFO pInfo);
HRESULT GetIndentLevel(
[in] ROWINDEX iRow,
[out] LPDWORD pcIndent);
HRESULT Mark(
[in] LPROWINDEX rgiRow,
[in] DWORD cRows,
[in] APPLYCHILDRENTYPE tyApply,
[in] MARK_TYPE mark,
[in] IStoreCallback *pCallback);
HRESULT GetSortInfo(
[out] LPFOLDERSORTINFO pSortInfo);
HRESULT OnSynchronizeComplete(void);
HRESULT SetSortInfo(
[in] LPFOLDERSORTINFO pSortInfo,
[in] IStoreCallback *pCallback);
HRESULT GetLanguage(
[in] ROWINDEX iRow,
[out] LPDWORD pdwCodePage);
HRESULT SetLanguage(
[in] DWORD cRows,
[in] LPROWINDEX prgiRow,
[in] DWORD dwCodePage);
HRESULT GetNextRow(
[in] ROWINDEX iCurrentRow,
[in] GETNEXTTYPE tyDirection,
[in] ROWMESSAGETYPE tyMessage,
[in] GETNEXTFLAGS dwFlags,
[out] LPROWINDEX piNewRow);
HRESULT GetRelativeRow(
[in] ROWINDEX iRow,
[in] RELATIVEROWTYPE tyRelative,
[out] LPROWINDEX piRelative);
HRESULT GetRowState(
[in] ROWINDEX iRow,
[in] ROWSTATE dwStateMask,
[out] ROWSTATE *pdwState);
HRESULT GetSelectionState(
[in] DWORD cRows,
[in] LPROWINDEX prgiRow,
[in] SELECTIONSTATE dwMask,
[in] BOOL fIncludeChildren,
[out] SELECTIONSTATE *pdwState);
HRESULT Expand(
[in] ROWINDEX iRow);
HRESULT Collapse(
[in] ROWINDEX iRow);
HRESULT OpenMessage(
[in] ROWINDEX iRow,
[in] OPENMESSAGEFLAGS dwFlags,
[in] IMimeMessage **ppMessage,
[in] IStoreCallback *pCallback);
HRESULT GetRowMessageId(
[in] ROWINDEX iRow,
[out] LPMESSAGEID pidMessage);
HRESULT GetRowIndex(
[in] MESSAGEID idMessage,
[out] LPROWINDEX piRow);
HRESULT DeleteRows(
[in] DELETEMESSAGEFLAGS dwFlags,
[in] DWORD cRows,
[in] LPROWINDEX prgiRow,
[in] BOOL fIncludeChildren,
[in] IStoreCallback *pCallback);
HRESULT CopyRows(
[in] FOLDERID idFolder,
[in] COPYMESSAGEFLAGS dwOptions,
[in] DWORD cRows,
[in] LPROWINDEX prgiRow,
[in] LPADJUSTFLAGS pFlags,
[in] IStoreCallback *pCallback);
HRESULT RegisterNotify(
[in] REGISTERNOTIFYFLAGS dwFlags,
[in] IMessageTableNotify *pNotify);
HRESULT UnregisterNotify(
[in] IMessageTableNotify *pNotify);
HRESULT FindNextRow(
[in] ROWINDEX iStartRow,
[in] LPCTSTR pszFindString,
[in] FINDNEXTFLAGS dwFlags,
[in] BOOL fIncludeBody,
[out] ROWINDEX *piNextRow,
[out] BOOL *pfWrapped);
HRESULT GetRowFolderId(
[in] ROWINDEX iRow,
[out] LPFOLDERID pidFolder);
HRESULT GetMessageIdList(
[in] BOOL fRootsOnly,
[in] DWORD cRows,
[in] LPROWINDEX prgiRow,
[out] LPMESSAGEIDLIST pIdList);
HRESULT ConnectionAddRef(void);
HRESULT ConnectionRelease(void);
HRESULT IsChild(
[in] ROWINDEX iRowParent,
[in] ROWINDEX iRowChild);
HRESULT GetAdBarUrl(IStoreCallback *pCallback);
};
cpp_quote("#endif // __LPMESSAGETABLE_DEFINED")
//----------------------------------------------------------------------
// IMessageTableNotify
//----------------------------------------------------------------------
cpp_quote("#ifndef __LPMESSAGETABLENOTIFY_DEFINED")
cpp_quote("#define __LPMESSAGETABLENOTIFY_DEFINED")
[
object,
uuid(816C1167-F649-11d1-9A57-00C04FA309D4),
pointer_default(unique)
]
interface IMessageTableNotify : IUnknown
{
//------------------------------------------------------------------
// Pointer to an interface of this type
//------------------------------------------------------------------
typedef IMessageTableNotify *LPMESSAGETABLENOTIFY;
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
HRESULT OnInsertRows(
[in] DWORD cRows,
[in] LPROWINDEX prgiRow,
[in] BOOL fExpanded);
HRESULT OnDeleteRows(
[in] DWORD cRows,
[in] LPROWINDEX prgiRow,
[in] BOOL fCollapsed);
HRESULT OnUpdateRows(
[in] ROWINDEX iRowMin,
[in] ROWINDEX iRowMax);
HRESULT OnRedrawState(
[in] BOOL fRedraw);
HRESULT OnResetView(void);
}
cpp_quote("#endif // __LPMESSAGETABLENOTIFY_DEFINED")
//----------------------------------------------------------------------
// IStoreNamespace - Used by Outlook 9 and MS-Phone
//----------------------------------------------------------------------
cpp_quote("#ifdef OE5_BETA2")
cpp_quote("#ifndef __LPSTORENAMESPACE_DEFINED")
cpp_quote("#define __LPSTORENAMESPACE_DEFINED")
[
object,
uuid(E70C92AA-4BFD-11d1-8A95-00C04FB951F3),
pointer_default(unique)
]
interface IStoreNamespace : IUnknown
{
//----------------------------------------------------------------------
// Pointer to an Object of this type
//----------------------------------------------------------------------
typedef IStoreNamespace *LPSTORENAMESPACE;
//----------------------------------------------------------------------
// Some Special MESSAGEID values
//----------------------------------------------------------------------
const MESSAGEID MESSAGEID_FIRST = -1;
//----------------------------------------------------------------------
// HENUMSTORE
//--------------------------------------------------------------------------
DECLARE_HANDLE(HENUMSTORE);
typedef HENUMSTORE *LPHENUMSTORE;
//----------------------------------------------------------------------
// Notification Messages
//----------------------------------------------------------------------
cpp_quote("#define WM_FOLDERNOTIFY (WM_USER + 1600) // IStoreNamespace Notification - lparam=LPFOLDERNOTIFYEX, client must call CoTaskMemFree(lParam)")
cpp_quote("#define WM_NEWMSGS (WM_USER + 1650) // IStoreFolder Notification: wParam=MESSAGEID, lParam=Reserved (No need to free anything)")
cpp_quote("#define WM_DELETEMSGS (WM_USER + 1651) // IStoreFolder Notification: wParam=prgdwMsgId, lParam=cMsgs (You must CoTaskMemFree(prgdwMsgId)")
cpp_quote("#define WM_DELETEFOLDER (WM_USER + 1652) // IStoreFolder Notification: wParam=FOLDERID or HFOLDER (No need to free anything)")
// If wParam is equal to 0xffffffff then that means that all messages in the folder
// were either marked as read (WM_MARKEDASREAD) or unread (WM_MARKEDASUNREAD)
cpp_quote("#define WM_MARKEDASREAD (WM_USER + 1653) // IStoreFolder Notification: wParamprgdwMsgId, lParam=cMsgs (No need to free anything)")
cpp_quote("#define WM_MARKEDASUNREAD (WM_USER + 1654) // IStoreFolder Notification: wParamprgdwMsgId, lParam=cMsgs (No need to free anything)")
//----------------------------------------------------------------------
// FOLDERNOTIFYTYPE
//----------------------------------------------------------------------
typedef enum tagFOLDERNOTIFYTYPE {
NEW_FOLDER = 1,
DELETE_FOLDER,
RENAME_FOLDER,
MOVE_FOLDER,
UNREAD_CHANGE,
IMAPFLAG_CHANGE,
UPDATEFLAG_CHANGE,
FOLDER_PROPS_CHANGED
} FOLDERNOTIFYTYPE;
//----------------------------------------------------------------------
// FOLDERNOTIFYEX
//----------------------------------------------------------------------
typedef struct tagFOLDERNOTIFYEX {
FOLDERNOTIFYTYPE type;
FOLDERID idFolderOld; // not used for CREATEFOLDER and DELETEFOLDER
FOLDERID idFolderNew;
} FOLDERNOTIFYEX, *LPFOLDERNOTIFYEX;
//----------------------------------------------------------------------
// FOLDERPROPS - Properties of a folder
//----------------------------------------------------------------------
typedef struct tagFOLDERPROPS {
DWORD cbSize; // Size of this structure
FOLDERID dwFolderId; // Handle of this folder
INT cSubFolders; // Number of sub-folders
LONG sfType; // Special folder type
DWORD cUnread; // Number of un-read messages
DWORD cMessage; // Total # of messages
CHAR szName[256]; // The Folder Name
} FOLDERPROPS, *LPFOLDERPROPS;
//----------------------------------------------------------------------
// IMessageTable Methods
//----------------------------------------------------------------------
cpp_quote("#define NAMESPACE_INITIALIZE_CURRENTIDENTITY 0x00000001")
HRESULT Initialize( // Initialize the object
[in] HWND hwndOwner, // Window owner for things like compaction dialog
[in] DWORD dwFlags); // Reserved for future use
HRESULT GetDirectory( // Get the location of the store (filepath)
[in,out,size_is(cchMaxPath)] LPSTR pszPath, // Buffer to put path of store into
[in] DWORD cchMaxPath); // in: byte count size of pszPath, out: char count size of pszPath
HRESULT OpenSpecialFolder(
[in] LONG sfType, // Special folder type
[in] DWORD dwReserved, // Reserved for future use
[out] IStoreFolder **ppFolder); // Pointer to an IStoreFolder
HRESULT OpenFolder(
[in] FOLDERID dwFolderId, // Folder to open
[in] DWORD dwReserved, // Reserved for future use
[out] IStoreFolder **ppFolder); // Pointer to an IStoreFolder
HRESULT CreateFolder(
[in] FOLDERID dwParentId, // Parent of the new folder, can use FOLDERID_ROOT
[in] LPCSTR pszName, // Name of new folder, must be less than MAX_FOLDER_NAME
[in] DWORD dwReserved, // Reserved for future use
[out] LPFOLDERID pdwFolderId); // Handle to the new folder
HRESULT RenameFolder(
[in] FOLDERID dwFolderId, // Folder to rename
[in] DWORD dwReserved, // Reserved for future use
[in] LPCSTR pszNewName); // New folder name, must be less than MAX_FOLDER_NAME
HRESULT MoveFolder(
[in] FOLDERID dwFolderId, // Folder to move
[in] FOLDERID dwParentId, // FolderId of the new Parent
[in] DWORD dwReserved); // Reserved for future use
HRESULT DeleteFolder(
[in] FOLDERID dwFolderId, // Folder to delete
[in] DWORD dwReserved); // Reserved for future use
HRESULT GetFolderProps(
[in] FOLDERID dwFolderId, // FolderId to get info for
[in] DWORD dwReserved, // Reserved for future use
[in,out] LPFOLDERPROPS pProps); // in: set cbSize, out: Holds folder information
HRESULT CopyMoveMessages(
[in] IStoreFolder *pSource, // Source store folder
[in] IStoreFolder *pDest, // Destination Store Folder
[in] LPMESSAGEIDLIST pMsgIdList, // List of MESSAGEIDs to move/copy
[in] COPYMESSAGEFLAGS dwFlags, // CMF_xxx Flags
[in] DWORD dwFlagsRemove, // MSG_xxx Flags to remove from copied/moved messages
[in] IProgressNotify *pProgress); // Store progress callback (client implements)
HRESULT RegisterNotification(
[in] DWORD dwReserved, // Reserved for future use
[in] HWND hwnd); // Handle to window to send notifications
HRESULT UnregisterNotification(
[in] DWORD dwReserved, // Reserved for future use
[in] HWND hwnd); // Handle to window to un-register for notifications
HRESULT CompactAll( // Compacts all folders in the store
[in] DWORD dwReserved); // Reserved for future use
HRESULT GetFirstSubFolder( // Enumerate sub folders
[in] FOLDERID dwFolderId, // Pass FOLDERID_ROOT to enum root folders
[in,out] LPFOLDERPROPS pProps, // If function succeeds, contents are valid
[out] LPHENUMSTORE phEnum); // Use in call to GetNextSubFolder, and then GetSubFolderClose
HRESULT GetNextSubFolder( // Get the next subfolder, returns S_FALSE if no more folders
[in] HENUMSTORE hEnum, // Handle received from GetFirstSubFolder
[in,out] LPFOLDERPROPS pProps); // If function returns S_OK, contains folder properties
HRESULT GetSubFolderClose( // Closes the handle associated with a folder enumeration
[in] HENUMSTORE hEnum); // Handle received from GetFirstSubFolder
}
cpp_quote("#endif // __LPSTORENAMESPACE_DEFINED")
cpp_quote("#endif // OE5_BETA2")
//----------------------------------------------------------------------
// IStoreFolder - Used by Outlook 9 and MS-Phone
//----------------------------------------------------------------------
cpp_quote("#ifdef OE5_BETA2")
cpp_quote("#ifndef __LPSTOREFOLDER_DEFINED")
cpp_quote("#define __LPSTOREFOLDER_DEFINED")
[
object,
uuid(E70C92AC-4BFD-11d1-8A95-00C04FB951F3),
pointer_default(unique)
]
interface IStoreFolder : IUnknown
{
//----------------------------------------------------------------------
// Pointer to an Object of this type
//----------------------------------------------------------------------
typedef IStoreFolder *LPSTOREFOLDER;
//----------------------------------------------------------------------
// Message State Flags used in MESSAGEINFO::dwState
//----------------------------------------------------------------------
cpp_quote("#define MSG_DELETED 0x0001 // The message has been deleted, compaction will remove it")
cpp_quote("#define MSG_UNREAD 0x0002 // The message is marked as un-read")
cpp_quote("#define MSG_SUBMITTED 0x0004 // For messages waiting to be sent: OUTBOX ONLY")
cpp_quote("#define MSG_UNSENT 0x0008 // For msgs-in-progress saved to a folder")
cpp_quote("#define MSG_RECEIVED 0x0010 // For messages that came from a server")
cpp_quote("#define MSG_NEWSMSG 0x0020 // For news messages")
cpp_quote("#define MSG_NOSECUI 0x0040 // For messages where the user wants to die")
cpp_quote("#define MSG_VOICEMAIL 0x0080 // The message has the X-Voicemail header set...")
cpp_quote("#define MSG_REPLIED 0x0100 // The message has been replied to")
cpp_quote("#define MSG_FORWARDED 0x0200 // The message has been forwarded to")
cpp_quote("#define MSG_RCPTSENT 0x0400 // S/MIME Receipt has been sent")
cpp_quote("#define MSG_FLAGGED 0x0800 // The message is currently flags")
cpp_quote("#define MSG_LAST 0x0200 // ** Keep this puppy updated!! **")
cpp_quote("#define MSG_EXTERNAL_FLAGS 0x00fe")
cpp_quote("#define MSG_FLAGS 0x000f")
//----------------------------------------------------------------------
// MESSAGEPROPS
//----------------------------------------------------------------------
typedef struct tagMESSAGEPROPS {
DWORD cbSize; // Size of this structure
DWORD_PTR dwReserved; // Reserved don't use
MESSAGEID dwMessageId; // Handle to this message
DWORD dwLanguage; // Codepage of this message
DWORD dwState; // MSG_xxx Flags
// Things you don't get when MSGPROPS_FAST
DWORD cbMessage; // Size of the message
IMSGPRIORITY priority; // Message Priority
FILETIME ftReceived; // When the message was received
FILETIME ftSent; // When the message was sent
LPSTR pszSubject; // The subject of the message
LPSTR pszDisplayTo; // The display to line of the message
LPSTR pszDisplayFrom; // The display from line of the message
LPSTR pszNormalSubject; // The normalized subject of the message
DWORD dwFlags; // IMF_xxx Flags defined in mimeole.idl
IStream *pStmOffsetTable; // Use with IMimeMessage::LoadOffsetTable
} MESSAGEPROPS, *LPMESSAGEPROPS;
//----------------------------------------------------------------------
// HBATCHLOCK
//----------------------------------------------------------------------
DECLARE_HANDLE(HBATCHLOCK);
typedef HBATCHLOCK *LPHBATCHLOCK;
//----------------------------------------------------------------------
// Method
//----------------------------------------------------------------------
HRESULT GetFolderProps( // Get folder info for this folder
[in] DWORD dwReserved, // Reserved for future use
[in,out] LPFOLDERPROPS pProps); // in: set cbSize, out: contains folder information
cpp_quote("#define MSGPROPS_FAST 0x00000001 // See MESSAGEPROPS structure, improved performance")
HRESULT GetMessageProps(
[in] MESSAGEID dwMessageId, // Message Identifier
[in] DWORD dwFlags, // GETMSGINFO_xxx Flags
[in,out] LPMESSAGEPROPS pProps); // Message Info - set cbSize before calling
HRESULT FreeMessageProps( // Handles the case where pMsgInfo->dwMask has MIP_BYREF
[in,out] LPMESSAGEPROPS pProps); // Pointer to MESSAGEINFO structure to free
HRESULT DeleteMessages(
[in] LPMESSAGEIDLIST pMsgIdList, // List of HMESSAGEs
[in] DWORD dwReserved, // Reserved for future use
[in] IProgressNotify *pProgress); // Progress information
HRESULT SetLanguage(
[in] DWORD dwLanguage, // MLANG Codepage ID of message
[in] DWORD dwReserved, // Reserved for future use
[in] LPMESSAGEIDLIST pMsgIdList); // List of HMESSAGEs to apply new language to
HRESULT MarkMessagesAsRead(
[in] BOOL fRead, // Mark as Read or Unread
[in] DWORD dwReserved, // Reserved for future use
[in] LPMESSAGEIDLIST pMsgIdList); // List of HMESSAGEs to mark as (un)read
HRESULT SetFlags( // Modify the flags of a message
[in] LPMESSAGEIDLIST pMsgIdList, // Array of messages to modify flags for
[in] DWORD dwState, // MSG_xxx Flags to set on pMsgIdList
[in] DWORD dwStatemask, // ?????
[out] LPDWORD prgdwNewFlags); // Array of new message state flags that match pMsgIdList array
HRESULT OpenMessage( // Open a message (get a stream or a message object)
[in] MESSAGEID dwMessageId, // Handle to the message to open
[in] REFIID riid, // IID_IStream or IID_IMimeMessage stream is readonly
[out,iid_is(riid)] LPVOID *ppvObject); // The object, you must ->Release it
HRESULT SaveMessage( // Add a new entry to a folder.
[in] REFIID riid, // IID_IStream or IID_IMimeMessage
[in,iid_is(riid)] LPVOID pvObject, // Pointer to a stream or mime message
[in] DWORD dwMsgFlags, // MSG_xxx Flags
[out] LPMESSAGEID pdwMessageId); // Handle to the new message
HRESULT BatchLock( // Lock to prepare for a batch operation
[in] DWORD dwReserved, // Reserved for future use
[out] LPHBATCHLOCK phBatchLock); // Handle to newly created lock
HRESULT BatchFlush( // Flush the current batch operation
[in] DWORD dwReserved, // Reserved for future use
[in] HBATCHLOCK hBatchLock); // Folder lock obtained from BatchLock
HRESULT BatchUnlock( // Unlocks a batched operation
[in] DWORD dwReserved, // Reserved for future use
[in] HBATCHLOCK hBatchLock); // Handle to lock obtained from BatchLock
HRESULT CreateStream( // Create a new stream in a folder
[in] HBATCHLOCK hBatchLock, // Handle to a folder lock, optional if doing a one-of
[in] DWORD dwReserved, // Reserved for future use
[out] IStream **ppStream, // Pointer to new stream can be used for read/write
[out] LPMESSAGEID pdwMessageId); // Handle to the new message
cpp_quote("#define COMMITSTREAM_REVERT 0x00000001 // Don't add this stream/message to the folder")
HRESULT CommitStream( // Commit/Revert a stream created with CreateStream
[in] HBATCHLOCK hBatchLock, // Folder lock obtained from BatchLock
[in] DWORD dwFlags, // COMMITSTREAM_xxx Flags
[in] DWORD dwMsgFlags, // MSG_xxx Flags
[in] IStream *pStream, // Stream obtained from CreateStream
[in] MESSAGEID dwMessageId, // dwMessageId obtained from CreateStream
[in] IMimeMessage *pMessage); // Message to commit, if not passed in, pStream will be pared.
HRESULT RegisterNotification(
[in] DWORD dwReserved, // Reserved for future use
[in] HWND hwnd); // Handle to window to send notifications
HRESULT UnregisterNotification(
[in] DWORD dwReserved, // Reserved for future use
[in] HWND hwnd); // Handle to window to un-register for notifications
HRESULT Compact( // Compacts this folder
[in] DWORD dwReserved); // Reserved for future use
HRESULT GetFirstMessage( // Get the first message in a folder
[in] DWORD dwFlags, // MSGPROPS_xxx Flags
[in] DWORD dwMsgFlags, // MSG_xxx Flags to enumerate on, pass 0 for none
[in] MESSAGEID dwMsgIdFirst, // MessageId to start enumerating at, Use MESSAGEID_FIRST
[in,out] LPMESSAGEPROPS pProps, // When function returns S_OK, contains message properties
[out] LPHENUMSTORE phEnum); // Upon successful return, contains handle to enumeration
HRESULT GetNextMessage( // Get the next message in the enumeration
[in] HENUMSTORE hEnum, // Handle to the enumeration received in GetFirstMessage
[in] DWORD dwFlags, // MSGPROPS_xxx Flags
[in,out] LPMESSAGEPROPS pProps); // When function returns S_OK, contains message properties
HRESULT GetMessageClose(
[in] HENUMSTORE hEnum); // Handle to the enumeration received in GetFirstMessage
}
cpp_quote("#endif // __LPSTOREFOLDER_DEFINED")
cpp_quote("#endif // OE5_BETA2")
} // OEStore Library Object Definition