#pragma once #include "../webserver/cWebem.h" #include "../webserver/request.hpp" #define OPTIONS_NONE 0 #define OPTIONS_URL_SUBJECT 1 #define OPTIONS_URL_BODY 2 #define OPTIONS_HTML_SUBJECT 4 #define OPTIONS_HTML_BODY 8 #define OPTIONS_URL_PARAMS 16 class CNotificationBase { friend class CNotificationHelper; protected: CNotificationBase(const std::string &subsystemid, int options = OPTIONS_NONE); virtual ~CNotificationBase() = default; bool SendMessage(uint64_t Idx, const std::string &Name, const std::string &Subject, const std::string &Text, const std::string &ExtraData, bool bFromNotification); bool SendMessageEx(uint64_t Idx, const std::string &Name, const std::string &Subject, const std::string &Text, const std::string &ExtraData, int Priority, const std::string &Sound, bool bFromNotification); void SetConfigValue(const std::string &Key, const std::string &Value); std::string GetSubsystemId(); bool IsInConfig(const std::string &Key); bool IsInConfigString(const std::string &Key); bool IsInConfigInt(const std::string &Key); bool IsInConfigBase64(const std::string &Key); void ConfigFromGetvars(const http::server::request &req, bool save); virtual bool IsConfigured() = 0; void SetupConfig(const std::string &Key, std::string &Value); void SetupConfig(const std::string &Key, int *Value); void SetupConfigBase64(const std::string &Key, std::string &Value); virtual bool SendMessageImplementation(uint64_t Idx, const std::string &Name, const std::string &Subject, const std::string &Text, const std::string &ExtraData, int Priority, const std::string &Sound, bool bFromNotification) = 0; void LoadConfig(); int m_IsEnabled; private: std::mutex SendMessageExMutex; std::string _subsystemid; std::map _configValues; std::map _configValuesBase64; std::map _configValuesInt; int _options; };