ECQuotaMonitor.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright 2005 - 2016 Zarafa and its licensors
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License, version 3,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. #ifndef ECQUOTAMONITOR
  18. #define ECQUOTAMONITOR
  19. #include <kopano/zcdefs.h>
  20. #include <kopano/ECDefs.h>
  21. #define TEMPLATE_LINE_LENGTH 1024
  22. struct TemplateVariables {
  23. objectclass_t ulClass;
  24. eQuotaStatus ulStatus;
  25. std::string strUserName;
  26. std::string strFullName;
  27. std::string strCompany;
  28. std::string strStoreSize;
  29. std::string strWarnSize;
  30. std::string strSoftSize;
  31. std::string strHardSize;
  32. };
  33. class ECQuotaMonitor _kc_final {
  34. private:
  35. ECQuotaMonitor(ECTHREADMONITOR *lpThreadMonitor, LPMAPISESSION lpMAPIAdminSession, LPMDB lpMDBAdmin);
  36. public:
  37. virtual ~ECQuotaMonitor(void);
  38. static void* Create(void* lpVoid);
  39. HRESULT CheckQuota();
  40. HRESULT CheckCompanyQuota(ECCOMPANY *lpecCompany);
  41. HRESULT CheckServerQuota(ULONG cUsers, ECUSER *lpsUserList, ECCOMPANY *lpecCompany, LPMDB lpAdminStore);
  42. private:
  43. HRESULT CreateMailFromTemplate(TemplateVariables *lpVars, std::string *lpstrSubject, std::string *lpstrBody);
  44. HRESULT CreateMessageProperties(ECUSER *touesr, ECUSER *fromuser, const std::string &subj, const std::string &body, ULONG *lpcPropSize, LPSPropValue *lppPropArray);
  45. HRESULT CreateRecipientList(ULONG cToUsers, ECUSER *lpToUsers, LPADRLIST *lppAddrList);
  46. HRESULT SendQuotaWarningMail(IMsgStore* lpMDB, ULONG cPropSize, LPSPropValue lpPropArray, LPADRLIST lpAddrList);
  47. HRESULT CreateQuotaWarningMail(TemplateVariables *lpVars, IMsgStore* lpMDB, ECUSER *lpecToUser, ECUSER *lpecFromUser, LPADRLIST lpAddrList);
  48. HRESULT OpenUserStore(LPTSTR szStoreName, objectclass_t objclass, LPMDB *lppStore);
  49. HRESULT CheckQuotaInterval(LPMDB lpStore, LPMESSAGE *lppMessage, bool *lpbTimeout);
  50. HRESULT UpdateQuotaTimestamp(LPMESSAGE lpMessage);
  51. HRESULT Notify(ECUSER *lpecUser, ECCOMPANY *lpecCompany, ECQUOTASTATUS *lpecQuotaStatus, LPMDB lpStore);
  52. ECTHREADMONITOR *m_lpThreadMonitor;
  53. LPMAPISESSION m_lpMAPIAdminSession;
  54. LPMDB m_lpMDBAdmin;
  55. ULONG m_ulProcessed = 0, m_ulFailed = 0;
  56. };
  57. #endif