home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / dbmsg / mapi / remote.xp / xpwdsr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-11  |  24.4 KB  |  715 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  File Name 
  4. //      XPWDSR.H
  5. //
  6. //  Description
  7. //      Interface declaraction file for CXPLogon, CXPProvider, CMAPIFolder,
  8. //      and CMAPIStatus.
  9. //      Property tag definitions.
  10. //      Constant definitions.
  11. //
  12. //  Author
  13. //      Irving De la Cruz
  14. //
  15. //  Revision: 1.7
  16. //
  17. // Written for Microsoft Windows Developer Support
  18. // Copyright (c) 1995-1996 Microsoft Corporation. All rights reserved.
  19. //
  20. #ifndef _XPWDSR_H
  21. #define _XPWDSR_H
  22.  
  23. #define STRICT
  24. #include <WINDOWS.H>
  25. #include <WINDOWSX.H>
  26. #include <MAPIWIN.H>
  27. #include <MAPISPI.H>
  28. #include <MAPIUTIL.H>
  29. #include <MAPIVAL.H>
  30. #include <TNEF.H>
  31.  
  32. #ifdef _DEBUG
  33. #define ENABLE_DEBUG_OUTPUT     1
  34. #endif // _DEBUG
  35.  
  36. // Header file for the trace and logging functions.
  37. #include "TRACES.H"
  38.  
  39. // Common defs used by providers to communicate to the WINDS Sample Messaging Host
  40. #include "COMWINDS.H"
  41.  
  42. // Config Page Dialog Control IDs Message String ID's
  43. #include "RESOURCE.H"
  44.  
  45. // Cached stream for the TNEF object
  46. #include "XPSTREAM.H"
  47.  
  48. // Definition for the helper classes CList and CMsgQueue
  49. #include "XPLIST.H"
  50.  
  51. /// Names returned in the status object
  52. #define TRANSPORT_DISPLAY_NAME_STRING       TEXT("PSS WINDS Remote Transport")
  53. #define TRANSPORT_DLL_NAME_STRING           TEXT("XPWDSR.DLL")
  54.  
  55. // Internal provider version
  56. #define TRANSPORT_VERSION_MAJOR             1
  57. #define TRANSPORT_VERSION_MINOR             5
  58.  
  59. // Name of the stream where the message properties get encoded using TNEF encapsulation
  60. #define TNEF_FILE_NAME                      TEXT("WINMAIL.DAT")
  61.  
  62. // Bitmask used to modify the PR_STATUS_CODE property in the status row of this
  63. // transport, when the download or upload logic is active.
  64. #define DOWNLOADING_MESSAGES (STATUS_INBOUND_FLUSH | STATUS_INBOUND_ACTIVE)
  65. #define UPLOADING_MESSAGES (STATUS_OUTBOUND_FLUSH | STATUS_OUTBOUND_ACTIVE)
  66.  
  67. // Window class name used in the timer window
  68. #define TIMER_WND_CLASS     TEXT("WINDS_XP_TIMER")
  69.  
  70. // This is copied from GENPROP.H in other PSS MAPI sample providers
  71. typedef struct _PRIVATE_ENTRYID
  72. {
  73.     // MAPI-required fields
  74.     BYTE        abFlags[4];     // 4 bytes          // MAPI Flags
  75.     MAPIUID     uidGlobal;      // 16 bytes         // UID Unique for the backend (ie. at the database file level)  (This must be here)
  76.     // Provider-defined fields
  77.     BYTE        bVersion;       // 1 bytes          // Version of the entry ID schema
  78.     BYTE        bObject;        // 1 bytes          // Object type
  79.     BYTE        bPad[2];        // 2 bytes          // Pad to align the structure to 4-bytes boundaries
  80.     DWORD       dwObjID;        // 4 bytes          // Object ID (container or object)
  81.                                 // 28 Bytes Total
  82. } PRIVATE_ENTRYID;
  83. #define     ENTRYID_VERSION     1       // Schema version
  84. #define     CB_PRIVATE_EID      28      // Size of the structure above
  85.  
  86.  
  87. // The order for this enumarations must match the order of the properties
  88. // in the tag arrays. These arrays are used to access the 
  89. // LPSPropValue arrays returned from MAPI interfaces. The use of enumerations
  90. // hides differences when the number of properties in the tag array increases
  91. // or decreases. It also helps maintain error-free indexing in the use of 
  92. // the prop arrays
  93. enum
  94. {
  95.     //SERVER_NAME           = 0,        // Array Indexes
  96.     //MAILBOX_NAME          = 1,
  97.     //MAILBOX_ID            = 2,
  98.     //USER_NAME             = 3,
  99.     //PASSWORD              = 4,
  100.     //NET_CON               = 5,
  101.     UPLOAD_TIME             = 6,
  102.     HEADER_FILE             = 7,
  103.     GET_HEADERS             = 8,
  104.     NUM_LOGON_PROPERTIES    = 9         // Array size
  105. };
  106.  
  107. // ID array of property tags for the trannsport
  108. const static SizedSPropTagArray(NUM_LOGON_PROPERTIES, sptLogonProps) =
  109. {
  110.     NUM_LOGON_PROPERTIES,
  111.     {
  112.         PR_SMP_REMOTE_SERVER,           // DON'T CHANGE THE ORDER OF THIS PROPERTY  (position 0)
  113.         PR_SMP_MAILBOX_NAME,            // DON'T CHANGE THE ORDER OF THIS PROPERTY  (position 1)
  114.         PR_SMP_MAILBOX_ID,              // DON'T CHANGE THE ORDER OF THIS PROPERTY  (position 2)
  115.         PR_SMP_USER_NAME,               // DON'T CHANGE THE ORDER OF THIS PROPERTY  (position 3)
  116.         PR_SMP_MAILBOX_PASSWORD,        // DON'T CHANGE THE ORDER OF THIS PROPERTY  (position 4)
  117.         PR_SMP_CONNECTION_TYPE,         // DON'T CHANGE THE ORDER OF THIS PROPERTY  (position 5)
  118.         PR_SMP_UPLOAD_TIME,
  119.         PR_SMP_HEADERS_FILENAME,
  120.         PR_SMP_GET_HEADERS
  121.     }
  122. };
  123.  
  124. // Idle state of the transport
  125. typedef enum _TRANSPORT_STATE
  126. {
  127.     WAITING,                // Waiting for the deferred submission time to arrive to send deferred messages
  128.     READY,                  // Ready to accept re-submission of deferred messages
  129.     SENDING,                // The transport is sending deferred messages
  130.     HEADERS_AND_DOWNLOAD,   // Get the latest list of message headers and download messages from the server
  131.     PENDING_RETURN_CODE,    // A remote operation has finished and the result code is pending to be returned to a remote viewer
  132.     PROCESSING_TIMER_EVENT, // Download the message headers as a response to the scheduled action
  133. } TRANSPORT_STATE;
  134.  
  135. typedef enum _REMOTE_ACTION
  136. {
  137.     REMOTE_ACTION_DOWNLOADING_MSGS,
  138.     REMOTE_ACTION_PROCESSING_MSGS,
  139.     REMOTE_ACTION_HEADER_REFRESH,
  140.     REMOTE_ACTION_IDLE
  141. } REMOTE_ACTION;
  142.  
  143. // Indexes of the identity property array
  144. enum
  145. {
  146.     XPID_NAME,              // Array Indexes
  147.     XPID_EID,
  148.     XPID_SEARCH_KEY,
  149.     NUM_IDENTITY_PROPS      // Array size
  150. };
  151.  
  152. // Indexes of the properties in each row in the contents table of the remote mailbag folder.
  153. enum
  154. {
  155.     HDR_EID,                // Array Indexes
  156.     HDR_SNDR,
  157.     HDR_REPR,
  158.     HDR_DISP_TO,
  159.     HDR_SUBJ,
  160.     HDR_CLASS,
  161.     HDR_FLAGS,
  162.     HDR_SIZE,
  163.     HDR_PRIOR,
  164.     HDR_IMPORTANCE,
  165.     HDR_SENS,
  166.     HDR_TIME,
  167.     HDR_STAT,
  168.     HDR_DOWNLOAD_TIME,
  169.     HDR_HASATTACH,
  170.     HDR_OBJ_TYPE,
  171.     HDR_INST_KEY,
  172.     HDR_NORM_SUBJ,
  173.     NUM_HDR_PROPS           // Array size
  174. };
  175. static const SizedSPropTagArray(NUM_HDR_PROPS, sptFldContents) =
  176. {
  177.     NUM_HDR_PROPS,
  178.     {
  179.         PR_ENTRYID,                 // Index column in the contents table
  180.         PR_SENDER_NAME,
  181.         PR_SENT_REPRESENTING_NAME,
  182.         PR_DISPLAY_TO,
  183.         PR_SUBJECT,
  184.         PR_MESSAGE_CLASS,
  185.         PR_MESSAGE_FLAGS,
  186.         PR_MESSAGE_SIZE,
  187.         PR_PRIORITY,
  188.         PR_IMPORTANCE,
  189.         PR_SENSITIVITY,
  190.         PR_MESSAGE_DELIVERY_TIME,
  191.         PR_MSG_STATUS,
  192.         PR_MESSAGE_DOWNLOAD_TIME,
  193.         PR_HASATTACH,
  194.         PR_OBJECT_TYPE,
  195.         PR_INSTANCE_KEY,
  196.         PR_NORMALIZED_SUBJECT,
  197.     }
  198. };
  199.  
  200. // Available properties in the folder object 
  201. #define NUM_FOLDER_PROPS        12
  202. static const SizedSPropTagArray (NUM_FOLDER_PROPS, sptFolderProps) =
  203. {
  204.     NUM_FOLDER_PROPS,
  205.     {
  206.         PR_ACCESS,
  207.         PR_ACCESS_LEVEL,
  208.         PR_CONTENT_COUNT,
  209.         PR_ASSOC_CONTENT_COUNT,
  210.         PR_FOLDER_TYPE,
  211.         PR_OBJECT_TYPE,
  212.         PR_SUBFOLDERS,
  213.         PR_CREATION_VERSION,
  214.         PR_CURRENT_VERSION,
  215.         PR_CREATION_TIME,
  216.         PR_DISPLAY_NAME,
  217.         PR_DISPLAY_TYPE
  218.     }
  219. };
  220.  
  221.  
  222. // Indexes of the properties we extracting of a message being
  223. // submitted to generate the remote server message header.
  224. enum
  225. {
  226.     MSG_DISP_TO,            // Array Indexes
  227.     MSG_SUBJECT,
  228.     MSG_CLASS,
  229.     MSG_FLAGS,
  230.     MSG_SIZE,
  231.     MSG_PRIORITY,
  232.     MSG_IMPORTANCE,
  233.     MSG_SENSITIVITY,
  234.     MSG_DR_REPORT,
  235.     NUM_MSG_PROPS           // Array size
  236. };
  237. static const SizedSPropTagArray(NUM_MSG_PROPS, sptPropsForHeader) =
  238. {
  239.     NUM_MSG_PROPS,
  240.     {
  241.         PR_DISPLAY_TO,
  242.         PR_SUBJECT,
  243.         PR_MESSAGE_CLASS,
  244.         PR_MESSAGE_FLAGS,
  245.         PR_MESSAGE_SIZE,
  246.         PR_PRIORITY,
  247.         PR_IMPORTANCE,
  248.         PR_SENSITIVITY,
  249.         PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED
  250.     }
  251. };
  252.  
  253. #define OUT_MSG_PROPS 2
  254. static const SizedSPropTagArray(OUT_MSG_PROPS, sptOutMsgProps) =
  255. {
  256.     OUT_MSG_PROPS,
  257.     {
  258.         PR_SENDER_ENTRYID,
  259.         PR_SENT_REPRESENTING_NAME
  260.     }
  261. };
  262.  
  263. // Used to generate one-off's for the sender of newly received messages
  264. enum
  265. {
  266.     NEW_SENDER_NAME,
  267.     NEW_SENDER_EMAIL,
  268.     NEW_SENT_NAME,
  269.     NEW_SENT_EMAIL,
  270.     NEW_MSG_FLAGS,
  271.     NUM_NEW_MSG_PROPS
  272. };
  273. static const SizedSPropTagArray(NUM_NEW_MSG_PROPS, sptNewMsgProps) =
  274. {
  275.     NUM_NEW_MSG_PROPS,
  276.     {
  277.         PR_SENDER_NAME,
  278.         PR_SENDER_EMAIL_ADDRESS,
  279.         PR_SENT_REPRESENTING_NAME,
  280.         PR_SENT_REPRESENTING_EMAIL_ADDRESS,
  281.         PR_MESSAGE_FLAGS
  282.     }
  283. };
  284.  
  285. // Used to generate transport-computed properties on received mail messages
  286. #define MSG_RECIP_PROPS     2
  287. static const SizedSPropTagArray(MSG_RECIP_PROPS, sptMsgRecipProps) =
  288. {
  289.     MSG_RECIP_PROPS,
  290.     {
  291.         PR_EMAIL_ADDRESS,
  292.         PR_RECIPIENT_TYPE
  293.     }
  294. };
  295. // Indexes to order the recipient's table of messages being submitted
  296. enum
  297. {
  298.     RECIP_ROWID,
  299.     RECIP_NAME,
  300.     RECIP_EMAIL_ADR,
  301.     RECIP_TYPE,
  302.     RECIP_RESPONSIBILITY,
  303.     RECIP_DELIVER_TIME,
  304.     RECIP_REPORT_TIME,
  305.     RECIP_REPORT_TEXT,
  306.     TABLE_RECIP_PROPS
  307. };
  308. const static SizedSPropTagArray (TABLE_RECIP_PROPS, sptRecipTable) =
  309. {
  310.     TABLE_RECIP_PROPS,
  311.     {
  312.         PR_ROWID,
  313.         PR_DISPLAY_NAME,
  314.         PR_EMAIL_ADDRESS,
  315.         PR_RECIPIENT_TYPE,
  316.         PR_RESPONSIBILITY,
  317.         PR_DELIVER_TIME,
  318.         PR_REPORT_TIME,
  319.         PR_REPORT_TEXT
  320.     }
  321. };
  322.  
  323.  
  324. // Available properties in the status object of this provider
  325. #define NUM_STATUS_OBJECT_PROPS    13
  326. const static SizedSPropTagArray (NUM_STATUS_OBJECT_PROPS, sptStatusObj) =
  327. {
  328.     NUM_STATUS_OBJECT_PROPS,
  329.     {
  330.         PR_OBJECT_TYPE,
  331.         PR_STATUS_CODE,
  332.         PR_PROVIDER_DISPLAY,
  333.         PR_PROVIDER_DLL_NAME,
  334.         PR_RESOURCE_METHODS,
  335.         PR_RESOURCE_FLAGS,
  336.         PR_RESOURCE_TYPE,
  337.         PR_STATUS_STRING,
  338.         PR_DISPLAY_NAME,
  339.         PR_IDENTITY_DISPLAY,
  340.         PR_IDENTITY_ENTRYID,
  341.         PR_IDENTITY_SEARCH_KEY,
  342.         PR_CURRENT_VERSION
  343.     }
  344. };
  345.  
  346. // Stand-alone helper functions (C style)
  347. extern "C"
  348. {
  349.     HRESULT WINAPI DoLogonDlg
  350.                     (PCFGDLG                    pCfgDialog);
  351.     MSGSERVICEENTRY ServiceEntry;
  352.     HRESULT WINAPI GetMAPIError
  353.                     (LPMAPIERROR *              ppMAPIError,
  354.                      ULONG                      ulFlags,
  355.                      HRESULT                    hError,
  356.                      HINSTANCE                  hInstance);
  357.     BOOL WINAPI ParseTime
  358.                     (LPTSTR                     pszTime,
  359.                      WORD *                     pwHour,
  360.                      WORD *                     pwMinute);
  361.     void WINAPI GetTimeString
  362.                     (LPTSTR                     pszTime,
  363.                      FILETIME                   FileTime);
  364.     extern LPALLOCATEBUFFER    gpfnAllocateBuffer;  // MAPIAllocateBuffer function
  365.     extern LPALLOCATEMORE      gpfnAllocateMore;    // MAPIAllocateMore function    
  366.     extern LPFREEBUFFER        gpfnFreeBuffer;      // MAPIFreeBuffer function      
  367. }
  368.  
  369. // Forward class declarations
  370. class CMAPIFolder;
  371. class CList;
  372.  
  373. class CMAPIStatus : public IMAPIStatus
  374. {
  375. friend CXPLogon;
  376. friend CList;
  377. public:
  378. ///////////////////////////////////////////////////////////////////////////////
  379. // Interface virtual member functions
  380. //
  381.     STDMETHODIMP QueryInterface
  382.                     (REFIID                     riid,
  383.                      LPVOID *                   ppvObj);
  384.     inline STDMETHODIMP_(ULONG) AddRef
  385.                     () { ++m_cRef; return m_cRef; };
  386.     inline STDMETHODIMP_(ULONG) Release
  387.                     () { ULONG ulCount = --m_cRef;
  388.                          if (!ulCount) { delete this; }
  389.                          return ulCount;};
  390.  
  391.     MAPI_IMAPIPROP_METHODS(IMPL);
  392.     MAPI_IMAPISTATUS_METHODS(IMPL);
  393.  
  394. ///////////////////////////////////////////////////////////////////////////////
  395. // Other member functions specific to this transport
  396. //
  397.     
  398. ///////////////////////////////////////////////////////////////////////////////
  399. // Constructors and destructors
  400. //
  401. public :
  402.     CMAPIStatus     (CXPLogon *                 pLogon,
  403.                      LPPROFSECT                 pProfSectObj);
  404.     ~CMAPIStatus    ();
  405.  
  406. ///////////////////////////////////////////////////////////////////////////////
  407. // Data members
  408. //
  409. private :
  410.     ULONG           m_cRef;
  411.     CXPLogon *      m_pLogon;
  412.     CMAPIFolder *   m_pHeaderFolder;
  413.     LPPROFSECT      m_pProfSectObj;
  414. };
  415.  
  416. class  CMAPIFolder : public IMAPIFolder
  417. {
  418. friend CXPLogon;
  419. friend CMAPIStatus;
  420. friend CList;
  421. public:
  422. ///////////////////////////////////////////////////////////////////////////////
  423. // Interface virtual member functions
  424. //
  425.     STDMETHODIMP QueryInterface
  426.                     (REFIID                     riid,
  427.                      LPVOID *                   ppvObj);
  428.     inline STDMETHODIMP_(ULONG) AddRef
  429.                     () { ++m_cRef; return m_cRef; };
  430.     STDMETHODIMP_(ULONG) Release();
  431.     MAPI_IMAPIPROP_METHODS(IMPL);
  432.     MAPI_IMAPICONTAINER_METHODS(IMPL);
  433.     MAPI_IMAPIFOLDER_METHODS(IMPL);
  434.  
  435. ///////////////////////////////////////////////////////////////////////////////
  436. // Other member functions specific to this class
  437. //
  438.     STDMETHODIMP FillContentsTable
  439.                     (LPTSTR                     pszHeaderFilename);
  440.     STDMETHODIMP CopyTableToFile
  441.                     ();
  442.  
  443. ///////////////////////////////////////////////////////////////////////////////
  444. // Constructors and destructors
  445. //
  446. public :
  447.     CMAPIFolder     (CMAPIStatus *              pStatusObj,
  448.                      CXPLogon *                 pLogonObj);
  449.     ~CMAPIFolder    ();
  450.  
  451. ///////////////////////////////////////////////////////////////////////////////
  452. // Data members
  453. //
  454. private :
  455.     ULONG           m_cRef;
  456.     CXPLogon *      m_pLogon;
  457.     CMAPIStatus *   m_pStatusObj;
  458.     LPTABLEDATA     m_pTableData;
  459.     BOOL            m_fNoHeadersFile;
  460.     FILETIME        m_ftLastUpdate;
  461. };
  462.  
  463. class CXPLogon : public IXPLogon
  464. {
  465. public:
  466. ///////////////////////////////////////////////////////////////////////////////
  467. // Interface virtual member functions
  468. //
  469.     STDMETHODIMP QueryInterface
  470.                     (REFIID                     riid,
  471.                      LPVOID *                   ppvObj);
  472.     inline STDMETHODIMP_(ULONG) AddRef
  473.                     () { ++m_cRef; return m_cRef; };
  474.     inline STDMETHODIMP_(ULONG) Release
  475.                     () { ULONG ulCount = --m_cRef;
  476.                          if (!ulCount) { delete this; }
  477.                          return ulCount;};
  478.     MAPI_IXPLOGON_METHODS(IMPL);
  479.  
  480. ///////////////////////////////////////////////////////////////////////////////
  481. // Other member functions specific to this transport
  482. //
  483. public :
  484.     STDMETHODIMP InitializeStatusRow
  485.                     (ULONG                      ulFlags = 0);
  486.     STDMETHODIMP SetIdentityProps
  487.                     ();
  488.     STDMETHODIMP DownloadMessageHeaders
  489.                     ();
  490.     STDMETHODIMP MakeSearchKey
  491.                     (LPVOID                     pParentMemBlock,
  492.                      LPTSTR                     pszAddress,
  493.                      ULONG *                    pcbSearchKey,
  494.                      LPBYTE *                   ppSearchKey);
  495.     STDMETHODIMP GrowAddressList
  496.                     (LPADRLIST *                ppAdrList,
  497.                      ULONG                      ulResizeBy,
  498.                      ULONG *                    pulOldAndNewCount);
  499.     STDMETHODIMP SendMailMessage
  500.                     (LPMESSAGE                  pMsgObj,
  501.                      LPSRowSet                  pRecipRows);
  502.     STDMETHODIMP SetIncomingProps
  503.                     (LPMESSAGE                  pMsgObj,
  504.                      PLIST_NODE                 pNode);
  505.     BOOL WINAPI GetMsgTempFileName
  506.                     (LPTSTR                     pszFileName);
  507.     BOOL WINAPI IsValidAddress
  508.                     (LPTSTR                     pszAddress,
  509.                      LPTSTR *                   ppszServer,
  510.                      LPTSTR *                   ppszMailbox);
  511.     BOOL WINAPI LoadStatusString
  512.                     (LPTSTR                     pString,
  513.                      UINT                       uStringSize);
  514.     void WINAPI InitializeTransportStatusFlags
  515.                     (ULONG                      ulFlags);
  516.     void WINAPI UpdateStatus
  517.                     (BOOL                       fAddValidate = FALSE,
  518.                      BOOL                       fValidateOkState = FALSE);
  519.     void WINAPI UpdateProgress
  520.                     (long                       lPercentComplete,
  521.                      REMOTE_ACTION              raFlag);
  522.     void WINAPI SetSessionFlags
  523.                     (ULONG *                    pulFlags);
  524.     void WINAPI CreateMsgHeaderTextLine
  525.                     (LPSPropValue               pProps,
  526.                      LPTSTR                     pszBuffer,
  527.                      FILETIME &                 time);
  528.     void WINAPI SetOutgoingProps
  529.                     (LPMESSAGE                  pMsgObj,
  530.                      FILETIME                   ft);
  531.     void WINAPI CheckForUnfinishedDownloads
  532.                     ();
  533.     void WINAPI InitializeTimer
  534.                     ();
  535.     void WINAPI StopUploadTimer
  536.                     ();
  537.     void WINAPI StartUploadTimer
  538.                     ();
  539.     inline BOOL WINAPI SetUploadTime
  540.                     (FILETIME                   ftUploads)
  541.                     { SYSTEMTIME st;
  542.                      FileTimeToSystemTime (&ftUploads, &st);
  543.                      BOOL fChanged = FALSE;
  544.                      if (m_stDelivTime.wHour != st.wHour || m_stDelivTime.wMinute != st.wMinute)
  545.                      { fChanged = TRUE; }
  546.                      m_stDelivTime = st;
  547.                      return fChanged; }
  548.     inline void WINAPI AddStatusBits
  549.                     (DWORD dwNewBits) { m_ulTransportStatus |= dwNewBits; }
  550.     inline void WINAPI RemoveStatusBits
  551.                     (DWORD dwOldBits) { m_ulTransportStatus &= ~dwOldBits; }
  552.     inline void WINAPI SetTransportState
  553.                     (TRANSPORT_STATE NewState) { m_TransportState = NewState; }
  554.     inline DWORD WINAPI GetTransportStatusCode
  555.                     () { return m_ulTransportStatus; }
  556.     inline LPTABLEDATA WINAPI GetRemoteFolderTableData
  557.                     () { return m_pStatusObj->m_pHeaderFolder->m_pTableData; }
  558.     inline TRANSPORT_STATE WINAPI GetTransportState
  559.                     () { return m_TransportState; }
  560.     inline HINSTANCE WINAPI GetInstance
  561.                     () { return m_hInstance; }
  562.     inline LPTSTR WINAPI GetLocalHeadersCache
  563.                     () { return m_szHeaders; }
  564.     inline LPTSTR WINAPI GetServerName
  565.                     () { return m_szServer; }
  566.     inline void WINAPI SetServerName
  567.                     (LPTSTR                     szNewServer)
  568.                     { lstrcpy (m_szServer, szNewServer); }
  569.     inline LPTSTR WINAPI GetAccountName
  570.                     () { return m_UserInfo.szMailboxName; }
  571.     inline BOOL WINAPI PendingIncoming
  572.                     () { return m_List.AreTherePendingDownloads(); }
  573.     inline void WINAPI SetAccountProps
  574.                     (LPTSTR                     szAccountName,
  575.                      DWORD                      dwAccountID,
  576.                      LPTSTR                     szUserName,
  577.                      LPTSTR                     szPassword)
  578.                     { lstrcpy (m_UserInfo.szMailboxName, szAccountName);
  579.                       lstrcpy (m_UserInfo.szFullName, szUserName);
  580.                       lstrcpy (m_UserInfo.szPassword, szPassword);
  581.                       m_UserEID.dwObjID = dwAccountID;
  582.                       LPSPropValue pOldProps = m_pIdentityProps;
  583.                       if (S_OK == SetIdentityProps())
  584.                       {
  585.                           gpfnFreeBuffer (pOldProps);
  586.                       }
  587.                       wsprintf (m_szAddress, TEXT("%s\\%s"), m_szServer, m_UserInfo.szMailboxName);}
  588. private:
  589.     void WINAPI CheckSpoolerYield
  590.                     (BOOL                       fReset = FALSE);
  591.     void WINAPI EmptyInboundQueue
  592.                     ();
  593.     STDMETHODIMP ProcessHeaders
  594.                     ();
  595.     inline void WINAPI DecomposeAddress
  596.                     (LPTSTR                     pszAddress,
  597.                      LPTSTR *                   ppszServer,
  598.                      LPTSTR *                   ppszMailbox)
  599.                     {
  600.                         // The 2 is to avoid the expected first two characters
  601.                         strtok (&pszAddress[2], "\\");
  602.                         *ppszServer = pszAddress;
  603.                         *ppszMailbox = strtok (NULL, "\\");
  604.                     }
  605.     inline void WINAPI RecomposeAddress
  606.                     (LPTSTR                     pszServer,
  607.                      LPTSTR                     pszMailbox,
  608.                      LPTSTR                     pszAddress)
  609.                     {
  610.                         // pszAddress must have previouly been decomposed with
  611.                         // CXPLogon::DecomposeAddress
  612.                         pszAddress[lstrlen (pszServer)] = '\\';
  613.                     }
  614.  
  615.     
  616. ///////////////////////////////////////////////////////////////////////////////
  617. // Constructors and destructors
  618. public :
  619.     CXPLogon        (HINSTANCE                  hInstance,
  620.                      LPMAPISUP                  pSupObj,
  621.                      LPTSTR                     pszHeadersFile,
  622.                      BOOL                       fGetHeaders,
  623.                      PMAILBOX_INFO              pUserMailboxInfo,
  624.                      DWORD                      dwMailboxID,
  625.                      LPTSTR                     pszRemoteServer,
  626.                      HANDLE                     hUIMutex);
  627.     ~CXPLogon       ();
  628.  
  629. ///////////////////////////////////////////////////////////////////////////////
  630. // Data members
  631. private :
  632.     // Object implementation internal data
  633.     ULONG               m_cRef;
  634.     HINSTANCE           m_hInstance;
  635.     CList               m_List;
  636.     BOOL                m_fABWDSInstalled;
  637. public :
  638.     LPMAPISUP           m_pSupObj;
  639.     HANDLE              m_hUIMutex;
  640.     HRESULT             m_hRemoteActionErr;
  641.     BOOL                m_fCancelPending;
  642.     CMAPIStatus *       m_pStatusObj;
  643.  
  644. private :
  645.     // Remote headers
  646.     TCHAR               m_szHeaders[_MAX_PATH];
  647.     BOOL                m_fGetHeaders;
  648.  
  649.     // Transport activity state
  650.     ULONG               m_ulTransportStatus;
  651.     TRANSPORT_STATE     m_TransportState;
  652.     REMOTE_ACTION       m_raAction;
  653.  
  654.     // Server information
  655.     TCHAR               m_szServer[MAX_STRING_SIZE+1];
  656.     
  657.     // User information and identity on the WINDS messaging server
  658.     MAILBOX_INFO        m_UserInfo;
  659.     PRIVATE_ENTRYID     m_UserEID;
  660.     TCHAR               m_szAddress[64];
  661. public :
  662.     LPSPropValue        m_pIdentityProps;
  663.  
  664. private :
  665.     // Deferred delivery and timer logic
  666.     SYSTEMTIME          m_stDelivTime;
  667.     HWND                m_hTimerWnd;
  668. public :
  669.     UINT                m_uTimerID;
  670. };
  671.  
  672. class CXPProvider : public IXPProvider
  673. {
  674. friend CXPLogon;
  675. friend CMAPIStatus;
  676. friend CMAPIFolder;
  677. public:
  678. ///////////////////////////////////////////////////////////////////////////////
  679. // Interface virtual member functions
  680. //
  681.     STDMETHODIMP QueryInterface
  682.                     (REFIID                     riid,
  683.                      LPVOID *                   ppvObj);
  684.     inline STDMETHODIMP_(ULONG) AddRef
  685.                     () { ++m_cRef; return m_cRef; };
  686.     inline STDMETHODIMP_(ULONG) Release
  687.                     () { ULONG ulCount = --m_cRef;
  688.                          if (!ulCount) { delete this; }
  689.                          return ulCount;};
  690.     MAPI_IXPPROVIDER_METHODS(IMPL);
  691.  
  692. ///////////////////////////////////////////////////////////////////////////////
  693. // Other member functions specific to this class
  694. //
  695.     
  696. ///////////////////////////////////////////////////////////////////////////////
  697. // Constructors and destructors
  698. //
  699. public :
  700.     CXPProvider     (HINSTANCE                  hInst);
  701.     ~CXPProvider    ();
  702.  
  703. ///////////////////////////////////////////////////////////////////////////////
  704. // Data members
  705. //
  706. private :
  707.     ULONG               m_cRef;
  708.     CRITICAL_SECTION    m_csTransport;
  709.     HINSTANCE           m_hInstance;
  710. };
  711.  
  712. #endif // _XPWDSR_H
  713.  
  714. // End of file for XPWDSR.H
  715.