// Copyright (c) 2010 Martin Knafve / hMailServer.com. // http://www.hmailserver.com #pragma once namespace HM { class Alias; class DistributionList; class Group; class Domain; class DomainAlias; class DistributionListRecipient; class Route; class SecurityRange; enum PersistenceMode; class PreSaveLimitationsCheck { public: PreSaveLimitationsCheck(void); ~PreSaveLimitationsCheck(void); static bool CheckLimitations(PersistenceMode mode, std::shared_ptr domain, String &resultDescription); static bool CheckLimitations(PersistenceMode mode, std::shared_ptr domainAlias, String &resultDescription); static bool CheckLimitations(PersistenceMode mode, std::shared_ptr account, String &resultDescription); static bool CheckLimitations(PersistenceMode mode, std::shared_ptr alias, String &resultDescription); static bool CheckLimitations(PersistenceMode mode, std::shared_ptr list, String &resultDescription); static bool CheckLimitations(PersistenceMode mode, std::shared_ptr group, String &resultDescription); static bool CheckLimitations(PersistenceMode mode, std::shared_ptr pRecipient, String &resultDescription); static bool CheckLimitations(PersistenceMode mode, std::shared_ptr route, String &resultDescription); static bool CheckLimitations(PersistenceMode mode, std::shared_ptr route, String &resultDescription); static bool IsValidAccountAddress_(const String &sEmailAddress); private: enum ObjectType { TypeAccount = 1, TypeAlias = 2, TypeList = 3, TypeGroup = 4 }; static std::shared_ptr GetDomain(__int64 id); static bool DuplicateError(String &resultDescription); static bool GetDuplicateExist(std::shared_ptr domain, ObjectType objectType, __int64 objectID, const String &objectName); }; }