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.

296 lines
7.6 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // FILE : InboundRouting.cpp //
  3. // //
  4. // DESCRIPTION : Fax Server - Fax InboundRouting node. //
  5. // //
  6. // AUTHOR : yossg //
  7. // //
  8. // HISTORY : //
  9. // Sep 29 1999 yossg Create //
  10. // Jan 31 2000 yossg Add full suport to method catalog //
  11. // Oct 17 2000 yossg //
  12. // //
  13. // Copyright (C) 1999 - 2000 Microsoft Corporation All Rights Reserved //
  14. /////////////////////////////////////////////////////////////////////////////
  15. #include "StdAfx.h"
  16. #include "InboundRouting.h"
  17. #include "CatalogInboundRoutingMethods.h"
  18. #include "Icons.h"
  19. //#include "oaidl.h"
  20. /****************************************************
  21. CFaxInboundRoutingNode Class
  22. ****************************************************/
  23. // {7362F15F-30B2-46a4-A8CB-C1DD29F0B1BB}
  24. static const GUID CFaxInboundRoutingNodeGUID_NODETYPE =
  25. { 0x7362f15f, 0x30b2, 0x46a4, { 0xa8, 0xcb, 0xc1, 0xdd, 0x29, 0xf0, 0xb1, 0xbb } };
  26. const GUID* CFaxInboundRoutingNode::m_NODETYPE = &CFaxInboundRoutingNodeGUID_NODETYPE;
  27. const OLECHAR* CFaxInboundRoutingNode::m_SZNODETYPE = OLESTR("7362F15F-30B2-46a4-A8CB-C1DD29F0B1BB");
  28. const CLSID* CFaxInboundRoutingNode::m_SNAPIN_CLASSID = &CLSID_Snapin;
  29. CColumnsInfo CFaxInboundRoutingNode::m_ColsInfo;
  30. /*
  31. - CFaxInboundRoutingNode::InsertColumns
  32. -
  33. * Purpose:
  34. * Adds columns to the default result pane.
  35. *
  36. * Arguments:
  37. * [in] pHeaderCtrl - IHeaderCtrl in the console-provided default result view pane
  38. *
  39. * Return:
  40. * OLE error code
  41. */
  42. HRESULT
  43. CFaxInboundRoutingNode::InsertColumns(IHeaderCtrl *pHeaderCtrl)
  44. {
  45. SCODE hRc;
  46. DEBUG_FUNCTION_NAME( _T("CFaxInboundRoutingNode::InsertColumns"));
  47. static ColumnsInfoInitData ColumnsInitData[] =
  48. {
  49. {IDS_FAX_COL_HEAD, 200},
  50. {LAST_IDS, 0}
  51. };
  52. hRc = m_ColsInfo.InsertColumnsIntoMMC(pHeaderCtrl,
  53. _Module.GetResourceInstance(),
  54. ColumnsInitData);
  55. if (hRc != S_OK)
  56. {
  57. DebugPrintEx(DEBUG_ERR,_T("m_ColsInfo.InsertColumnsIntoMMC. (hRc: %08X)"), hRc);
  58. goto Cleanup;
  59. }
  60. Cleanup:
  61. return(hRc);
  62. }
  63. /*
  64. - CFaxInboundRoutingNode::PopulateScopeChildrenList
  65. -
  66. * Purpose:
  67. * Create all the Fax Meesages nodes:
  68. * Inbox, Outbox, Sent Items, Deleted Items.
  69. *
  70. * Arguments:
  71. *
  72. * Return:
  73. * OLE error code
  74. */
  75. HRESULT CFaxInboundRoutingNode::PopulateScopeChildrenList()
  76. {
  77. DEBUG_FUNCTION_NAME( _T("CFaxInboundRoutingNode::PopulateScopeChildrenList"));
  78. HRESULT hRc = S_OK;
  79. CFaxCatalogInboundRoutingMethodsNode * pMethods = NULL;
  80. //
  81. // Fax Inbound routing method catalog
  82. //
  83. pMethods = new CFaxCatalogInboundRoutingMethodsNode(this, m_pComponentData);
  84. if (!pMethods)
  85. {
  86. hRc = E_OUTOFMEMORY;
  87. NodeMsgBox(IDS_MEMORY);
  88. DebugPrintEx(
  89. DEBUG_ERR,
  90. TEXT("Out of memory"));
  91. goto Error;
  92. }
  93. else
  94. {
  95. pMethods->InitParentNode(this);
  96. pMethods->SetIcons(IMAGE_METHOD_ENABLE, IMAGE_METHOD_ENABLE);
  97. hRc = pMethods->InitDisplayName();
  98. if ( FAILED(hRc) )
  99. {
  100. DebugPrintEx(DEBUG_ERR,_T("Failed to display node name. (hRc: %08X)"), hRc);
  101. NodeMsgBox(IDS_FAILTOADD_ROUTINGRULES);
  102. goto Error;
  103. }
  104. hRc = AddChild(pMethods, &pMethods->m_scopeDataItem);
  105. if (FAILED(hRc))
  106. {
  107. DebugPrintEx(
  108. DEBUG_ERR,
  109. TEXT("Fail to add outbound routing rules node. (hRc: %08X)"),
  110. hRc);
  111. NodeMsgBox(IDS_FAILTOADD_ROUTINGRULES);
  112. goto Error;
  113. }
  114. }
  115. ATLASSERT(S_OK == hRc);
  116. goto Exit;
  117. Error:
  118. ATLASSERT(S_OK != hRc);
  119. if ( NULL != pMethods )
  120. {
  121. if (0 != pMethods->m_scopeDataItem.ID )
  122. {
  123. HRESULT hr = RemoveChild(pMethods);
  124. if (FAILED(hr))
  125. {
  126. DebugPrintEx(DEBUG_ERR,
  127. _T("Fail to RemoveChild() Methods node from node list. (hRc: %08X)"),
  128. hr);
  129. }
  130. }
  131. delete pMethods;
  132. pMethods = NULL;
  133. }
  134. // Empty the list
  135. // m_ScopeChildrenList.RemoveAll(); done from RemoveChild
  136. m_bScopeChildrenListPopulated = FALSE;
  137. Exit:
  138. return hRc;
  139. }
  140. /*
  141. - CFaxInboundRoutingNode::SetVerbs
  142. -
  143. * Purpose:
  144. * What verbs to enable/disable when this object is selected
  145. *
  146. * Arguments:
  147. * [in] pConsoleVerb - MMC ConsoleVerb interface
  148. *
  149. * Return:
  150. * OLE Error code
  151. */
  152. HRESULT CFaxInboundRoutingNode::SetVerbs(IConsoleVerb *pConsoleVerb)
  153. {
  154. HRESULT hRc = S_OK;
  155. //
  156. // We want the default verb to be expand node children
  157. //
  158. hRc = pConsoleVerb->SetDefaultVerb(MMC_VERB_OPEN);
  159. return hRc;
  160. }
  161. /*
  162. - CFaxInboundRoutingNode::OnRefresh
  163. -
  164. * Purpose:
  165. * Called when refreshing the object.
  166. *
  167. * Arguments:
  168. *
  169. * Return:
  170. * OLE error code
  171. */
  172. HRESULT
  173. CFaxInboundRoutingNode::OnRefresh(LPARAM arg,
  174. LPARAM param,
  175. IComponentData *pComponentData,
  176. IComponent * pComponent,
  177. DATA_OBJECT_TYPES type)
  178. {
  179. HRESULT hRc = S_OK;
  180. DEBUG_FUNCTION_NAME( _T("CFaxInboundRoutingNode::OnRefresh"));
  181. ATLTRACE(_T("CFaxInboundRoutingNode::OnRefresh"));
  182. //
  183. // Call the base class
  184. //
  185. hRc = CBaseFaxInboundRoutingNode::OnRefresh(arg,
  186. param,
  187. pComponentData,
  188. pComponent,
  189. type);
  190. CHECK_RETURN_VALUE_AND_PRINT_DEBUG (_T("CBaseFaxInboundRoutingNode::OnRefresh"))
  191. Cleanup:
  192. return hRc;
  193. }
  194. /*
  195. - CFaxInboundRoutingNode::InitDisplayName
  196. -
  197. * Purpose:
  198. * To load the node's Displaed-Name string.
  199. *
  200. * Arguments:
  201. *
  202. * Return:
  203. * OLE error code
  204. */
  205. HRESULT CFaxInboundRoutingNode::InitDisplayName()
  206. {
  207. DEBUG_FUNCTION_NAME(_T("CFaxInboundRoutingNode::InitDisplayName"));
  208. HRESULT hRc = S_OK;
  209. if (!m_bstrDisplayName.LoadString(_Module.GetResourceInstance(),
  210. IDS_DISPLAY_STR_INBOUNDROUTINGNODE) )
  211. {
  212. hRc = E_OUTOFMEMORY;
  213. goto Error;
  214. }
  215. ATLASSERT( S_OK == hRc);
  216. goto Exit;
  217. Error:
  218. ATLASSERT( S_OK != hRc);
  219. m_bstrDisplayName = L"";
  220. DebugPrintEx(
  221. DEBUG_ERR,
  222. TEXT("Fail to Load inbound routing node name-string."));
  223. NodeMsgBox(IDS_MEMORY);
  224. Exit:
  225. return hRc;
  226. }
  227. /*
  228. +
  229. + CFaxInboundRoutingNode::OnShowContextHelp
  230. *
  231. * Purpose:
  232. * Overrides CSnapinNode::OnShowContextHelp.
  233. *
  234. * Arguments:
  235. *
  236. * Return:
  237. - OLE error code
  238. -
  239. */
  240. HRESULT CFaxInboundRoutingNode::OnShowContextHelp(
  241. IDisplayHelp* pDisplayHelp, LPOLESTR helpFile)
  242. {
  243. return DisplayContextHelp(pDisplayHelp, helpFile, HLP_MAN_INCOM);
  244. }