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.

228 lines
5.7 KiB

  1. /*
  2. * s e s s i o n . c p p
  3. *
  4. * Purpose:
  5. * Implements the OE-MOM 'Session' object
  6. *
  7. * History
  8. *
  9. * Copyright (C) Microsoft Corp. 1995, 1996.
  10. */
  11. #include <pch.hxx>
  12. #include "msoeobj.h"
  13. #include "session.h"
  14. #include "folders.h"
  15. #include "instance.h"
  16. //+---------------------------------------------------------------
  17. //
  18. // Member: Constructor
  19. //
  20. // Synopsis:
  21. //
  22. //
  23. //---------------------------------------------------------------
  24. COESession::COESession(IUnknown *pUnkOuter) : CBaseDisp(pUnkOuter)
  25. {
  26. Assert (g_pInstance);
  27. CoIncrementInit("COESession::COESession", MSOEAPI_START_SHOWERRORS, NULL, NULL);
  28. }
  29. //+---------------------------------------------------------------
  30. //
  31. // Member: Destructor
  32. //
  33. // Synopsis:
  34. //
  35. //
  36. //---------------------------------------------------------------
  37. COESession::~COESession()
  38. {
  39. Assert (g_pInstance);
  40. CoDecrementInit("COESession::COESession", NULL);
  41. }
  42. //+---------------------------------------------------------------
  43. //
  44. // Member: Init
  45. //
  46. // Synopsis:
  47. // Constructor that can fail
  48. //
  49. //---------------------------------------------------------------
  50. HRESULT COESession::Init()
  51. {
  52. return CBaseDisp::EnsureTypeLibrary((LPVOID *)(IOESession *)this, IID_IOESession);
  53. }
  54. //+---------------------------------------------------------------
  55. //
  56. // Member: PrivateQueryInterface
  57. //
  58. // Synopsis:
  59. // Exposes supported interfaces
  60. //
  61. //---------------------------------------------------------------
  62. HRESULT COESession::PrivateQueryInterface(REFIID riid, LPVOID *lplpObj)
  63. {
  64. if(!lplpObj)
  65. return E_INVALIDARG;
  66. *lplpObj = NULL;
  67. if (IsEqualIID(riid, IID_IUnknown))
  68. *lplpObj = (LPVOID)(IOESession *)this;
  69. else if (IsEqualIID(riid, IID_IOESession))
  70. *lplpObj = (LPVOID)(IOESession *)this;
  71. else
  72. return CBaseDisp::PrivateQueryInterface(riid, lplpObj);
  73. AddRef();
  74. return NOERROR;
  75. }
  76. //+---------------------------------------------------------------
  77. //
  78. // Member: get_folders
  79. //
  80. // Synopsis:
  81. // Returns the rootnode folder collection, representing
  82. // the top-most part of the OE heirarchy.
  83. //
  84. //---------------------------------------------------------------
  85. HRESULT COESession::get_folders(IOEFolderCollection **p)
  86. {
  87. return CreateFolderCollection(FOLDERID_ROOT, p);
  88. }
  89. //+---------------------------------------------------------------
  90. //
  91. // Member: get_version
  92. //
  93. // Synopsis:
  94. // Returns version information for OE.
  95. //
  96. //---------------------------------------------------------------
  97. HRESULT COESession::get_version(BSTR *pbstr)
  98. {
  99. // BUGBUG: build from OE string and APPVER
  100. *pbstr = SysAllocString(L"Outlook Express 6.0");
  101. return S_OK;
  102. }
  103. //+---------------------------------------------------------------
  104. //
  105. // Member: createMessage
  106. //
  107. // Synopsis:
  108. // Creates a new message object not associcated with
  109. // any folder, until it is saved or sent
  110. //
  111. //---------------------------------------------------------------
  112. HRESULT COESession::createMessage(IOEMessage **ppNewMsg)
  113. {
  114. ReportError(CLSID_OESession, idsNYITitle);
  115. return E_NOTIMPL;
  116. }
  117. //+---------------------------------------------------------------
  118. //
  119. // Member: get_inbox
  120. //
  121. // Synopsis:
  122. // Allows fast access to the default inbox folder
  123. //
  124. //---------------------------------------------------------------
  125. HRESULT COESession::get_inbox(IOEFolder **ppFolder)
  126. {
  127. ReportError(CLSID_OESession, idsNYITitle);
  128. return E_NOTIMPL;
  129. }
  130. //+---------------------------------------------------------------
  131. //
  132. // Member: openFolder
  133. //
  134. // Synopsis:
  135. // Quick access to a folder by ID
  136. //
  137. //---------------------------------------------------------------
  138. HRESULT COESession::openFolder(LONG idFolder, IOEFolder **ppFolder)
  139. {
  140. ReportError(CLSID_OESession, idsNYITitle);
  141. return E_NOTIMPL;
  142. }
  143. //+---------------------------------------------------------------
  144. //
  145. // Member: openMessage
  146. //
  147. // Synopsis:
  148. // Quick access to a message by ID and folder
  149. //
  150. //---------------------------------------------------------------
  151. HRESULT COESession::openMessage(LONG idFolder, LONG idMessage, IOEMessage **ppOEMsg)
  152. {
  153. ReportError(CLSID_OESession, idsNYITitle);
  154. return E_NOTIMPL;
  155. }
  156. //+---------------------------------------------------------------
  157. //
  158. // Member: InterfaceSupportsErrorInfo
  159. //
  160. // Synopsis:
  161. // Override CBaseDisp's method to provide error
  162. // information
  163. //
  164. //---------------------------------------------------------------
  165. HRESULT COESession::InterfaceSupportsErrorInfo(REFIID riid)
  166. {
  167. if (IsEqualIID(riid, IID_IOESession))
  168. return S_OK;
  169. return CBaseDisp::InterfaceSupportsErrorInfo(riid);
  170. }
  171. //+---------------------------------------------------------------
  172. //
  173. // Member: CreateInstance_OESession
  174. //
  175. // Synopsis:
  176. // Class Factory helper for OE Session object
  177. //
  178. //---------------------------------------------------------------
  179. HRESULT CreateInstance_OESession(IUnknown *pUnkOuter, IUnknown **ppUnknown)
  180. {
  181. // Locals
  182. COESession *pNew=NULL;
  183. HRESULT hr=S_OK;
  184. pNew = new COESession(pUnkOuter);
  185. if (!pNew)
  186. return E_OUTOFMEMORY;
  187. hr = pNew->Init();
  188. if (FAILED(hr))
  189. goto error;
  190. *ppUnknown = (IUnknown *)(IOESession *)pNew;
  191. pNew=NULL; // don't release
  192. error:
  193. ReleaseObj(pNew);
  194. return hr;
  195. }