//
//  Beta release only.
//
//  Copyright(c) Ivyware Pty Ltd 2013  (all rights reserved)
//               MELBOURNE, VICTORIA, AUSTRALIA, 3130
//
//  Provided no fee is charged (either by the distributer or user)
//  permission to use, copy, modify, and distribute this software and
//  its documentation for any purpose and without fee is hereby granted,
//  provided that the above copyright notice appear in all copies and
//  that both that copyright notice and this permission notice appear
//  in supporting documentation.
//
//  No waranty or suitablity for purpose is implied.
//
//
//  IMsgStore interface wrapper class
//  NOTES: Manages all subordinate IMsgStore resources
//      
#pragma   once
#include <mapix.h>
#include <objbase.h>

#define MAPI_NO_CACHE ((ULONG)0x00000200)

#include "MAPISession.h"
#include "MAPIProp.h"
#include "MAPIMessage.h"
#include "MAPIFolder.h"

////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  CMsgStore class
//  NOTES: Primarily wraps and manages the IMsgStore interface

class CMAPISession;
class P2PmsgMAPI_EXT CMsgStore 
{
    // Constructors and destructor
    public:
	      CMsgStore ( CMAPISession *pMAPISession, IMsgStore *pIMsgStore, ULONG ulMDBFlags );
      virtual
	     ~CMsgStore ( );

    // Attributes
    protected:
     CMAPISession  *m_pMAPISession;
	   IMsgStore     *m_pIMsgStore;
	   ULONG          m_ulMDBFlags;

    // Folder query factories
    // NOTES: Externally client managed life cycle
    public:
      CMAPIFolder*
        Query4RootFolder ( );
      CMAPIFolder*
        Query4Folder ( unsigned long ulFolderID );
      CMAPIFolder*
        Query4Folder ( LPCTSTR lpszFolderName );
      CMAPIFolder*
        Query4Inbox ( );
      CMAPIFolder*
        Query4Drafts ( );
      CMAPIFolder*
        Query4SentItems ( );
      CMAPIFolder*
        Query4DeletedItems ( );
      CMAPIFolder*
        Query4JunkFolder ( );
      CMAPIFolder*
        Query4Outbox ( );
      CMAPIFolder*
        Query4SpecialFolder ( unsigned long ulFolderID );
      CMAPIFolder*
        Query4Contacts ( );
      CMAPIFolder*
        Query4Calendar ( );

    // Property exposure
    public:
      IMsgStore*
      	GetIMsgStore ( );
      ULONG
        GetSupportMask ( );
};
typedef P2PSafePtr<CMsgStore> CMsgStoreSP;

#ifndef PR_SMTP_ADDRESS
#define PR_SMTP_ADDRESS PROP_TAG(PT_TSTRING, 0x39FE)
#endif

#ifndef PR_MSG_EDITOR_FORMAT 
#define PR_MSG_EDITOR_FORMAT PROP_TAG(PT_LONG, 0x5909)
#define EDITOR_FORMAT_DONTKNOW ((ULONG)0) 
#define EDITOR_FORMAT_PLAINTEXT ((ULONG)1) 
#define EDITOR_FORMAT_HTML ((ULONG)2) 
#define EDITOR_FORMAT_RTF ((ULONG)3) 
#endif

#ifndef PR_BODY_HTML
#define PR_BODY_HTML PROP_TAG( PT_TSTRING, 0x1013)
#define PR_BODY_HTML_A PROP_TAG( PT_STRING8, 0x1013)
#endif

#ifndef PR_ATTACH_CONTENT_ID
#define PR_ATTACH_CONTENT_ID PROP_TAG(PT_TSTRING, 0x3712)
#endif

//
//  MAPI definitions
//  Refer http://msdn.microsoft.com/en-us/library/office/bb821172(v=office.12).aspx
#define PR_IPM_APPOINTMENT_ENTRYID (PROP_TAG(PT_BINARY, 0x36D0))
#define PR_IPM_CONTACT_ENTRYID (PROP_TAG(PT_BINARY, 0x36D1))
#define PR_IPM_JOURNAL_ENTRYID (PROP_TAG(PT_BINARY, 0x36D2))
#define PR_IPM_NOTE_ENTRYID (PROP_TAG(PT_BINARY, 0x36D3))
#define PR_IPM_TASK_ENTRYID (PROP_TAG(PT_BINARY, 0x36D4))
#define PR_IPM_DRAFTS_ENTRYID (PROP_TAG(PT_BINARY, 0x36D7))

