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.

111 lines
3.3 KiB

  1. // SMTPDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ConfigTest.h"
  5. #include "SMTPDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. typedef unsigned long ULONG_PTR, *PULONG_PTR;
  12. typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
  13. #include "..\..\..\inc\fxsapip.h"
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CSMTPDlg dialog
  16. CSMTPDlg::CSMTPDlg(HANDLE hFax, CWnd* pParent /*=NULL*/)
  17. : CDialog(CSMTPDlg::IDD, pParent), m_hFax (hFax)
  18. {
  19. //{{AFX_DATA_INIT(CSMTPDlg)
  20. m_cstrPassword = _T("");
  21. m_cstrServerName = _T("");
  22. m_dwServerPort = 0;
  23. m_cstrUserName = _T("");
  24. m_cstrMAPIProfile = _T("");
  25. m_cstrSender = _T("");
  26. m_dwReceiptsOpts = 0;
  27. m_dwSMTPAuth = 0;
  28. //}}AFX_DATA_INIT
  29. }
  30. void CSMTPDlg::DoDataExchange(CDataExchange* pDX)
  31. {
  32. CDialog::DoDataExchange(pDX);
  33. //{{AFX_DATA_MAP(CSMTPDlg)
  34. DDX_Text(pDX, IDC_EDIT_PASSWORD, m_cstrPassword);
  35. DDX_Text(pDX, IDC_EDIT_SERVER_NAME, m_cstrServerName);
  36. DDX_Text(pDX, IDC_EDIT_SERVER_PORT, m_dwServerPort);
  37. DDV_MinMaxUInt(pDX, m_dwServerPort, 1, 65535);
  38. DDX_Text(pDX, IDC_EDIT_USER_NAME, m_cstrUserName);
  39. DDX_Text(pDX, IDC_EDIT_MAPI_PROFILE, m_cstrMAPIProfile);
  40. DDX_Text(pDX, IDC_EDIT_SENDER, m_cstrSender);
  41. DDX_Text(pDX, IDC_REC_OPTIONS, m_dwReceiptsOpts);
  42. DDV_MinMaxUInt(pDX, m_dwReceiptsOpts, 0, 7);
  43. DDX_Text(pDX, IDC_SMTP_AUTH, m_dwSMTPAuth);
  44. DDV_MinMaxUInt(pDX, m_dwSMTPAuth, 0, 2);
  45. //}}AFX_DATA_MAP
  46. }
  47. BEGIN_MESSAGE_MAP(CSMTPDlg, CDialog)
  48. //{{AFX_MSG_MAP(CSMTPDlg)
  49. ON_BN_CLICKED(IDC_READ, OnRead)
  50. ON_BN_CLICKED(IDC_WRITE, OnWrite)
  51. //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CSMTPDlg message handlers
  55. void CSMTPDlg::OnRead()
  56. {
  57. PFAX_RECEIPTS_CONFIG pCfg;
  58. if (!FaxGetReceiptsConfiguration (m_hFax, &pCfg))
  59. {
  60. CString cs;
  61. cs.Format ("Failed while calling FaxGetReceiptsConfiguration (%ld)", GetLastError());
  62. AfxMessageBox (cs, MB_OK | MB_ICONHAND);
  63. return;
  64. }
  65. m_cstrServerName = pCfg->lptstrSMTPServer;
  66. m_dwServerPort = pCfg->dwSMTPPort;
  67. m_cstrUserName = pCfg->lptstrSMTPUserName;
  68. m_cstrPassword = pCfg->lptstrSMTPPassword;
  69. // m_cstrMAPIProfile = pCfg->lptstrMAPIProfile;
  70. m_cstrSender = pCfg->lptstrSMTPFrom;
  71. m_dwReceiptsOpts = pCfg->dwAllowedReceipts;
  72. m_dwSMTPAuth = pCfg->SMTPAuthOption;
  73. UpdateData (FALSE);
  74. FaxFreeBuffer (LPVOID(pCfg));
  75. }
  76. void CSMTPDlg::OnWrite()
  77. {
  78. UpdateData ();
  79. FAX_RECEIPTS_CONFIG cfg;
  80. cfg.dwSizeOfStruct = sizeof (FAX_RECEIPTS_CONFIG);
  81. cfg.lptstrSMTPServer = LPTSTR(LPCTSTR(m_cstrServerName));
  82. cfg.dwSMTPPort = m_dwServerPort;
  83. cfg.lptstrSMTPUserName = LPTSTR(LPCTSTR(m_cstrUserName));
  84. cfg.lptstrSMTPPassword = LPTSTR(LPCTSTR(m_cstrPassword));
  85. // cfg.lptstrMAPIProfile = LPTSTR(LPCTSTR(m_cstrMAPIProfile));
  86. cfg.lptstrSMTPFrom = LPTSTR(LPCTSTR(m_cstrSender));
  87. cfg.dwAllowedReceipts = m_dwReceiptsOpts;
  88. cfg.SMTPAuthOption = (FAX_ENUM_SMTP_AUTH_OPTIONS)m_dwSMTPAuth;
  89. if (!FaxSetReceiptsConfiguration (m_hFax, &cfg))
  90. {
  91. CString cs;
  92. cs.Format ("Failed while calling FaxSetReceiptsConfiguration (%ld)", GetLastError());
  93. AfxMessageBox (cs, MB_OK | MB_ICONHAND);
  94. return;
  95. }
  96. }