diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-05-15 10:38:20 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-05-15 10:38:20 +0000 |
commit | 48540940b6c28bb4378abfeb500ec45a625b37b6 (patch) | |
tree | 2ef294c0763e802f91d868bdef4229b6868527de /plugins/StopSpamPlus/src/settings.cpp | |
parent | 5c350913f011e119127baeb32a6aedeb4f0d33bc (diff) |
initial commit
git-svn-id: http://svn.miranda-ng.org/main/trunk@2 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StopSpamPlus/src/settings.cpp')
-rw-r--r-- | plugins/StopSpamPlus/src/settings.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
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;
|