XPWDSR.H
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:24k
源码类别:

Windows编程

开发平台:

Visual C++

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