From 165da716f5e72665355cc774f7c9df1d0be377bd Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 16 Nov 2017 22:18:07 +0300 Subject: fixes #1033 (StopSpamMod: translation problem) --- plugins/StopSpamMod/src/init.cpp | 9 ++++----- plugins/StopSpamMod/src/options.cpp | 23 +++++++++++++---------- plugins/StopSpamMod/src/utilities.h | 2 -- plugins/StopSpamMod/src/version.h | 20 ++++++++++---------- 4 files changed, 27 insertions(+), 27 deletions(-) (limited to 'plugins') diff --git a/plugins/StopSpamMod/src/init.cpp b/plugins/StopSpamMod/src/init.cpp index 436f74125b..794c54cdb0 100755 --- a/plugins/StopSpamMod/src/init.cpp +++ b/plugins/StopSpamMod/src/init.cpp @@ -52,7 +52,7 @@ wstring gbQuestion; wstring gbAnswer; wstring gbCongratulation; std::wstring gbAuthRepl; -extern wchar_t const * defQuestion; +extern const wchar_t *defQuestion, *defCongrats, *defAuthReply; extern int RemoveTmp(WPARAM,LPARAM); ///////////////////////////////////////////////////////////////////////////////////////// @@ -83,15 +83,14 @@ void InitVars() { gbSpammersGroup = DBGetContactSettingStringPAN(NULL, pluginName, "SpammersGroup", L"Spammers"); gbAnswer = DBGetContactSettingStringPAN(NULL, pluginName, "answer", L"nospam"); - gbCongratulation = DBGetContactSettingStringPAN(NULL, pluginName, "congratulation", L"Congratulations! You just passed human/robot test. Now you can write me a message."); gbInfTalkProtection = db_get_b(NULL, pluginName, "infTalkProtection", 0); gbAddPermanent = db_get_b(NULL, pluginName, "addPermanent", 0); gbMaxQuestCount = db_get_dw(NULL, pluginName, "maxQuestCount", 5); gbHandleAuthReq = db_get_b(NULL, pluginName, "handleAuthReq", 1); - gbQuestion = DBGetContactSettingStringPAN(NULL, pluginName, "question", defQuestion); + gbQuestion = DBGetContactSettingStringPAN(NULL, pluginName, "question", TranslateW(defQuestion)); gbAnswer = DBGetContactSettingStringPAN(NULL, pluginName, "answer", L"nospam"); - gbCongratulation = DBGetContactSettingStringPAN(NULL, pluginName, "congratulation", L"Congratulations! You just passed human/robot test. Now you can write me a message."); - gbAuthRepl = DBGetContactSettingStringPAN(NULL, pluginName, "authrepl", L"StopSpam: send a message and reply to an anti-spam bot question."); + gbCongratulation = DBGetContactSettingStringPAN(NULL, pluginName, "congratulation", TranslateW(defCongrats)); + gbAuthRepl = DBGetContactSettingStringPAN(NULL, pluginName, "authrepl", TranslateW(defAuthReply)); gbSpecialGroup = db_get_b(NULL, pluginName, "SpecialGroup", 0); gbHideContacts = db_get_b(NULL, pluginName, "HideContacts", 0); gbIgnoreContacts = db_get_b(NULL, pluginName, "IgnoreContacts", 0); diff --git a/plugins/StopSpamMod/src/options.cpp b/plugins/StopSpamMod/src/options.cpp index b06dae9313..9efb85bdf9 100755 --- a/plugins/StopSpamMod/src/options.cpp +++ b/plugins/StopSpamMod/src/options.cpp @@ -17,14 +17,17 @@ #include "stdafx.h" -char *pluginDescription = LPGEN("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 *defQuestion = TranslateT("Spammers made me to install small anti-spam system you are now speaking with.\r\nPlease reply \"nospam\" without quotes and spaces if you want to contact me."); +wchar_t const *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."); + +const wchar_t *defQuestion = LPGENW("Spammers made me to install small anti-spam system you are now speaking with.\r\nPlease reply \"nospam\" without quotes and spaces if you want to contact me."); +const wchar_t *defCongrats = LPGENW("Congratulations! You just passed human/robot test. Now you can write me a message."); +const wchar_t *defAuthReply = LPGENW("StopSpam: send a message and reply to an anti-spam bot question."); INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: - SetDlgItemTextA(hwnd, ID_DESCRIPTION, pluginDescription); + SetDlgItemTextW(hwnd, ID_DESCRIPTION, TranslateW(pluginDescription)); TranslateDialogDefault(hwnd); SetDlgItemInt(hwnd, ID_MAXQUESTCOUNT, gbMaxQuestCount, FALSE); CheckDlgButton(hwnd, ID_INFTALKPROT, gbInfTalkProtection ? BST_CHECKED : BST_UNCHECKED); @@ -90,10 +93,10 @@ INT_PTR CALLBACK MessagesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar break; case ID_RESTOREDEFAULTS: - SetDlgItemText(hwnd, ID_QUESTION, defQuestion); + SetDlgItemText(hwnd, ID_QUESTION, TranslateW(defQuestion)); SetDlgItemText(hwnd, ID_ANSWER, L"nospam"); - SetDlgItemText(hwnd, ID_AUTHREPL, TranslateT("StopSpam: send a message and reply to an anti-spam bot question.")); - SetDlgItemText(hwnd, ID_CONGRATULATION, TranslateT("Congratulations! You just passed human/robot test. Now you can write me a message.")); + SetDlgItemText(hwnd, ID_AUTHREPL, TranslateW(defAuthReply)); + SetDlgItemText(hwnd, ID_CONGRATULATION, TranslateW(defCongrats)); SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); return TRUE; @@ -109,13 +112,13 @@ INT_PTR CALLBACK MessagesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar switch (nmhdr->code) { case PSN_APPLY: db_set_ws(NULL, pluginName, "question", GetDlgItemString(hwnd, ID_QUESTION).c_str()); - gbQuestion = DBGetContactSettingStringPAN(NULL, pluginName, "question", defQuestion); + gbQuestion = DBGetContactSettingStringPAN(NULL, pluginName, "question", TranslateW(defQuestion)); db_set_ws(NULL, pluginName, "answer", GetDlgItemString(hwnd, ID_ANSWER).c_str()); gbAnswer = DBGetContactSettingStringPAN(NULL, pluginName, "answer", L"nospam"); db_set_ws(NULL, pluginName, "authrepl", GetDlgItemString(hwnd, ID_AUTHREPL).c_str()); - gbAuthRepl = DBGetContactSettingStringPAN(NULL, pluginName, "authrepl", TranslateT("StopSpam: send a message and reply to an anti-spam bot question.")); + gbAuthRepl = DBGetContactSettingStringPAN(NULL, pluginName, "authrepl", TranslateW(defAuthReply)); db_set_ws(NULL, pluginName, "congratulation", GetDlgItemString(hwnd, ID_CONGRATULATION).c_str()); - gbCongratulation = DBGetContactSettingStringPAN(NULL, pluginName, "congratulation", TranslateT("Congratulations! You just passed human/robot test. Now you can write me a message.")); + gbCongratulation = DBGetContactSettingStringPAN(NULL, pluginName, "congratulation", TranslateW(defCongrats)); return TRUE; } break; @@ -137,7 +140,7 @@ INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_COMMAND: switch (LOWORD(wParam)) { - WPARAM n; + WPARAM n; case ID_ADD: n = (WPARAM)SendDlgItemMessage(hwnd, ID_ALLPROTO, LB_GETCURSEL, 0, 0); if (LB_ERR != n) { diff --git a/plugins/StopSpamMod/src/utilities.h b/plugins/StopSpamMod/src/utilities.h index b0ffab994c..8d75c10905 100755 --- a/plugins/StopSpamMod/src/utilities.h +++ b/plugins/StopSpamMod/src/utilities.h @@ -3,14 +3,12 @@ std::string DBGetContactSettingStringPAN_A(MCONTACT hContact, char const * szMod std::wstring &GetDlgItemString(HWND hwnd, int id); std::string &GetProtoList(); bool ProtoInList(std::string proto); -void RemoveExcludedUsers(); std::wstring variables_parse(std::wstring const &tstrFormat, MCONTACT hContact); const int Stricmp(const wchar_t *str, const wchar_t *substr); //const int Stristr(const wchar_t *str, const wchar_t *substr); wchar_t* ReqGetText(DBEVENTINFO* dbei); BOOL IsUrlContains(wchar_t * Str); void DeleteCListGroupsByName(wchar_t* szGroupName); -std::wstring GetContactUid(MCONTACT hContact, std::string Protocol); void LogSpamToFile(MCONTACT hContact, std::wstring message); std::string toUTF8(std::wstring str); std::string toUTF8(std::string str); diff --git a/plugins/StopSpamMod/src/version.h b/plugins/StopSpamMod/src/version.h index a075a73036..b92a28afc0 100755 --- a/plugins/StopSpamMod/src/version.h +++ b/plugins/StopSpamMod/src/version.h @@ -1,14 +1,14 @@ -#define __MAJOR_VERSION 0 -#define __MINOR_VERSION 0 +#define __MAJOR_VERSION 0 +#define __MINOR_VERSION 0 #define __RELEASE_NUM 2 -#define __BUILD_NUM 0 +#define __BUILD_NUM 1 #include -#define __PLUGIN_NAME "StopSpam mod" -#define __FILENAME "StopSpamMod.dll" -#define __DESCRIPTION "Anti-spam plugin for Miranda NG." -#define __AUTHOR "Roman Miklashevsky, sss, Elzor" -#define __AUTHOREMAIL "sss123next@list.ru" -#define __AUTHORWEB "https://miranda-ng.org/p/StopSpamMod/" -#define __COPYRIGHT "© 2004-2017 Roman Miklashevsky, A. Petkevich, Kosh&chka, sss, Elzor" +#define __PLUGIN_NAME "StopSpam mod" +#define __FILENAME "StopSpamMod.dll" +#define __DESCRIPTION "Anti-spam plugin for Miranda NG." +#define __AUTHOR "Roman Miklashevsky, sss, Elzor" +#define __AUTHOREMAIL "sss123next@list.ru" +#define __AUTHORWEB "https://miranda-ng.org/p/StopSpamMod/" +#define __COPYRIGHT "© 2004-2017 Roman Miklashevsky, A. Petkevich, Kosh&chka, sss, Elzor" -- cgit v1.2.3