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.

1781 lines
30 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. FaxSender.cpp
  5. Abstract:
  6. Implementation of Fax Sender Interface
  7. Author:
  8. Iv Garber (IvG) Apr, 2000
  9. Revision History:
  10. --*/
  11. #include "stdafx.h"
  12. #include "FaxComEx.h"
  13. #include "FaxSender.h"
  14. #include "..\..\inc\FaxUIConstants.h"
  15. //
  16. //===================== GET SENDER PROFILE =====================================
  17. //
  18. STDMETHODIMP
  19. CFaxSender::GetSenderProfile(
  20. FAX_PERSONAL_PROFILE *pSenderProfile
  21. )
  22. /*++
  23. Routine name : CFaxSender::GetSenderProfile
  24. Routine description:
  25. Fills the pSenderProfile with the data of the object.
  26. Author:
  27. Iv Garber (IvG), May, 2000
  28. Arguments:
  29. pSenderProfile [out] - the FAX_PERSONAL_PROFILE struct to fill
  30. Return Value:
  31. Standard HRESULT code
  32. --*/
  33. {
  34. HRESULT hr = S_OK;
  35. DBG_ENTER (TEXT("CFaxSender::GetSenderProfile"), hr);
  36. //
  37. // First fill the Recipient's fields
  38. //
  39. hr = m_Recipient.GetRecipientProfile(pSenderProfile);
  40. if (FAILED(hr))
  41. {
  42. CALL_FAIL(GENERAL_ERR, _T("m_Recipient.GetRecipientProfile(pSenderProfile)"), hr);
  43. return hr;
  44. }
  45. //
  46. // now add Sender's fields
  47. //
  48. pSenderProfile->lptstrCity = m_bstrCity;
  49. pSenderProfile->lptstrCompany = m_bstrCompany;
  50. pSenderProfile->lptstrCountry = m_bstrCountry;
  51. pSenderProfile->lptstrEmail = m_bstrEmail;
  52. pSenderProfile->lptstrState = m_bstrState;
  53. pSenderProfile->lptstrTitle = m_bstrTitle;
  54. pSenderProfile->lptstrTSID = m_bstrTSID;
  55. pSenderProfile->lptstrZip = m_bstrZipCode;
  56. pSenderProfile->lptstrHomePhone = m_bstrHomePhone;
  57. pSenderProfile->lptstrDepartment = m_bstrDepartment;
  58. pSenderProfile->lptstrBillingCode = m_bstrBillingCode;
  59. pSenderProfile->lptstrOfficePhone = m_bstrOfficePhone;
  60. pSenderProfile->lptstrOfficeLocation = m_bstrOfficeLocation;
  61. pSenderProfile->lptstrStreetAddress = m_bstrStreetAddress;
  62. return hr;
  63. }
  64. //
  65. //============== PUT SENDER PROFILE ============================================
  66. //
  67. STDMETHODIMP
  68. CFaxSender::PutSenderProfile(
  69. FAX_PERSONAL_PROFILE *pSenderProfile
  70. )
  71. /*++
  72. Routine name : CFaxSender::PutSenderProfile
  73. Routine description:
  74. Receives FAX_PERSONAL_PROFILE structure and fills the Object's fields.
  75. Author:
  76. Iv Garber (IvG), May, 2000
  77. Arguments:
  78. pSenderProfile [in] - the data to put into the object's variables
  79. Return Value:
  80. Standard HRESULT code
  81. --*/
  82. {
  83. HRESULT hr = S_OK;
  84. DBG_ENTER (TEXT("CFaxSender::PutSenderProfile"), hr);
  85. //
  86. // First put the Recipient fields
  87. //
  88. hr = m_Recipient.PutRecipientProfile(pSenderProfile);
  89. if (FAILED(hr))
  90. {
  91. //
  92. // PutRecipientProfile handles the error case
  93. //
  94. CALL_FAIL(GENERAL_ERR, _T("m_Recipient.PutRecipientProfile(pSenderProfile)"), hr);
  95. return hr;
  96. }
  97. //
  98. // Now set Sender's fields
  99. //
  100. m_bstrCity = pSenderProfile->lptstrCity;
  101. m_bstrCompany = pSenderProfile->lptstrCompany;
  102. m_bstrCountry = pSenderProfile->lptstrCountry;
  103. m_bstrEmail = pSenderProfile->lptstrEmail;
  104. m_bstrHomePhone = pSenderProfile->lptstrHomePhone;
  105. m_bstrState = pSenderProfile->lptstrState;
  106. m_bstrZipCode = pSenderProfile->lptstrZip;
  107. m_bstrTitle = pSenderProfile->lptstrTitle;
  108. m_bstrTSID = pSenderProfile->lptstrTSID;
  109. m_bstrBillingCode = pSenderProfile->lptstrBillingCode;
  110. m_bstrDepartment = pSenderProfile->lptstrDepartment;
  111. m_bstrStreetAddress = pSenderProfile->lptstrStreetAddress;
  112. m_bstrOfficePhone = pSenderProfile->lptstrOfficePhone;
  113. m_bstrOfficeLocation = pSenderProfile->lptstrOfficeLocation;
  114. if ((pSenderProfile->lptstrCity && !m_bstrCity) ||
  115. (pSenderProfile->lptstrCompany && !m_bstrCompany) ||
  116. (pSenderProfile->lptstrCountry && !m_bstrCountry) ||
  117. (pSenderProfile->lptstrEmail && !m_bstrEmail) ||
  118. (pSenderProfile->lptstrHomePhone && !m_bstrHomePhone) ||
  119. (pSenderProfile->lptstrState && !m_bstrState) ||
  120. (pSenderProfile->lptstrZip && !m_bstrZipCode) ||
  121. (pSenderProfile->lptstrTSID && !m_bstrTSID) ||
  122. (pSenderProfile->lptstrBillingCode && !m_bstrBillingCode) ||
  123. (pSenderProfile->lptstrDepartment && !m_bstrDepartment) ||
  124. (pSenderProfile->lptstrStreetAddress && !m_bstrStreetAddress) ||
  125. (pSenderProfile->lptstrOfficePhone && !m_bstrOfficePhone) ||
  126. (pSenderProfile->lptstrOfficeLocation && !m_bstrOfficeLocation))
  127. {
  128. //
  129. // Not enough memory
  130. //
  131. hr = E_OUTOFMEMORY;
  132. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator=()"), hr);
  133. }
  134. return hr;
  135. }
  136. //
  137. //==================== DEFAULT SENDER ===================================
  138. //
  139. STDMETHODIMP
  140. CFaxSender::LoadDefaultSender (
  141. )
  142. /*++
  143. Routine name : CFaxSender::LoadDefaultSender
  144. Routine description:
  145. Load Default Sender Information from the local Registry
  146. Author:
  147. Iv Garber (IvG), Apr, 2000
  148. Arguments:
  149. NONE
  150. Return Value:
  151. Standard HRESULT code
  152. --*/
  153. {
  154. FAX_PERSONAL_PROFILE DefaultSenderProfile;
  155. HRESULT hr;
  156. DBG_ENTER (TEXT("CFaxSender::LoadDefaultSender"), hr);
  157. DefaultSenderProfile.dwSizeOfStruct = sizeof(FAX_PERSONAL_PROFILE);
  158. hr = FaxGetSenderInformation(&DefaultSenderProfile);
  159. if (FAILED(hr))
  160. {
  161. //
  162. // Failed to get Sender Information
  163. //
  164. AtlReportError(CLSID_FaxSender,
  165. GetErrorMsgId(hr),
  166. IID_IFaxSender,
  167. hr);
  168. CALL_FAIL(GENERAL_ERR, _T("FaxGetSenderInformation()"), hr);
  169. return hr;
  170. }
  171. hr = PutSenderProfile(&DefaultSenderProfile);
  172. if (FAILED(hr))
  173. {
  174. //
  175. // Not Enough Memory
  176. //
  177. AtlReportError(CLSID_FaxSender,
  178. IDS_ERROR_OUTOFMEMORY,
  179. IID_IFaxSender,
  180. hr);
  181. //
  182. // no return, we still need to free information
  183. //
  184. }
  185. HRESULT hr1 = FaxFreeSenderInformation(&DefaultSenderProfile);
  186. if (FAILED(hr1))
  187. {
  188. hr = hr1;
  189. CALL_FAIL(GENERAL_ERR, _T("FaxFreeSenderInformation()"), hr);
  190. return hr;
  191. }
  192. return hr;
  193. }
  194. //
  195. // SaveAs
  196. //
  197. STDMETHODIMP
  198. CFaxSender::SaveDefaultSender (
  199. )
  200. /*++
  201. Routine name : CFaxSender::SaveDefaultSender
  202. Routine description:
  203. Save current Profile as the Default in the Local Registry
  204. Author:
  205. Iv Garber (IvG), Apr, 2000
  206. Arguments:
  207. NONE
  208. Return Value:
  209. Standard HRESULT code
  210. --*/
  211. {
  212. FAX_PERSONAL_PROFILE DefaultSenderProfile;
  213. HRESULT hr;
  214. DBG_ENTER (TEXT("CFaxSender::SaveDefaultSender"), hr);
  215. hr = GetSenderProfile(&DefaultSenderProfile);
  216. ATLASSERT(SUCCEEDED(hr));
  217. hr = FaxSetSenderInformation(&DefaultSenderProfile);
  218. if (FAILED(hr))
  219. {
  220. AtlReportError(CLSID_FaxSender,
  221. GetErrorMsgId(hr),
  222. IID_IFaxSender,
  223. hr);
  224. CALL_FAIL(GENERAL_ERR, _T("FaxSetSenderInformation()"), hr);
  225. return hr;
  226. }
  227. return hr;
  228. }
  229. //
  230. //==================== INTERFACE SUPPORT ERROR INFO =====================
  231. //
  232. STDMETHODIMP
  233. CFaxSender::InterfaceSupportsErrorInfo (
  234. REFIID riid
  235. )
  236. /*++
  237. Routine name : CFaxSender::InterfaceSupportsErrorInfo
  238. Routine description:
  239. ATL's implementation of Support Error Info
  240. Author:
  241. Iv Garber (IvG), Apr, 2000
  242. Arguments:
  243. riid [in] - Interface ID
  244. Return Value:
  245. Standard HRESULT code
  246. --*/
  247. {
  248. static const IID* arr[] =
  249. {
  250. &IID_IFaxSender
  251. };
  252. for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
  253. {
  254. if (InlineIsEqualGUID(*arr[i],riid))
  255. return S_OK;
  256. }
  257. return S_FALSE;
  258. }
  259. //
  260. //==================== CREATE ========================================
  261. //
  262. HRESULT
  263. CFaxSender::Create (
  264. IFaxSender **ppSender
  265. )
  266. /*++
  267. Routine name : CFaxSender::Create
  268. Routine description:
  269. Static function to create the Fax Sender Instance
  270. Author:
  271. Iv Garber (IvG), Apr, 2000
  272. Arguments:
  273. ppSender [out] -- the new Fax Sender Instance
  274. Return Value:
  275. Standard HRESULT code
  276. --*/
  277. {
  278. CComObject<CFaxSender> *pClass;
  279. HRESULT hr = S_OK;
  280. DBG_ENTER (TEXT("CFaxSender::Create"), hr);
  281. hr = CComObject<CFaxSender>::CreateInstance(&pClass);
  282. if (FAILED(hr))
  283. {
  284. //
  285. // Failed to create Instance
  286. //
  287. CALL_FAIL(GENERAL_ERR, _T("CComObject<CFaxSender>::CreateInstance()"), hr);
  288. return hr;
  289. }
  290. hr = pClass->QueryInterface(__uuidof(IFaxSender), (void **) ppSender);
  291. if (FAILED(hr))
  292. {
  293. CALL_FAIL(GENERAL_ERR, _T("QueryInterface()"), hr);
  294. return hr;
  295. }
  296. return hr;
  297. }
  298. //
  299. //==================== BILLING CODE ========================================
  300. //
  301. STDMETHODIMP
  302. CFaxSender::get_BillingCode(
  303. BSTR *pbstrBillingCode
  304. )
  305. /*++
  306. Routine name : CFaxSender::get_BillingCode
  307. Routine description:
  308. return Billing Code
  309. Author:
  310. Iv Garber (IvG), Apr, 2000
  311. Arguments:
  312. pbstrBillingCode [out] - the Billing Code
  313. Return Value:
  314. Standard HRESULT code
  315. --*/
  316. {
  317. HRESULT hr = S_OK;
  318. DBG_ENTER (TEXT("CFaxSender::get_BillingCode"), hr);
  319. hr = GetBstr(pbstrBillingCode, m_bstrBillingCode);
  320. if (FAILED(hr))
  321. {
  322. AtlReportError(CLSID_FaxSender, GetErrorMsgId(hr), IID_IFaxSender, hr);
  323. return hr;
  324. }
  325. return hr;
  326. }
  327. STDMETHODIMP
  328. CFaxSender::put_BillingCode (
  329. BSTR bstrBillingCode
  330. )
  331. /*++
  332. Routine name : CFaxSender::put_BillingCode
  333. Routine description:
  334. Set Billing Code
  335. Author:
  336. Iv Garber (IvG), Apr, 2000
  337. Arguments:
  338. bstrBillingCode [in] - new Billing Code value
  339. Return Value:
  340. Standard HRESULT code
  341. --*/
  342. {
  343. HRESULT hr = S_OK;
  344. DBG_ENTER (_T("CFaxSender::put_BillingCode"),
  345. hr,
  346. _T("%s"),
  347. bstrBillingCode);
  348. m_bstrBillingCode = bstrBillingCode;
  349. if (bstrBillingCode && !m_bstrBillingCode)
  350. {
  351. //
  352. // Not enough memory
  353. //
  354. hr = E_OUTOFMEMORY;
  355. AtlReportError(CLSID_FaxSender,
  356. IDS_ERROR_OUTOFMEMORY,
  357. IID_IFaxSender,
  358. hr);
  359. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  360. return hr;
  361. }
  362. return hr;
  363. }
  364. //
  365. //==================== CITY ========================================
  366. //
  367. STDMETHODIMP
  368. CFaxSender::get_City(
  369. BSTR *pbstrCity
  370. )
  371. /*++
  372. Routine name : CFaxSender::get_City
  373. Routine description:
  374. return City
  375. Author:
  376. Iv Garber (IvG), Apr, 2000
  377. Arguments:
  378. pbstrCity [out] - the City
  379. Return Value:
  380. Standard HRESULT code
  381. --*/
  382. {
  383. HRESULT hr = S_OK;
  384. DBG_ENTER (TEXT("CFaxSender::get_City"), hr);
  385. hr = GetBstr(pbstrCity, m_bstrCity);
  386. if (FAILED(hr))
  387. {
  388. AtlReportError(CLSID_FaxSender, GetErrorMsgId(hr), IID_IFaxSender, hr);
  389. return hr;
  390. }
  391. return hr;
  392. }
  393. STDMETHODIMP
  394. CFaxSender::put_City (
  395. BSTR bstrCity
  396. )
  397. /*++
  398. Routine name : CFaxSender::put_City
  399. Routine description:
  400. Set City
  401. Author:
  402. Iv Garber (IvG), Apr, 2000
  403. Arguments:
  404. bstrCity [in] - new City value
  405. Return Value:
  406. Standard HRESULT code
  407. --*/
  408. {
  409. HRESULT hr = S_OK;
  410. DBG_ENTER (_T("CFaxSender::put_City"), hr, _T("%s"), bstrCity);
  411. m_bstrCity = bstrCity;
  412. if (!m_bstrCity && bstrCity)
  413. {
  414. //
  415. // Not enough memory
  416. //
  417. hr = E_OUTOFMEMORY;
  418. AtlReportError(CLSID_FaxSender,
  419. IDS_ERROR_OUTOFMEMORY,
  420. IID_IFaxSender,
  421. hr);
  422. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  423. return hr;
  424. }
  425. return hr;
  426. }
  427. //
  428. //==================== COMPANY ========================================
  429. //
  430. STDMETHODIMP
  431. CFaxSender::get_Company(
  432. BSTR *pbstrCompany
  433. )
  434. /*++
  435. Routine name : CFaxSender::get_Company
  436. Routine description:
  437. return Company
  438. Author:
  439. Iv Garber (IvG), Apr, 2000
  440. Arguments:
  441. pbstrCompany [out] - the Company
  442. Return Value:
  443. Standard HRESULT code
  444. --*/
  445. {
  446. HRESULT hr = S_OK;
  447. DBG_ENTER (TEXT("CFaxSender::get_Company"), hr);
  448. hr = GetBstr(pbstrCompany, m_bstrCompany);
  449. if (FAILED(hr))
  450. {
  451. AtlReportError(CLSID_FaxSender, GetErrorMsgId(hr), IID_IFaxSender, hr);
  452. return hr;
  453. }
  454. return hr;
  455. }
  456. STDMETHODIMP
  457. CFaxSender::put_Company (
  458. BSTR bstrCompany
  459. )
  460. /*++
  461. Routine name : CFaxSender::put_Company
  462. Routine description:
  463. Set Company
  464. Author:
  465. Iv Garber (IvG), Apr, 2000
  466. Arguments:
  467. bstrCompany [in] - new Company value
  468. Return Value:
  469. Standard HRESULT code
  470. --*/
  471. {
  472. HRESULT hr = S_OK;
  473. DBG_ENTER (_T("CFaxSender::put_Company"), hr, _T("%s"), bstrCompany);
  474. m_bstrCompany = bstrCompany;
  475. if (!m_bstrCompany && bstrCompany)
  476. {
  477. //
  478. // Not enough memory
  479. //
  480. hr = E_OUTOFMEMORY;
  481. AtlReportError(CLSID_FaxSender, IDS_ERROR_OUTOFMEMORY, IID_IFaxSender, hr);
  482. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  483. return hr;
  484. }
  485. return hr;
  486. }
  487. //
  488. //==================== COUNTRY ========================================
  489. //
  490. STDMETHODIMP
  491. CFaxSender::get_Country(
  492. BSTR *pbstrCountry
  493. )
  494. /*++
  495. Routine name : CFaxSender::get_Country
  496. Routine description:
  497. return Country
  498. Author:
  499. Iv Garber (IvG), Apr, 2000
  500. Arguments:
  501. pbstrCountry [out] - the Country
  502. Return Value:
  503. Standard HRESULT code
  504. --*/
  505. {
  506. HRESULT hr = S_OK;
  507. DBG_ENTER (TEXT("CFaxSender::get_Country"), hr);
  508. hr = GetBstr(pbstrCountry, m_bstrCountry);
  509. if (FAILED(hr))
  510. {
  511. AtlReportError(CLSID_FaxSender, GetErrorMsgId(hr), IID_IFaxSender, hr);
  512. return hr;
  513. }
  514. return hr;
  515. }
  516. STDMETHODIMP
  517. CFaxSender::put_Country (
  518. BSTR bstrCountry
  519. )
  520. /*++
  521. Routine name : CFaxSender::put_Country
  522. Routine description:
  523. Set Country
  524. Author:
  525. Iv Garber (IvG), Apr, 2000
  526. Arguments:
  527. bstrCountry [in] - new Country value
  528. Return Value:
  529. Standard HRESULT code
  530. --*/
  531. {
  532. HRESULT hr = S_OK;
  533. DBG_ENTER (_T("CFaxSender::put_Country"), hr, _T("%s"), bstrCountry);
  534. m_bstrCountry = bstrCountry;
  535. if (!m_bstrCountry && bstrCountry)
  536. {
  537. //
  538. // Not enough memory
  539. //
  540. hr = E_OUTOFMEMORY;
  541. AtlReportError(CLSID_FaxSender,
  542. IDS_ERROR_OUTOFMEMORY,
  543. IID_IFaxSender,
  544. hr);
  545. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  546. return hr;
  547. }
  548. return hr;
  549. }
  550. //
  551. //==================== DEPARTMENT ========================================
  552. //
  553. STDMETHODIMP
  554. CFaxSender::get_Department(
  555. BSTR *pbstrDepartment
  556. )
  557. /*++
  558. Routine name : CFaxSender::get_Department
  559. Routine description:
  560. return Department
  561. Author:
  562. Iv Garber (IvG), Apr, 2000
  563. Arguments:
  564. pbstrDepartment [out] - the Department
  565. Return Value:
  566. Standard HRESULT code
  567. --*/
  568. {
  569. HRESULT hr = S_OK;
  570. DBG_ENTER (TEXT("CFaxSender::get_Department"), hr);
  571. hr = GetBstr(pbstrDepartment, m_bstrDepartment);
  572. if (FAILED(hr))
  573. {
  574. AtlReportError(CLSID_FaxSender, GetErrorMsgId(hr), IID_IFaxSender, hr);
  575. return hr;
  576. }
  577. return hr;
  578. }
  579. STDMETHODIMP
  580. CFaxSender::put_Department (
  581. BSTR bstrDepartment
  582. )
  583. /*++
  584. Routine name : CFaxSender::put_Department
  585. Routine description:
  586. Set Department
  587. Author:
  588. Iv Garber (IvG), Apr, 2000
  589. Arguments:
  590. bstrDepartment [in] - new Department value
  591. Return Value:
  592. Standard HRESULT code
  593. --*/
  594. {
  595. HRESULT hr = S_OK;
  596. DBG_ENTER (_T("CFaxSender::put_Department"), hr, _T("%s"), bstrDepartment);
  597. m_bstrDepartment = bstrDepartment;
  598. if (!m_bstrDepartment && bstrDepartment)
  599. {
  600. //
  601. // Not enough memory
  602. //
  603. hr = E_OUTOFMEMORY;
  604. AtlReportError(CLSID_FaxSender,
  605. IDS_ERROR_OUTOFMEMORY,
  606. IID_IFaxSender,
  607. hr);
  608. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  609. return hr;
  610. }
  611. return hr;
  612. }
  613. //
  614. //==================== EMAIL ========================================
  615. //
  616. STDMETHODIMP
  617. CFaxSender::get_Email(
  618. BSTR *pbstrEmail
  619. )
  620. /*++
  621. Routine name : CFaxSender::get_Email
  622. Routine description:
  623. return Email
  624. Author:
  625. Iv Garber (IvG), Apr, 2000
  626. Arguments:
  627. pbstrEmail [out] - the Email
  628. Return Value:
  629. Standard HRESULT code
  630. --*/
  631. {
  632. HRESULT hr = S_OK;
  633. DBG_ENTER (TEXT("CFaxSender::get_Email"), hr);
  634. hr = GetBstr(pbstrEmail, m_bstrEmail);
  635. if (FAILED(hr))
  636. {
  637. AtlReportError(CLSID_FaxSender, GetErrorMsgId(hr), IID_IFaxSender, hr);
  638. return hr;
  639. }
  640. return hr;
  641. }
  642. STDMETHODIMP
  643. CFaxSender::put_Email (
  644. BSTR bstrEmail
  645. )
  646. /*++
  647. Routine name : CFaxSender::put_Email
  648. Routine description:
  649. Set Email
  650. Author:
  651. Iv Garber (IvG), Apr, 2000
  652. Arguments:
  653. bstrEmail [in] - new Email value
  654. Return Value:
  655. Standard HRESULT code
  656. --*/
  657. {
  658. HRESULT hr = S_OK;
  659. DBG_ENTER (_T("CFaxSender::put_Email"), hr, _T("%s"), bstrEmail);
  660. m_bstrEmail = bstrEmail;
  661. if (!m_bstrEmail && bstrEmail)
  662. {
  663. //
  664. // Not enough memory
  665. //
  666. hr = E_OUTOFMEMORY;
  667. AtlReportError(CLSID_FaxSender,
  668. IDS_ERROR_OUTOFMEMORY,
  669. IID_IFaxSender,
  670. hr);
  671. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  672. return hr;
  673. }
  674. return hr;
  675. }
  676. //
  677. //==================== HOME PHONE ========================================
  678. //
  679. STDMETHODIMP
  680. CFaxSender::get_HomePhone(
  681. BSTR *pbstrHomePhone
  682. )
  683. /*++
  684. Routine name : CFaxSender::get_HomePhone
  685. Routine description:
  686. return HomePhone
  687. Author:
  688. Iv Garber (IvG), Apr, 2000
  689. Arguments:
  690. pbstrHomePhone [out] - the HomePhone
  691. Return Value:
  692. Standard HRESULT code
  693. --*/
  694. {
  695. HRESULT hr = S_OK;
  696. DBG_ENTER (TEXT("CFaxSender::get_HomePhone"), hr);
  697. hr = GetBstr(pbstrHomePhone, m_bstrHomePhone);
  698. if (FAILED(hr))
  699. {
  700. AtlReportError(CLSID_FaxSender, GetErrorMsgId(hr), IID_IFaxSender, hr);
  701. return hr;
  702. }
  703. return hr;
  704. }
  705. STDMETHODIMP
  706. CFaxSender::put_HomePhone (
  707. BSTR bstrHomePhone
  708. )
  709. /*++
  710. Routine name : CFaxSender::put_HomePhone
  711. Routine description:
  712. Set HomePhone
  713. Author:
  714. Iv Garber (IvG), Apr, 2000
  715. Arguments:
  716. bstrHomePhone [in] - new HomePhone
  717. Return Value:
  718. Standard HRESULT code
  719. --*/
  720. {
  721. HRESULT hr = S_OK;
  722. DBG_ENTER (_T("CFaxSender::put_HomePhone"), hr, _T("%s"), bstrHomePhone);
  723. m_bstrHomePhone = bstrHomePhone;
  724. if (!m_bstrHomePhone && bstrHomePhone)
  725. {
  726. //
  727. // Not enough memory
  728. //
  729. hr = E_OUTOFMEMORY;
  730. AtlReportError(CLSID_FaxSender,
  731. IDS_ERROR_OUTOFMEMORY,
  732. IID_IFaxSender,
  733. hr);
  734. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  735. return hr;
  736. }
  737. return hr;
  738. }
  739. //
  740. //==================== TSID ========================================
  741. //
  742. STDMETHODIMP
  743. CFaxSender::get_TSID(
  744. BSTR *pbstrTSID
  745. )
  746. /*++
  747. Routine name : CFaxSender::get_TSID
  748. Routine description:
  749. return TSID
  750. Author:
  751. Iv Garber (IvG), Apr, 2000
  752. Arguments:
  753. pbstrTSID [out] - the TSID
  754. Return Value:
  755. Standard HRESULT code
  756. --*/
  757. {
  758. HRESULT hr = S_OK;
  759. DBG_ENTER (TEXT("CFaxSender::get_TSID"), hr);
  760. hr = GetBstr(pbstrTSID, m_bstrTSID);
  761. if (FAILED(hr))
  762. {
  763. AtlReportError(CLSID_FaxSender, GetErrorMsgId(hr), IID_IFaxSender, hr);
  764. return hr;
  765. }
  766. return hr;
  767. }
  768. STDMETHODIMP
  769. CFaxSender::put_TSID (
  770. BSTR bstrTSID
  771. )
  772. /*++
  773. Routine name : CFaxSender::put_TSID
  774. Routine description:
  775. Set TSID
  776. Author:
  777. Iv Garber (IvG), Apr, 2000
  778. Arguments:
  779. bstrTSID [in] - new TSID
  780. Return Value:
  781. Standard HRESULT code
  782. --*/
  783. {
  784. HRESULT hr = S_OK;
  785. DBG_ENTER (_T("CFaxSender::put_TSID"), hr, _T("%s"), bstrTSID);
  786. if (SysStringLen(bstrTSID) > FXS_TSID_CSID_MAX_LENGTH)
  787. {
  788. //
  789. // Out of the Range
  790. //
  791. hr = E_INVALIDARG;
  792. AtlReportError(CLSID_FaxSender, IDS_ERROR_OUTOFRANGE, IID_IFaxSender, hr);
  793. CALL_FAIL(GENERAL_ERR, _T("TSID is too long"), hr);
  794. return hr;
  795. }
  796. m_bstrTSID = bstrTSID;
  797. if (!m_bstrTSID && bstrTSID)
  798. {
  799. //
  800. // Not enough memory
  801. //
  802. hr = E_OUTOFMEMORY;
  803. AtlReportError(CLSID_FaxSender,
  804. IDS_ERROR_OUTOFMEMORY,
  805. IID_IFaxSender,
  806. hr);
  807. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  808. return hr;
  809. }
  810. return hr;
  811. }
  812. //
  813. //==================== OFFICE PHONE ========================================
  814. //
  815. STDMETHODIMP
  816. CFaxSender::get_OfficePhone(
  817. BSTR *pbstrOfficePhone
  818. )
  819. /*++
  820. Routine name : CFaxSender::get_OfficePhone
  821. Routine description:
  822. return OfficePhone
  823. Author:
  824. Iv Garber (IvG), Apr, 2000
  825. Arguments:
  826. pbstrOfficePhone [out] - the OfficePhone
  827. Return Value:
  828. Standard HRESULT code
  829. --*/
  830. {
  831. HRESULT hr = S_OK;
  832. DBG_ENTER (TEXT("CFaxSender::get_OfficePhone"), hr);
  833. hr = GetBstr(pbstrOfficePhone, m_bstrOfficePhone);
  834. if (FAILED(hr))
  835. {
  836. AtlReportError(CLSID_FaxSender, GetErrorMsgId(hr), IID_IFaxSender, hr);
  837. return hr;
  838. }
  839. return hr;
  840. }
  841. STDMETHODIMP
  842. CFaxSender::put_OfficePhone (
  843. BSTR bstrOfficePhone
  844. )
  845. /*++
  846. Routine name : CFaxSender::put_OfficePhone
  847. Routine description:
  848. Set OfficePhone
  849. Author:
  850. Iv Garber (IvG), Apr, 2000
  851. Arguments:
  852. bstrOfficePhone [in] - new OfficePhone
  853. Return Value:
  854. Standard HRESULT code
  855. --*/
  856. {
  857. HRESULT hr = S_OK;
  858. DBG_ENTER (_T("CFaxSender::put_OfficePhone"), hr, _T("%s"), bstrOfficePhone);
  859. m_bstrOfficePhone = bstrOfficePhone;
  860. if (!m_bstrOfficePhone && bstrOfficePhone)
  861. {
  862. //
  863. // Not enough memory
  864. //
  865. hr = E_OUTOFMEMORY;
  866. AtlReportError(CLSID_FaxSender,
  867. IDS_ERROR_OUTOFMEMORY,
  868. IID_IFaxSender,
  869. hr);
  870. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  871. return hr;
  872. }
  873. return hr;
  874. }
  875. //
  876. //==================== OFFICE LOCATION ========================================
  877. //
  878. STDMETHODIMP
  879. CFaxSender::get_OfficeLocation(
  880. BSTR *pbstrOfficeLocation
  881. )
  882. /*++
  883. Routine name : CFaxSender::get_OfficeLocation
  884. Routine description:
  885. return OfficeLocation
  886. Author:
  887. Iv Garber (IvG), Apr, 2000
  888. Arguments:
  889. pbstrOfficeLocation [out] - the OfficeLocation
  890. Return Value:
  891. Standard HRESULT code
  892. --*/
  893. {
  894. HRESULT hr = S_OK;
  895. DBG_ENTER (TEXT("CFaxSender::get_OfficeLocation"), hr);
  896. hr = GetBstr(pbstrOfficeLocation, m_bstrOfficeLocation);
  897. if (FAILED(hr))
  898. {
  899. AtlReportError(CLSID_FaxSender, GetErrorMsgId(hr), IID_IFaxSender, hr);
  900. return hr;
  901. }
  902. return hr;
  903. }
  904. STDMETHODIMP
  905. CFaxSender::put_OfficeLocation (
  906. BSTR bstrOfficeLocation
  907. )
  908. /*++
  909. Routine name : CFaxSender::put_OfficeLocation
  910. Routine description:
  911. Set OfficeLocation
  912. Author:
  913. Iv Garber (IvG), Apr, 2000
  914. Arguments:
  915. bstrOfficeLocation [in] - new OfficeLocation
  916. Return Value:
  917. Standard HRESULT code
  918. --*/
  919. {
  920. HRESULT hr = S_OK;
  921. DBG_ENTER (_T("CFaxSender::put_OfficeLocation"), hr, _T("%s"), bstrOfficeLocation);
  922. m_bstrOfficeLocation = bstrOfficeLocation;
  923. if (!m_bstrOfficeLocation && bstrOfficeLocation)
  924. {
  925. //
  926. // Not enough memory
  927. //
  928. hr = E_OUTOFMEMORY;
  929. AtlReportError(CLSID_FaxSender,
  930. IDS_ERROR_OUTOFMEMORY,
  931. IID_IFaxSender,
  932. hr);
  933. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  934. return hr;
  935. }
  936. return hr;
  937. }
  938. //
  939. //==================== STATE ========================================
  940. //
  941. STDMETHODIMP
  942. CFaxSender::get_State(
  943. BSTR *pbstrState
  944. )
  945. /*++
  946. Routine name : CFaxSender::get_State
  947. Routine description:
  948. return State
  949. Author:
  950. Iv Garber (IvG), Apr, 2000
  951. Arguments:
  952. pbstrState [out] - the State
  953. Return Value:
  954. Standard HRESULT code
  955. --*/
  956. {
  957. HRESULT hr = S_OK;
  958. DBG_ENTER (TEXT("CFaxSender::get_State"), hr);
  959. hr = GetBstr(pbstrState, m_bstrState);
  960. if (FAILED(hr))
  961. {
  962. AtlReportError(CLSID_FaxSender, GetErrorMsgId(hr), IID_IFaxSender, hr);
  963. return hr;
  964. }
  965. return hr;
  966. }
  967. STDMETHODIMP
  968. CFaxSender::put_State (
  969. BSTR bstrState
  970. )
  971. /*++
  972. Routine name : CFaxSender::put_State
  973. Routine description:
  974. Set State
  975. Author:
  976. Iv Garber (IvG), Apr, 2000
  977. Arguments:
  978. bstrState [in] - new State
  979. Return Value:
  980. Standard HRESULT code
  981. --*/
  982. {
  983. HRESULT hr = S_OK;
  984. DBG_ENTER (_T("CFaxSender::put_State"), hr, _T("%s"), bstrState);
  985. m_bstrState = bstrState;
  986. if (!m_bstrState && bstrState)
  987. {
  988. //
  989. // Not enough memory
  990. //
  991. hr = E_OUTOFMEMORY;
  992. AtlReportError(CLSID_FaxSender,
  993. IDS_ERROR_OUTOFMEMORY,
  994. IID_IFaxSender,
  995. hr);
  996. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  997. return hr;
  998. }
  999. return hr;
  1000. }
  1001. //
  1002. //==================== STREET ADDRESS ========================================
  1003. //
  1004. STDMETHODIMP
  1005. CFaxSender::get_StreetAddress (
  1006. BSTR *pbstrStreetAddress
  1007. )
  1008. /*++
  1009. Routine name : CFaxSender::get_StreetAddress
  1010. Routine description:
  1011. return StreetAddress
  1012. Author:
  1013. Iv Garber (IvG), Apr, 2000
  1014. Arguments:
  1015. pbstrStreetAddress [out] - the StreetAddress
  1016. Return Value:
  1017. Standard HRESULT code
  1018. --*/
  1019. {
  1020. HRESULT hr = S_OK;
  1021. DBG_ENTER (TEXT("CFaxSender::get_StreetAddress"), hr);
  1022. hr = GetBstr(pbstrStreetAddress, m_bstrStreetAddress);
  1023. if (FAILED(hr))
  1024. {
  1025. AtlReportError(CLSID_FaxSender, GetErrorMsgId(hr), IID_IFaxSender, hr);
  1026. return hr;
  1027. }
  1028. return hr;
  1029. }
  1030. STDMETHODIMP
  1031. CFaxSender::put_StreetAddress (
  1032. BSTR bstrStreetAddress
  1033. )
  1034. /*++
  1035. Routine name : CFaxSender::put_StreetAddress
  1036. Routine description:
  1037. Set StreetAddress
  1038. Author:
  1039. Iv Garber (IvG), Apr, 2000
  1040. Arguments:
  1041. bstrStreetAddress [in] - new StreetAddress
  1042. Return Value:
  1043. Standard HRESULT code
  1044. --*/
  1045. {
  1046. HRESULT hr = S_OK;
  1047. DBG_ENTER (_T("CFaxSender::put_StreetAddress"), hr, _T("%s"), bstrStreetAddress);
  1048. m_bstrStreetAddress = bstrStreetAddress;
  1049. if (!m_bstrStreetAddress && bstrStreetAddress)
  1050. {
  1051. //
  1052. // Not enough memory
  1053. //
  1054. hr = E_OUTOFMEMORY;
  1055. AtlReportError(CLSID_FaxSender,
  1056. IDS_ERROR_OUTOFMEMORY,
  1057. IID_IFaxSender,
  1058. hr);
  1059. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  1060. return hr;
  1061. }
  1062. return hr;
  1063. }
  1064. //
  1065. //==================== TITLE ========================================
  1066. //
  1067. STDMETHODIMP
  1068. CFaxSender::get_Title (
  1069. BSTR *pbstrTitle
  1070. )
  1071. /*++
  1072. Routine name : CFaxSender::get_Title
  1073. Routine description:
  1074. return Title
  1075. Author:
  1076. Iv Garber (IvG), Apr, 2000
  1077. Arguments:
  1078. pbstrTitle [out] - the Title
  1079. Return Value:
  1080. Standard HRESULT code
  1081. --*/
  1082. {
  1083. HRESULT hr = S_OK;
  1084. DBG_ENTER (TEXT("CFaxSender::get_Title"), hr);
  1085. hr = GetBstr(pbstrTitle, m_bstrTitle);
  1086. if (FAILED(hr))
  1087. {
  1088. AtlReportError(CLSID_FaxSender, GetErrorMsgId(hr), IID_IFaxSender, hr);
  1089. return hr;
  1090. }
  1091. return hr;
  1092. }
  1093. STDMETHODIMP
  1094. CFaxSender::put_Title (
  1095. BSTR bstrTitle
  1096. )
  1097. /*++
  1098. Routine name : CFaxSender::put_Title
  1099. Routine description:
  1100. Set Title
  1101. Author:
  1102. Iv Garber (IvG), Apr, 2000
  1103. Arguments:
  1104. bstrTitle [in] - new Title
  1105. Return Value:
  1106. Standard HRESULT code
  1107. --*/
  1108. {
  1109. HRESULT hr = S_OK;
  1110. DBG_ENTER (_T("CFaxSender::put_Title"), hr, _T("%s"), bstrTitle);
  1111. m_bstrTitle = bstrTitle;
  1112. if (!m_bstrTitle && bstrTitle)
  1113. {
  1114. //
  1115. // Not enough memory
  1116. //
  1117. hr = E_OUTOFMEMORY;
  1118. AtlReportError(CLSID_FaxSender,
  1119. IDS_ERROR_OUTOFMEMORY,
  1120. IID_IFaxSender,
  1121. hr);
  1122. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  1123. return hr;
  1124. }
  1125. return hr;
  1126. }
  1127. //
  1128. //==================== ZIP CODE ========================================
  1129. //
  1130. STDMETHODIMP
  1131. CFaxSender::get_ZipCode (
  1132. BSTR *pbstrZipCode
  1133. )
  1134. /*++
  1135. Routine name : CFaxSender::get_ZipCode
  1136. Routine description:
  1137. return ZipCode
  1138. Author:
  1139. Iv Garber (IvG), Apr, 2000
  1140. Arguments:
  1141. pbstrZipCode [out] - the ZipCode
  1142. Return Value:
  1143. Standard HRESULT code
  1144. --*/
  1145. {
  1146. HRESULT hr = S_OK;
  1147. DBG_ENTER (TEXT("CFaxSender::get_ZipCode"), hr);
  1148. hr = GetBstr(pbstrZipCode, m_bstrZipCode);
  1149. if (FAILED(hr))
  1150. {
  1151. AtlReportError(CLSID_FaxSender, GetErrorMsgId(hr), IID_IFaxSender, hr);
  1152. return hr;
  1153. }
  1154. return hr;
  1155. }
  1156. STDMETHODIMP
  1157. CFaxSender::put_ZipCode (
  1158. BSTR bstrZipCode
  1159. )
  1160. /*++
  1161. Routine name : CFaxSender::put_ZipCode
  1162. Routine description:
  1163. Set ZipCode
  1164. Author:
  1165. Iv Garber (IvG), Apr, 2000
  1166. Arguments:
  1167. bstrZipCode [in] - new ZipCode
  1168. Return Value:
  1169. Standard HRESULT code
  1170. --*/
  1171. {
  1172. HRESULT hr = S_OK;
  1173. DBG_ENTER (_T("CFaxSender::put_ZipCode"), hr, _T("%s"), bstrZipCode);
  1174. m_bstrZipCode = bstrZipCode;
  1175. if (!m_bstrZipCode && bstrZipCode)
  1176. {
  1177. //
  1178. // Not enough memory
  1179. //
  1180. hr = E_OUTOFMEMORY;
  1181. AtlReportError(CLSID_FaxSender,
  1182. IDS_ERROR_OUTOFMEMORY,
  1183. IID_IFaxSender,
  1184. hr);
  1185. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  1186. return hr;
  1187. }
  1188. return hr;
  1189. }
  1190. //
  1191. //==================== FAX NUMBER ========================================
  1192. //
  1193. STDMETHODIMP
  1194. CFaxSender::get_FaxNumber(
  1195. BSTR *pbstrFaxNumber
  1196. )
  1197. /*++
  1198. Routine name : CFaxSender::get_FaxNumber
  1199. Routine description:
  1200. return FaxNumber
  1201. Author:
  1202. Iv Garber (IvG), Apr, 2000
  1203. Arguments:
  1204. pbstrFaxNumber [out] - the FaxNumber
  1205. Return Value:
  1206. Standard HRESULT code
  1207. --*/
  1208. {
  1209. HRESULT hr = S_OK;
  1210. DBG_ENTER (_T("CFaxSender::get_FaxNumber"), hr);
  1211. hr = m_Recipient.get_FaxNumber(pbstrFaxNumber);
  1212. return hr;
  1213. }
  1214. STDMETHODIMP
  1215. CFaxSender::put_FaxNumber (
  1216. BSTR bstrFaxNumber
  1217. )
  1218. /*++
  1219. Routine name : CFaxSender::put_FaxNumber
  1220. Routine description:
  1221. Set FaxNumber
  1222. Author:
  1223. Iv Garber (IvG), Apr, 2000
  1224. Arguments:
  1225. bstrFaxNumber [in] - new Fax Number
  1226. Return Value:
  1227. Standard HRESULT code
  1228. --*/
  1229. {
  1230. HRESULT hr = S_OK;
  1231. DBG_ENTER(_T("CFaxSender::put_FaxNumber"), hr, _T("%s"), bstrFaxNumber);
  1232. hr = m_Recipient.put_FaxNumber(bstrFaxNumber);
  1233. return hr;
  1234. }
  1235. //
  1236. //==================== NAME ========================================
  1237. //
  1238. STDMETHODIMP
  1239. CFaxSender::get_Name(
  1240. BSTR *pbstrName
  1241. )
  1242. /*++
  1243. Routine name : CFaxSender::get_Name
  1244. Routine description:
  1245. return Name
  1246. Author:
  1247. Iv Garber (IvG), Apr, 2000
  1248. Arguments:
  1249. pbstrName [out] - the Name
  1250. Return Value:
  1251. Standard HRESULT code
  1252. --*/
  1253. {
  1254. HRESULT hr = S_OK;
  1255. DBG_ENTER (_T("CFaxSender::get_Name"), hr);
  1256. hr = m_Recipient.get_Name(pbstrName);
  1257. return hr;
  1258. }
  1259. STDMETHODIMP
  1260. CFaxSender::put_Name (
  1261. BSTR bstrName
  1262. )
  1263. /*++
  1264. Routine name : CFaxSender::put_Name
  1265. Routine description:
  1266. Set Name
  1267. Author:
  1268. Iv Garber (IvG), Apr, 2000
  1269. Arguments:
  1270. bstrName [in] - new Name
  1271. Return Value:
  1272. Standard HRESULT code
  1273. --*/
  1274. {
  1275. HRESULT hr = S_OK;
  1276. DBG_ENTER (_T("CFaxSender::put_Name"), hr, _T("%s"), bstrName);
  1277. hr = m_Recipient.put_Name(bstrName);
  1278. return hr;
  1279. }