Source code of Windows XP (NT5)
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.

125 lines
4.2 KiB

  1. #ifndef __POLICY_H
  2. #define __POLICY_H
  3. ///////////////////////////////////////////////////////////////////////////////
  4. /* File: policy.h
  5. Description: A system administrator is able to specify control parameters
  6. for the watchdog. These include:
  7. Show popup dialog to user (yes/no)
  8. Send user email message (yes/no)
  9. Minimum period between popup dialogs (minutes)
  10. Minimum period between email messages (minutes)
  11. Add users to "To:" email list <email address list>
  12. Add users to "Cc:" email list <email address list>
  13. Add users to "Bcc:" email list <email address list>
  14. A client of the object is able to ask it if a given action should be
  15. performed (dialog, email) and for the additional email names.
  16. CPolicy
  17. Revision History:
  18. Date Description Programmer
  19. -------- --------------------------------------------------- ----------
  20. 07/01/97 Initial creation. BrianAu
  21. 07/10/97 Store info in HKEY_CURRENT_USER instead of BrianAu
  22. policy.ini.
  23. */
  24. ///////////////////////////////////////////////////////////////////////////////
  25. #ifndef _WINDOWS_
  26. # include <windows.h>
  27. #endif
  28. #ifndef __DSKQUOTA_REG_PARAMS_H
  29. # include "regparam.h"
  30. #endif
  31. //
  32. // This class provides an in-memory copy of the notification policy
  33. // information contained in an INI file or the registry.
  34. //
  35. class CPolicy
  36. {
  37. public:
  38. CPolicy(VOID);
  39. ~CPolicy(VOID);
  40. VOID GetOtherEmailTo(CString& strOut)
  41. { strOut = m_strOtherEmailTo; }
  42. LPTSTR GetOtherEmailTo(VOID)
  43. { return (LPTSTR)m_strOtherEmailTo; }
  44. VOID GetOtherEmailCc(CString& strOut)
  45. { strOut = m_strOtherEmailCc; }
  46. LPTSTR GetOtherEmailCc(VOID)
  47. { return (LPTSTR)m_strOtherEmailCc; }
  48. VOID GetOtherEmailBcc(CString& strOut)
  49. { strOut = m_strOtherEmailBcc; }
  50. LPTSTR GetOtherEmailBcc(VOID)
  51. { return (LPTSTR)m_strOtherEmailBcc; }
  52. INT GetMinNotifyPopupDialogPeriod(VOID)
  53. { return m_iMinPeriodPopupDialog; }
  54. INT GetMinNotifyEmailPeriod(VOID)
  55. { return m_iMinPeriodEmail; }
  56. BOOL ShouldSendUserEmail(VOID) const
  57. { return m_bSendUserEmail; }
  58. BOOL ShouldPopupDialog(VOID) const
  59. { return m_bPopupDialog; }
  60. BOOL ShouldSendEmail(VOID) const;
  61. BOOL ShouldDoAnyNotifications(VOID) const;
  62. private:
  63. RegParamTable m_RegParams; // Registry parameter table.
  64. BOOL m_bSendUserEmail; // Should we send user email?
  65. BOOL m_bPopupDialog; // Should we popup a dialog on client?
  66. INT m_iMinPeriodPopupDialog; // Minimum minutes between popup dialogs.
  67. INT m_iMinPeriodEmail; // Minimum minutes between email messages.
  68. CString m_strOtherEmailTo; // Comma-sep list of email names.
  69. CString m_strOtherEmailCc; // Comma-sep list of email names.
  70. CString m_strOtherEmailBcc; // Comma-sep list of email names.
  71. //
  72. // Prevent copy.
  73. //
  74. CPolicy(const CPolicy& rhs);
  75. CPolicy& operator = (const CPolicy& rhs);
  76. //
  77. // Names of registry values.
  78. //
  79. static const TCHAR SZ_REG_SEND_USER_EMAIL[];
  80. static const TCHAR SZ_REG_SHOW_USER_POPUP[];
  81. static const TCHAR SZ_REG_MIN_PERIOD_POPUP[];
  82. static const TCHAR SZ_REG_MIN_PERIOD_EMAIL[];
  83. static const TCHAR SZ_REG_SEND_EMAIL_TO[];
  84. static const TCHAR SZ_REG_SEND_EMAIL_CC[];
  85. static const TCHAR SZ_REG_SEND_EMAIL_BCC[];
  86. //
  87. // Default values for registry.
  88. //
  89. static const INT I_REG_SEND_USER_EMAIL_DEFAULT;
  90. static const INT I_REG_SHOW_USER_POPUP_DEFAULT;
  91. static const INT I_REG_MIN_PERIOD_POPUP_DEFAULT;
  92. static const INT I_REG_MIN_PERIOD_EMAIL_DEFAULT;
  93. static const TCHAR SZ_REG_SEND_EMAIL_TO_DEFAULT[];
  94. static const TCHAR SZ_REG_SEND_EMAIL_CC_DEFAULT[];
  95. static const TCHAR SZ_REG_SEND_EMAIL_BCC_DEFAULT[];
  96. };
  97. #endif //__POLICY_H