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.

144 lines
5.5 KiB

  1. /*
  2. * m e s s a g e
  3. *
  4. * Purpose:
  5. *
  6. * History
  7. *
  8. * Copyright (C) Microsoft Corp. 1995, 1996.
  9. */
  10. #ifndef _MESSAGE_H
  11. #define _MESSAGE_H
  12. #include "privunk.h"
  13. #include "basedisp.h"
  14. interface IOEMessageCollection;
  15. interface IOEMessage;
  16. typedef struct OEMSGDATA_tag
  17. {
  18. LPSTR pszSubj,
  19. pszTo,
  20. pszCc,
  21. pszFrom;
  22. MESSAGEID msgid;
  23. FILETIME ftReceived;
  24. } OEMSGDATA, *POEMSGDATA;
  25. class COEMessageCollection:
  26. public IOEMessageCollection,
  27. public CBaseDisp
  28. {
  29. public:
  30. // ---------------------------------------------------------------------------
  31. // IUnknown members
  32. // ---------------------------------------------------------------------------
  33. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj)
  34. { return PrivateQueryInterface(riid, ppvObj); };
  35. virtual STDMETHODIMP_(ULONG) AddRef(void)
  36. { return ++m_cRef; };
  37. virtual STDMETHODIMP_(ULONG) Release(void)
  38. { m_cRef--; if (m_cRef == 0) {delete this; return 0;} return m_cRef; };
  39. // *** IDispatch)
  40. virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo)
  41. { return CBaseDisp::GetTypeInfoCount(pctinfo); };
  42. virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
  43. { return CBaseDisp::GetTypeInfo(itinfo, lcid, pptinfo); };
  44. virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid)
  45. { return CBaseDisp::GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid); };
  46. virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr)
  47. { return CBaseDisp::Invoke(dispidMember, riid, lcid, wFlags, pdispparams, pvarResult, pexcepinfo, puArgErr); };
  48. // *** IOEFolderCollection **
  49. virtual HRESULT STDMETHODCALLTYPE put_length(long v);
  50. virtual HRESULT STDMETHODCALLTYPE get_length(long * p);
  51. virtual HRESULT STDMETHODCALLTYPE get__newEnum(IUnknown **p);
  52. virtual HRESULT STDMETHODCALLTYPE item(VARIANT name, VARIANT index, IDispatch** pdisp);
  53. COEMessageCollection(IUnknown *pUnkOuter=NULL);
  54. virtual ~COEMessageCollection();
  55. HRESULT COEMessageCollection::Init(FOLDERID idFolder);
  56. private:
  57. ULONG m_cRef;
  58. FOLDERID m_idFolder;
  59. IMessageTable *m_pTable;
  60. virtual HRESULT PrivateQueryInterface(REFIID riid, LPVOID * ppvObj);
  61. HRESULT _FindMessageByIndex(LONG l, IDispatch** ppdisp);
  62. };
  63. class COEMessage:
  64. public IOEMessage,
  65. public CBaseDisp
  66. {
  67. public:
  68. // ---------------------------------------------------------------------------
  69. // IUnknown members
  70. // ---------------------------------------------------------------------------
  71. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj)
  72. { return PrivateQueryInterface(riid, ppvObj); };
  73. virtual STDMETHODIMP_(ULONG) AddRef(void)
  74. { return ++m_cRef; };
  75. virtual STDMETHODIMP_(ULONG) Release(void)
  76. { m_cRef--; if (m_cRef == 0) {delete this; return 0;} return m_cRef; };
  77. // *** IDispatch)
  78. virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo)
  79. { return CBaseDisp::GetTypeInfoCount(pctinfo); };
  80. virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
  81. { return CBaseDisp::GetTypeInfo(itinfo, lcid, pptinfo); };
  82. virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid)
  83. { return CBaseDisp::GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid); };
  84. virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult, EXCEPINFO *pexcepinfo, UINT *puArgErr)
  85. { return CBaseDisp::Invoke(dispidMember, riid, lcid, wFlags, pdispparams, pvarResult, pexcepinfo, puArgErr); };
  86. // *** IOEMessage**
  87. virtual HRESULT STDMETHODCALLTYPE get_subject(BSTR *pbstr);
  88. virtual HRESULT STDMETHODCALLTYPE put_subject(BSTR bstr);
  89. virtual HRESULT STDMETHODCALLTYPE get_to(BSTR *pbstr);
  90. virtual HRESULT STDMETHODCALLTYPE put_to(BSTR bstr);
  91. virtual HRESULT STDMETHODCALLTYPE get_cc(BSTR *pbstr);
  92. virtual HRESULT STDMETHODCALLTYPE put_cc(BSTR bstr);
  93. virtual HRESULT STDMETHODCALLTYPE get_sender(BSTR *pbstr);
  94. virtual HRESULT STDMETHODCALLTYPE put_sender(BSTR bstr);
  95. virtual HRESULT STDMETHODCALLTYPE get_text(BSTR *pbstr);
  96. virtual HRESULT STDMETHODCALLTYPE put_text(BSTR bstr);
  97. virtual HRESULT STDMETHODCALLTYPE get_html(BSTR *pbstr);
  98. virtual HRESULT STDMETHODCALLTYPE put_html(BSTR bstr);
  99. virtual HRESULT STDMETHODCALLTYPE get_date(BSTR *pbstr);
  100. virtual HRESULT STDMETHODCALLTYPE get_url(BSTR *pbstr);
  101. virtual HRESULT STDMETHODCALLTYPE send();
  102. COEMessage();
  103. virtual ~COEMessage();
  104. HRESULT Init(IMimeMessage *pMsg, FOLDERID idFolder, OEMSGDATA *pMsgData);
  105. HRESULT BindToMessage();
  106. private:
  107. ULONG m_cRef;
  108. IMimeMessage *m_pMsg;
  109. OEMSGDATA *m_pMsgData;
  110. FOLDERID m_idFolder;
  111. virtual HRESULT PrivateQueryInterface(REFIID riid, LPVOID * ppvObj);
  112. };
  113. HRESULT CreateOEMessage(IMimeMessage *pMsg, FOLDERID idFolder, OEMSGDATA *pMsgData, IDispatch **ppdisp);
  114. #endif //_MESSAGE_H