summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-07-23 18:02:52 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-07-23 18:02:58 +0300
commita02bbd978031df7352f850cdfa568d9e7887e855 (patch)
tree447ce68724b2587d35234a887c92678456d71bc3 /plugins
parent015f21a98844bf099c3979bafbeff9e948c4fc33 (diff)
fixes #1479 (StopSpam should update default phrases if langpack changed)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/StopSpamPlus/src/events.cpp4
-rw-r--r--plugins/StopSpamPlus/src/options.cpp14
-rw-r--r--plugins/StopSpamPlus/src/settings.cpp24
-rw-r--r--plugins/StopSpamPlus/src/settings.h4
-rw-r--r--plugins/StopSpamPlus/src/version.h2
5 files changed, 39 insertions, 9 deletions
diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp
index 2c2a077b65..b56e108d9b 100644
--- a/plugins/StopSpamPlus/src/events.cpp
+++ b/plugins/StopSpamPlus/src/events.cpp
@@ -121,7 +121,7 @@ int OnDbEventFilterAdd(WPARAM w, LPARAM l)
// send congratulation
- char * buf = mir_utf8encodeW(variables_parse(g_sets.Congratulation, hContact).c_str());
+ char * buf = mir_utf8encodeW(variables_parse(g_sets.getCongrats(), hContact).c_str());
ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)buf);
mir_free(buf);
@@ -137,7 +137,7 @@ int OnDbEventFilterAdd(WPARAM w, LPARAM l)
const wchar_t *pwszPrefix = TranslateT("StopSpam automatic message:\r\n");
if ((!g_sets.InfTalkProtection || tstring::npos == message.find(pwszPrefix)) && (!g_sets.MaxQuestCount || db_get_dw(hContact, MODULENAME, questCountSetting, 0) < g_sets.MaxQuestCount)) {
// send question
- tstring q = pwszPrefix + variables_parse(g_sets.Question, hContact);
+ tstring q = pwszPrefix + variables_parse(g_sets.getQuestion(), hContact);
char * buf = mir_utf8encodeW(q.c_str());
diff --git a/plugins/StopSpamPlus/src/options.cpp b/plugins/StopSpamPlus/src/options.cpp
index 0773c23f4e..2bdc37c4b7 100644
--- a/plugins/StopSpamPlus/src/options.cpp
+++ b/plugins/StopSpamPlus/src/options.cpp
@@ -68,6 +68,10 @@ public:
{
variables_skin_helpbutton(m_hwnd, IDC_VARS);
btnHelp.Enable(ServiceExists(MS_VARS_FORMATSTRING));
+
+ edtQuestion.SetText(g_sets.getQuestion());
+ edtCongrat.SetText(g_sets.getCongrats());
+ edtReply.SetText(g_sets.getReply());
return true;
}
@@ -78,9 +82,13 @@ public:
void onRestore(CCtrlButton*)
{
- edtQuestion.SetText(g_sets.Question.Default());
- edtAnswer.SetText(g_sets.Answer.Default());
- edtCongrat.SetText(g_sets.Congratulation.Default());
+ g_plugin.delSetting(g_sets.Answer.GetDBSettingName());
+ g_plugin.delSetting(g_sets.Question.GetDBSettingName());
+ g_plugin.delSetting(g_sets.Congratulation.GetDBSettingName());
+
+ edtQuestion.SetText(g_sets.getQuestion());
+ edtAnswer.SetText(g_sets.Answer);
+ edtCongrat.SetText(g_sets.getCongrats());
edtReply.SetText(g_sets.AuthRepl.Default());
edtDivider.SetText(g_sets.AnswSplitString.Default());
diff --git a/plugins/StopSpamPlus/src/settings.cpp b/plugins/StopSpamPlus/src/settings.cpp
index 0e133956d4..01d11c7570 100644
--- a/plugins/StopSpamPlus/src/settings.cpp
+++ b/plugins/StopSpamPlus/src/settings.cpp
@@ -5,10 +5,10 @@ Settings g_sets;
/////////////////////////////////////////////////////////////////////////////////////////
Settings::Settings() :
- Question(MODULENAME, "Question", TranslateW(L"Spammers made me to install small anti-spam system you are now speaking with. Please reply \"nospam\" without quotes and spaces if you want to contact me.")),
- AuthRepl(MODULENAME, "AuthReply", TranslateW(L"StopSpam: send a message and reply to an anti-spam bot question.")),
+ Question(MODULENAME, "Question"),
+ AuthRepl(MODULENAME, "AuthReply"),
Answer(MODULENAME, "Answer", L"nospam"),
- Congratulation(MODULENAME, "Congratulation", TranslateW(L"Congratulations! You just passed human/robot test. Now you can write me a message.")),
+ Congratulation(MODULENAME, "Congratulation"),
DisabledProtoList(MODULENAME, "DisabledProtoList", "MetaContacts RSSNews"),
InfTalkProtection(MODULENAME, "InfTalkProtection", 1),
AddPermanent(MODULENAME, "AddPermanent", 0),
@@ -20,3 +20,21 @@ Settings::Settings() :
HistLog(MODULENAME, "HistLog", 0)
{
}
+
+const wchar_t* Settings::getQuestion()
+{
+ const wchar_t *res = Question;
+ return (res != nullptr) ? res : TranslateW(L"Spammers made me to install small anti-spam system you are now speaking with. Please reply \"nospam\" without quotes and spaces if you want to contact me.");
+}
+
+const wchar_t* Settings::getReply()
+{
+ const wchar_t *res = AuthRepl;
+ return (res != nullptr) ? res : TranslateW(L"StopSpam: send a message and reply to an anti-spam bot question.");
+}
+
+const wchar_t* Settings::getCongrats()
+{
+ const wchar_t *res = Congratulation;
+ return (res != nullptr) ? res : TranslateW(L"Congratulations! You just passed human/robot test. Now you can write me a message.");
+}
diff --git a/plugins/StopSpamPlus/src/settings.h b/plugins/StopSpamPlus/src/settings.h
index 683d7cb0c7..7d3e3218cb 100644
--- a/plugins/StopSpamPlus/src/settings.h
+++ b/plugins/StopSpamPlus/src/settings.h
@@ -9,6 +9,10 @@ struct Settings
CMOption<char*> DisabledProtoList;
CMOption<DWORD> MaxQuestCount;
+ const wchar_t* getQuestion();
+ const wchar_t* getReply();
+ const wchar_t* getCongrats();
+
bool ProtoDisabled(const char *proto)
{
std::string temp(proto); temp += ' ';
diff --git a/plugins/StopSpamPlus/src/version.h b/plugins/StopSpamPlus/src/version.h
index 3349b2f3d2..3ce9c45789 100644
--- a/plugins/StopSpamPlus/src/version.h
+++ b/plugins/StopSpamPlus/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>