summaryrefslogtreecommitdiff
path: root/plugins/StopSpamPlus/src/events.cpp
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/src/events.cpp
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/src/events.cpp')
-rw-r--r--plugins/StopSpamPlus/src/events.cpp43
1 files changed, 14 insertions, 29 deletions
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);