From 48540940b6c28bb4378abfeb500ec45a625b37b6 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Tue, 15 May 2012 10:38:20 +0000 Subject: initial commit git-svn-id: http://svn.miranda-ng.org/main/trunk@2 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/StopSpamPlus/src/settings.cpp | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 plugins/StopSpamPlus/src/settings.cpp (limited to 'plugins/StopSpamPlus/src/settings.cpp') diff --git a/plugins/StopSpamPlus/src/settings.cpp b/plugins/StopSpamPlus/src/settings.cpp new file mode 100644 index 0000000000..39ce0c96df --- /dev/null +++ b/plugins/StopSpamPlus/src/settings.cpp @@ -0,0 +1,59 @@ +#include "../headers.h" + +//reading from database------------- +tstring db_usage::DBGetPluginSetting(std::string const &name, tstring const &defValue) +{ + DBVARIANT dbv; + if(DBGetContactSettingTString(NULL, pluginName, name.c_str(), &dbv)) + return defValue; + tstring value = dbv.ptszVal; + DBFreeVariant(&dbv); + return value; +} + +#ifdef _UNICODE +std::string db_usage::DBGetPluginSetting(std::string const &name, std::string const &defValue) +{ + DBVARIANT dbv; + if(DBGetContactSettingString(NULL, pluginName, name.c_str(), &dbv)) + return defValue; + std::string value = dbv.pszVal; + DBFreeVariant(&dbv); + return value; +} +#endif + +bool db_usage::DBGetPluginSetting(std::string const &name, bool const &defValue) +{ + return(0 != DBGetContactSettingByte(NULL, pluginName, name.c_str(), defValue?1:0)); +} + +DWORD db_usage::DBGetPluginSetting(std::string const &name, DWORD const &defValue) +{ + return DBGetContactSettingDword(NULL, pluginName, name.c_str(), defValue); +} + +//writting to database-------------- +void db_usage::DBSetPluginSetting(std::string const &name, tstring const &value) +{ + DBWriteContactSettingTString(NULL, pluginName, name.c_str(), value.c_str()); +} + +#ifdef _UNICODE +void db_usage::DBSetPluginSetting(std::string const &name, std::string const &value) +{ + DBWriteContactSettingString(NULL, pluginName, name.c_str(), value.c_str()); +} +#endif + +void db_usage::DBSetPluginSetting(std::string const &name, bool const &value) +{ + DBWriteContactSettingByte(NULL, pluginName, name.c_str(), value?1:0); +} + +void db_usage::DBSetPluginSetting(std::string const &name, DWORD const &value) +{ + DBWriteContactSettingDword(NULL, pluginName, name.c_str(),value); +} + +Settings *plSets; -- cgit v1.2.3