diff options
author | George Hazan <ghazan@miranda.im> | 2017-11-16 22:26:08 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-11-16 22:26:08 +0300 |
commit | a991e99b78a5f3c1fbd42e9b6cc4bfc7b30e83b6 (patch) | |
tree | 60b88f672fc3d401640aa23eb902175c8089095d /plugins/StopSpamPlus/src | |
parent | 165da716f5e72665355cc774f7c9df1d0be377bd (diff) |
TranslateT for global data is a very bad idea
Diffstat (limited to 'plugins/StopSpamPlus/src')
-rw-r--r-- | plugins/StopSpamPlus/src/events.cpp | 5 | ||||
-rw-r--r-- | plugins/StopSpamPlus/src/options.cpp | 6 | ||||
-rw-r--r-- | plugins/StopSpamPlus/src/stdafx.h | 6 |
3 files changed, 8 insertions, 9 deletions
diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp index 2810d8d68d..6b5c95a53c 100644 --- a/plugins/StopSpamPlus/src/events.cpp +++ b/plugins/StopSpamPlus/src/events.cpp @@ -132,11 +132,12 @@ int OnDbEventFilterAdd(WPARAM w, LPARAM l) // if message message does not contain infintite talk protection prefix
// and question count for this contact is less then maximum
- if ((!plSets->InfTalkProtection.Get() || tstring::npos == message.find(infTalkProtPrefix))
+ const wchar_t *pwszPrefix = TranslateT("StopSpam automatic message:\r\n");
+ if ((!plSets->InfTalkProtection.Get() || tstring::npos == message.find(pwszPrefix))
&& (!plSets->MaxQuestCount.Get() || db_get_dw(hContact, pluginName, questCountSetting, 0) < plSets->MaxQuestCount.Get()))
{
// send question
- tstring q = infTalkProtPrefix + variables_parse((tstring)(plSets->Question), hContact);
+ tstring q = pwszPrefix + variables_parse((tstring)(plSets->Question), hContact);
char * buf = mir_utf8encodeW(q.c_str());
diff --git a/plugins/StopSpamPlus/src/options.cpp b/plugins/StopSpamPlus/src/options.cpp index 5f70f6a8d6..af9f587e4c 100644 --- a/plugins/StopSpamPlus/src/options.cpp +++ b/plugins/StopSpamPlus/src/options.cpp @@ -1,7 +1,7 @@ #include "stdafx.h"
-wchar_t *pluginDescription = TranslateT("No more spam! Robots can't go! Only human beings invited!\r\n\r\nThis plugin works pretty simple:\r\nWhile messages from users on your contact list go as there is no any anti-spam software, messages from unknown users are not delivered to you. But also they are not ignored, this plugin replies with a simple question, and if user gives the right answer, plugin adds him to your contact list so that he can contact you.");
-wchar_t const *infTalkProtPrefix = TranslateT("StopSpam automatic message:\r\n");
+const wchar_t pluginDescription[] = LPGENW("No more spam! Robots can't go! Only human beings invited!\r\n\r\nThis plugin works pretty simple:\r\nWhile messages from users on your contact list go as there is no any anti-spam software, messages from unknown users are not delivered to you. But also they are not ignored, this plugin replies with a simple question, and if user gives the right answer, plugin adds him to your contact list so that he can contact you.");
+
char const *answeredSetting = "Answered";
char const *questCountSetting = "QuestionCount";
@@ -9,7 +9,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
switch (msg) {
case WM_INITDIALOG:
- SetDlgItemText(hwnd, ID_DESCRIPTION, pluginDescription);
+ SetDlgItemText(hwnd, ID_DESCRIPTION, TranslateW(pluginDescription));
TranslateDialogDefault(hwnd);
SetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, plSets->MaxQuestCount.Get(), FALSE);
CheckDlgButton(hwnd, ID_INFTALKPROT, plSets->InfTalkProtection.Get() ? BST_CHECKED : BST_UNCHECKED);
diff --git a/plugins/StopSpamPlus/src/stdafx.h b/plugins/StopSpamPlus/src/stdafx.h index fa52b8e615..4b25fba17b 100644 --- a/plugins/StopSpamPlus/src/stdafx.h +++ b/plugins/StopSpamPlus/src/stdafx.h @@ -31,10 +31,8 @@ typedef std::wstring tstring; #define pluginName LPGEN("StopSpam")
-extern wchar_t * pluginDescription;
-extern wchar_t const * infTalkProtPrefix;
-extern char const * answeredSetting;
-extern char const * questCountSetting;
+extern char const *answeredSetting;
+extern char const *questCountSetting;
extern HINSTANCE hInst;
//options
|