summaryrefslogtreecommitdiff
path: root/plugins/StopSpamPlus
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-06-15 20:04:13 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-06-15 20:04:13 +0000
commite521b812384a0e93f48e078c6cb248913dcc893a (patch)
tree13b1de3e9bef13a48af0318f1fd338915dd69e9a /plugins/StopSpamPlus
parentae481600939fb5420b80a8a7ef84f0ce9d6b3356 (diff)
another portion of "#ifsef Unicode" removal
git-svn-id: http://svn.miranda-ng.org/main/trunk@437 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StopSpamPlus')
-rw-r--r--plugins/StopSpamPlus/res/version.h9
-rw-r--r--plugins/StopSpamPlus/src/events.cpp43
-rw-r--r--plugins/StopSpamPlus/src/settings.cpp8
-rw-r--r--plugins/StopSpamPlus/src/settings.h4
4 files changed, 19 insertions, 45 deletions
diff --git a/plugins/StopSpamPlus/res/version.h b/plugins/StopSpamPlus/res/version.h
index 469a330f6f..12fc10b6df 100644
--- a/plugins/StopSpamPlus/res/version.h
+++ b/plugins/StopSpamPlus/res/version.h
@@ -35,19 +35,12 @@
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
-#ifdef _UNICODE
-#ifdef __REV_NUM
-#define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING_DOTS rev. __REV_NUM Unicode)
-#else
-#define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING_DOTS Unicode)
-#endif
-#else
+
#ifdef __REV_NUM
#define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING_DOTS rev. __REV_NUM)
#else
#define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING_DOTS)
#endif
-#endif
#define __PRODVERSION_STRING __PROD_MAJOR_VERSION,__PROD_MINOR_VERSION,__PROD_RELEASE_NUM,__PROD_BUILD_NUM
#define __PRODVERSION_STRING_DOTS __PROD_MAJOR_VERSION.__PROD_MINOR_VERSION.__PROD_RELEASE_NUM.__PROD_BUILD_NUM
diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp
index bbded01fea..f857560c8c 100644
--- a/plugins/StopSpamPlus/src/events.cpp
+++ b/plugins/StopSpamPlus/src/events.cpp
@@ -34,27 +34,23 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam)
{
if (!plSets->HandleAuthReq.Get())
{
- #ifdef _UNICODE
+
char * buf=mir_utf8encodeW(variables_parse(plSets->AuthRepl.Get(), hcntct).c_str());
CallContactService(hcntct, PSS_MESSAGE, PREF_UTF, (LPARAM)buf);
mir_free(buf);
- #else
- CallContactService(hcntct, PSS_MESSAGE, 0, (LPARAM)(variables_parse(plSets->AuthRepl.Get(), hcntct).c_str()));
- #endif
+
}
char *AuthRepl;
- #ifdef _UNICODE
+
AuthRepl=mir_u2a(variables_parse(plSets->AuthRepl.Get(), hcntct).c_str());
- #else
- AuthRepl=variables_parse(plSets->AuthRepl.Get(), hcntct).c_str();
- #endif
+
// ...send message
std::string allowService = dbei.szModule;
allowService += PS_AUTHDENY;
CallService(allowService.c_str(), (WPARAM)hDbEvent, (LPARAM)AuthRepl);
- #ifdef _UNICODE
+
mir_free(AuthRepl);
- #endif
+
DBWriteContactSettingByte(hcntct, "CList", "NotOnList", 1);
DBWriteContactSettingByte(hcntct, "CList", "Hidden", 1);
if (!plSets->HistLog.Get())
@@ -108,23 +104,17 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
if(dbei->flags & DBEF_UTF){
WCHAR* msg_u=mir_utf8decodeW((char*)dbei->pBlob);
-#ifdef _UNICODE
+
message = msg_u;
-#else
- char* msg_a = mir_u2a(msg_u);
- message = msg_a;
- mir_free(msg_a);
-#endif
+
mir_free(msg_u);
}
else{
-#ifdef _UNICODE
+
WCHAR* msg_u = mir_a2u((char*)(dbei->pBlob));
message = msg_u;
mir_free(msg_u);
-#else
- message = (char*)(dbei->pBlob);
-#endif
+
}
// if message equal right answer...
@@ -156,14 +146,11 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
DBDeleteContactSetting(hContact, "CList", "NotOnList");
// send congratulation
- #ifdef _UNICODE
+
char * buf=mir_utf8encodeW(variables_parse(plSets->Congratulation.Get(), hContact).c_str());
CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)buf);
mir_free(buf);
- #else
- CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)(variables_parse(plSets->Congratulation.Get(), hContact).c_str()));
- #endif
-
+
// process the event
return 1;
}
@@ -179,13 +166,11 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l)
// send question
tstring q = infTalkProtPrefix + variables_parse((tstring)(plSets->Question), hContact);
-#ifdef _UNICODE
+
char * buf=mir_utf8encodeW(q.c_str());
CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)buf);
mir_free(buf);
-#else
- CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)q.c_str());
-#endif
+
// increment question count
DWORD questCount = DBGetContactSettingDword(hContact, pluginName, questCountSetting, 0);
diff --git a/plugins/StopSpamPlus/src/settings.cpp b/plugins/StopSpamPlus/src/settings.cpp
index 39ce0c96df..7d74b63919 100644
--- a/plugins/StopSpamPlus/src/settings.cpp
+++ b/plugins/StopSpamPlus/src/settings.cpp
@@ -11,7 +11,7 @@ tstring db_usage::DBGetPluginSetting(std::string const &name, tstring const &def
return value;
}
-#ifdef _UNICODE
+
std::string db_usage::DBGetPluginSetting(std::string const &name, std::string const &defValue)
{
DBVARIANT dbv;
@@ -21,7 +21,7 @@ std::string db_usage::DBGetPluginSetting(std::string const &name, std::string co
DBFreeVariant(&dbv);
return value;
}
-#endif
+
bool db_usage::DBGetPluginSetting(std::string const &name, bool const &defValue)
{
@@ -39,12 +39,12 @@ 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)
{
diff --git a/plugins/StopSpamPlus/src/settings.h b/plugins/StopSpamPlus/src/settings.h
index 5fe2b43a39..99aa9322e8 100644
--- a/plugins/StopSpamPlus/src/settings.h
+++ b/plugins/StopSpamPlus/src/settings.h
@@ -7,16 +7,12 @@ class db_usage
public:
//reading from database
static tstring DBGetPluginSetting(std::string const &name, tstring const &defValue);
-#ifdef _UNICODE
static std::string DBGetPluginSetting(std::string const &name, std::string const &defValue);
-#endif
static bool DBGetPluginSetting(std::string const &name, bool const &defValue);
static DWORD DBGetPluginSetting(std::string const &name, DWORD const &defValue);
//writting to database
static void DBSetPluginSetting(std::string const &name, tstring const &value);
-#ifdef _UNICODE
static void DBSetPluginSetting(std::string const &name, std::string const &value);
-#endif
static void DBSetPluginSetting(std::string const &name, bool const &value);
static void DBSetPluginSetting(std::string const &name, DWORD const &value);