summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-12-10 00:39:55 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-12-10 00:39:55 +0300
commit90674ba62902b7aaeceeb4c326469a74a32a259d (patch)
treef7f6889e14bd882da1c4f477ccb9555db43744fa
parent002c6191a3cda8db182f2ca26bb182d3274ab960 (diff)
StopSpam moved to CMOption<> instead of custom code
-rw-r--r--plugins/ExternalAPI/m_stopspam.h6
-rw-r--r--plugins/StopSpamPlus/src/events.cpp28
-rw-r--r--plugins/StopSpamPlus/src/options.cpp78
-rw-r--r--plugins/StopSpamPlus/src/services.cpp4
-rw-r--r--plugins/StopSpamPlus/src/settings.cpp73
-rw-r--r--plugins/StopSpamPlus/src/settings.h92
-rw-r--r--plugins/StopSpamPlus/src/stdafx.h2
-rw-r--r--plugins/StopSpamPlus/src/stopspam.cpp12
-rw-r--r--plugins/StopSpamPlus/src/utils.cpp4
-rw-r--r--plugins/StopSpamPlus/src/version.h6
10 files changed, 81 insertions, 224 deletions
diff --git a/plugins/ExternalAPI/m_stopspam.h b/plugins/ExternalAPI/m_stopspam.h
index 9936550885..f25bd2cece 100644
--- a/plugins/ExternalAPI/m_stopspam.h
+++ b/plugins/ExternalAPI/m_stopspam.h
@@ -32,10 +32,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//returns a "Contact Stae" flag
#define MS_STOPSPAM_CONTACTPASSED "StopSpam/IsContactPassed"
-//remove all temporary contacts from db
-//wParam=0
-//lParam=0
-//returns 0
-#define MS_STOPSPAM_REMTEMPCONTACTS "StopSpam/RemoveTempContacts"
-
#endif \ No newline at end of file
diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp
index f7ac53c6bb..684bbcd05b 100644
--- a/plugins/StopSpamPlus/src/events.cpp
+++ b/plugins/StopSpamPlus/src/events.cpp
@@ -17,7 +17,7 @@ int OnDbEventAdded(WPARAM, LPARAM lParam)
db_event_get(hDbEvent, &dbei);
// if event is in protocol that is not despammed
- if (plSets->ProtoDisabled(dbei.szModule))
+ if (g_sets.ProtoDisabled(dbei.szModule))
return 0;
// event is an auth request
@@ -27,20 +27,20 @@ int OnDbEventAdded(WPARAM, LPARAM lParam)
// if request is from unknown or not marked Answered contact
//and if I don't sent message to this contact
if (db_get_b(hcntct, "CList", "NotOnList", 0) && !db_get_b(hcntct, pluginName, answeredSetting, 0) && !IsExistMyMessage(hcntct)) {
- if (!plSets->HandleAuthReq.Get()) {
- char *buf = mir_utf8encodeW(variables_parse(plSets->AuthRepl.Get(), hcntct).c_str());
+ if (!g_sets.HandleAuthReq) {
+ char *buf = mir_utf8encodeW(variables_parse(g_sets.AuthRepl, hcntct).c_str());
ProtoChainSend(hcntct, PSS_MESSAGE, 0, (LPARAM)buf);
mir_free(buf);
}
// ...send message
- char *AuthRepl = mir_u2a(variables_parse(plSets->AuthRepl.Get(), hcntct).c_str());
+ char *AuthRepl = mir_u2a(variables_parse(g_sets.AuthRepl, hcntct).c_str());
CallProtoService(dbei.szModule, PS_AUTHDENY, hDbEvent, (LPARAM)AuthRepl);
mir_free(AuthRepl);
db_set_b(hcntct, "CList", "NotOnList", 1);
db_set_b(hcntct, "CList", "Hidden", 1);
- if (!plSets->HistLog.Get())
+ if (!g_sets.HistLog)
db_event_delete(0, hDbEvent);
return 1;
}
@@ -56,7 +56,7 @@ int OnDbEventFilterAdd(WPARAM w, LPARAM l)
return 0;
// if event is in protocol that is not despammed
- if (plSets->ProtoDisabled(dbei->szModule))
+ if (g_sets.ProtoDisabled(dbei->szModule))
// ...let the event go its way
return 0;
@@ -98,17 +98,17 @@ int OnDbEventFilterAdd(WPARAM w, LPARAM l)
}
// if message equal right answer...
- tstring answers = variables_parse(plSets->Answer.Get(), hContact);
- answers.append(plSets->AnswSplitString.Get());
+ tstring answers = variables_parse(g_sets.Answer, hContact);
+ answers.append(g_sets.AnswSplitString);
tstring::size_type pos = 0;
tstring::size_type prev_pos = 0;
- while ((pos = answers.find(plSets->AnswSplitString.Get(), pos)) != tstring::npos) {
+ while ((pos = answers.find(g_sets.AnswSplitString, pos)) != tstring::npos) {
// get one of answers and trim witespace chars
tstring answer = trim(answers.substr(prev_pos, pos - prev_pos));
// if answer not empty
if (answer.length() > 0) {
// if message equal right answer...
- if (plSets->AnswNotCaseSens.Get() ? !mir_wstrcmpi(message.c_str(), answer.c_str()) : !mir_wstrcmp(message.c_str(), answer.c_str())) {
+ if (g_sets.AnswNotCaseSens ? !mir_wstrcmpi(message.c_str(), answer.c_str()) : !mir_wstrcmp(message.c_str(), answer.c_str())) {
// unhide contact
db_unset(hContact, "CList", "Hidden");
@@ -116,12 +116,12 @@ int OnDbEventFilterAdd(WPARAM w, LPARAM l)
db_set_b(hContact, pluginName, answeredSetting, 1);
//add contact permanently
- if (plSets->AddPermanent.Get())
+ if (g_sets.AddPermanent)
db_unset(hContact, "CList", "NotOnList");
// send congratulation
- char * buf = mir_utf8encodeW(variables_parse(plSets->Congratulation.Get(), hContact).c_str());
+ char * buf = mir_utf8encodeW(variables_parse(g_sets.Congratulation, hContact).c_str());
ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)buf);
mir_free(buf);
@@ -135,9 +135,9 @@ 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
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())) {
+ if ((!g_sets.InfTalkProtection || tstring::npos == message.find(pwszPrefix)) && (!g_sets.MaxQuestCount || db_get_dw(hContact, pluginName, questCountSetting, 0) < g_sets.MaxQuestCount)) {
// send question
- tstring q = pwszPrefix + variables_parse((tstring)(plSets->Question), hContact);
+ tstring q = pwszPrefix + variables_parse(g_sets.Question, hContact);
char * buf = mir_utf8encodeW(q.c_str());
diff --git a/plugins/StopSpamPlus/src/options.cpp b/plugins/StopSpamPlus/src/options.cpp
index 78ba677301..342f446cbb 100644
--- a/plugins/StopSpamPlus/src/options.cpp
+++ b/plugins/StopSpamPlus/src/options.cpp
@@ -2,14 +2,14 @@
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.");
-class COptMainDlg : public CDlgBase
+class COptMainDlg : public CPluginDlgBase
{
CCtrlEdit edtCount;
CCtrlCheck chk1, chk2, chk3, chk4, chk5, chk6;
public:
COptMainDlg() :
- CDlgBase(hInst, IDD_MAIN),
+ CPluginDlgBase(hInst, IDD_MAIN, pluginName),
edtCount(this, ID_MAXQUESTCOUNT),
chk1(this, ID_INFTALKPROT),
chk2(this, ID_ADDPERMANENT),
@@ -17,43 +17,28 @@ public:
chk4(this, ID_NOTCASESENS),
chk5(this, ID_REMOVE_TMP_ALL),
chk6(this, ID_HISTORY_LOG)
- {}
-
- virtual void OnInitDialog() override
- {
- SetDlgItemText(m_hwnd, ID_DESCRIPTION, TranslateW(pluginDescription));
-
- edtCount.SetInt(plSets->MaxQuestCount.Get());
- chk1.SetState(plSets->InfTalkProtection.Get());
- chk2.SetState(plSets->AddPermanent.Get());
- chk3.SetState(plSets->HandleAuthReq.Get());
- chk4.SetState(plSets->AnswNotCaseSens.Get());
- chk5.SetState(plSets->RemTmpAll.Get());
- chk6.SetState(plSets->HistLog.Get());
- }
-
- virtual void OnApply() override
{
- plSets->MaxQuestCount = edtCount.GetInt();
- plSets->InfTalkProtection = chk1.GetState();
- plSets->AddPermanent = chk2.GetState();
- plSets->HandleAuthReq = chk3.GetState();
- plSets->AnswNotCaseSens = chk4.GetState();
- plSets->RemTmpAll = chk5.GetState();
- plSets->HistLog = chk6.GetState();
+ CreateLink(edtCount, g_sets.MaxQuestCount);
+
+ CreateLink(chk1, g_sets.InfTalkProtection);
+ CreateLink(chk2, g_sets.AddPermanent);
+ CreateLink(chk3, g_sets.HandleAuthReq);
+ CreateLink(chk4, g_sets.AnswNotCaseSens);
+ CreateLink(chk5, g_sets.RemTmpAll);
+ CreateLink(chk6, g_sets.HistLog);
}
};
/////////////////////////////////////////////////////////////////////////////////////////
-class COptMessageDlg : public CDlgBase
+class COptMessageDlg : public CPluginDlgBase
{
CCtrlButton btnHelp, btnRestore;
CCtrlEdit edtQuestion, edtAnswer, edtCongrat, edtReply, edtDivider;
public:
COptMessageDlg() :
- CDlgBase(hInst, IDD_MESSAGES),
+ CPluginDlgBase(hInst, IDD_MESSAGES, pluginName),
btnHelp(this, IDC_VARS),
btnRestore(this, ID_RESTOREDEFAULTS),
edtQuestion(this, ID_QUESTION),
@@ -64,28 +49,20 @@ public:
{
btnHelp.OnClick = Callback(this, &COptMessageDlg::onHelp);
btnRestore.OnClick = Callback(this, &COptMessageDlg::onRestore);
+
+ CreateLink(edtReply, g_sets.AuthRepl);
+ CreateLink(edtAnswer, g_sets.Answer);
+ CreateLink(edtQuestion, g_sets.Question);
+ CreateLink(edtCongrat, g_sets.Congratulation);
+ CreateLink(edtDivider, g_sets.AnswSplitString);
}
virtual void OnInitDialog() override
{
- edtQuestion.SetText(plSets->Question.Get().c_str());
- edtAnswer.SetText(plSets->Answer.Get().c_str());
- edtCongrat.SetText(plSets->Congratulation.Get().c_str());
- edtReply.SetText(plSets->AuthRepl.Get().c_str());
- edtDivider.SetText(plSets->AnswSplitString.Get().c_str());
variables_skin_helpbutton(m_hwnd, IDC_VARS);
btnHelp.Enable(ServiceExists(MS_VARS_FORMATSTRING));
}
- virtual void OnApply() override
- {
- plSets->Question = ptrW(edtQuestion.GetText()).get();
- plSets->Answer = ptrW(edtAnswer.GetText()).get();
- plSets->AuthRepl = ptrW(edtCongrat.GetText()).get();
- plSets->Congratulation = ptrW(edtReply.GetText()).get();
- plSets->AnswSplitString = ptrW(edtDivider.GetText()).get();
- }
-
void onHelp(CCtrlButton*)
{
variables_showhelp(m_hwnd, WM_COMMAND, VHF_FULLDLG | VHF_SETLASTSUBJECT, nullptr, nullptr);
@@ -93,24 +70,25 @@ public:
void onRestore(CCtrlButton*)
{
- edtQuestion.SetText(plSets->Question.GetDefault().c_str());
- edtAnswer.SetText(plSets->Answer.GetDefault().c_str());
- edtCongrat.SetText(plSets->Congratulation.GetDefault().c_str());
- edtReply.SetText(plSets->AuthRepl.GetDefault().c_str());
- edtDivider.SetText(plSets->AnswSplitString.GetDefault().c_str());
+ edtQuestion.SetText(g_sets.Question.Default());
+ edtAnswer.SetText(g_sets.Answer.Default());
+ edtCongrat.SetText(g_sets.Congratulation.Default());
+ edtReply.SetText(g_sets.AuthRepl.Default());
+ edtDivider.SetText(g_sets.AnswSplitString.Default());
+
NotifyChange();
}
};
/////////////////////////////////////////////////////////////////////////////////////////
-class COptAccountDlg : public CDlgBase
+class COptAccountDlg : public CPluginDlgBase
{
CCtrlListView m_accounts;
public:
COptAccountDlg() :
- CDlgBase(hInst, IDD_PROTO),
+ CPluginDlgBase(hInst, IDD_PROTO, pluginName),
m_accounts(this, IDC_PROTO)
{
m_accounts.OnItemChanged = Callback(this, &COptAccountDlg::list_OnItemChanged);
@@ -143,7 +121,7 @@ public:
item.lParam = (LPARAM)p->szModuleName;
item.pszText = p->tszAccountName;
int idx = m_accounts.InsertItem(&item);
- m_accounts.SetCheckState(idx, !plSets->ProtoDisabled(p->szModuleName));
+ m_accounts.SetCheckState(idx, !g_sets.ProtoDisabled(p->szModuleName));
}
}
@@ -163,7 +141,7 @@ public:
out << (char*)item.lParam << " ";
}
- plSets->DisabledProtoList = out.str();
+ g_sets.DisabledProtoList = (char*)out.str().c_str();
}
void list_OnItemChanged(CCtrlListView::TEventInfo*)
diff --git a/plugins/StopSpamPlus/src/services.cpp b/plugins/StopSpamPlus/src/services.cpp
index 7cc8fec1a5..7428bf445c 100644
--- a/plugins/StopSpamPlus/src/services.cpp
+++ b/plugins/StopSpamPlus/src/services.cpp
@@ -6,7 +6,7 @@ INT_PTR IsContactPassed(WPARAM hContact, LPARAM /*lParam*/)
if (szProto == nullptr)
return CS_PASSED;
- if (!plSets->ProtoDisabled(szProto))
+ if (!g_sets.ProtoDisabled(szProto))
return CS_PASSED;
if (db_get_b(hContact, pluginName, answeredSetting, 0))
@@ -70,7 +70,7 @@ INT_PTR RemoveTempContacts(WPARAM, LPARAM lParam)
int OnSystemModulesLoaded(WPARAM, LPARAM)
{
- if (plSets->RemTmpAll.Get())
+ if (g_sets.RemTmpAll)
RemoveTempContacts(0, 1);
return 0;
}
diff --git a/plugins/StopSpamPlus/src/settings.cpp b/plugins/StopSpamPlus/src/settings.cpp
index d8f6e85ecd..98c7b85139 100644
--- a/plugins/StopSpamPlus/src/settings.cpp
+++ b/plugins/StopSpamPlus/src/settings.cpp
@@ -1,59 +1,22 @@
#include "stdafx.h"
-//reading from database-------------
-tstring db_usage::DBGetPluginSetting(std::string const &name, tstring const &defValue)
+Settings g_sets;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+Settings::Settings() :
+ Question(pluginName, "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(pluginName, "AuthReply", TranslateW(L"StopSpam: send a message and reply to an anti-spam bot question.")),
+ Answer(pluginName, "Answer", L"nospam"),
+ Congratulation(pluginName, "Congratulation", TranslateW(L"Congratulations! You just passed human/robot test. Now you can write me a message.")),
+ DisabledProtoList(pluginName, "DisabledProtoList", "MetaContacts RSSNews"),
+ InfTalkProtection(pluginName, "InfTalkProtection", 1),
+ AddPermanent(pluginName, "AddPermanent", 0),
+ HandleAuthReq(pluginName, "HandleAuthReq", 0),
+ MaxQuestCount(pluginName, "MaxQuestCount", 2),
+ AnswNotCaseSens(pluginName, "AnswNotCaseSens", 1),
+ AnswSplitString(pluginName, "AnswSplitString", L"|"),
+ RemTmpAll(pluginName, "RemTmpAll", 1),
+ HistLog(pluginName, "HistLog", 0)
{
- DBVARIANT dbv;
- if (db_get_ws(NULL, pluginName, name.c_str(), &dbv))
- return defValue;
- tstring value = dbv.ptszVal;
- db_free(&dbv);
- return value;
}
-
-
-std::string db_usage::DBGetPluginSetting(std::string const &name, std::string const &defValue)
-{
- DBVARIANT dbv;
- if (db_get_s(NULL, pluginName, name.c_str(), &dbv))
- return defValue;
- std::string value = dbv.pszVal;
- db_free(&dbv);
- return value;
-}
-
-
-bool db_usage::DBGetPluginSetting(std::string const &name, bool const &defValue)
-{
- return(0 != db_get_b(NULL, pluginName, name.c_str(), defValue ? 1 : 0));
-}
-
-DWORD db_usage::DBGetPluginSetting(std::string const &name, DWORD const &defValue)
-{
- return db_get_dw(NULL, pluginName, name.c_str(), defValue);
-}
-
-//writting to database--------------
-void db_usage::DBSetPluginSetting(std::string const &name, tstring const &value)
-{
- db_set_ws(NULL, pluginName, name.c_str(), value.c_str());
-}
-
-
-void db_usage::DBSetPluginSetting(std::string const &name, std::string const &value)
-{
- db_set_s(NULL, pluginName, name.c_str(), value.c_str());
-}
-
-
-void db_usage::DBSetPluginSetting(std::string const &name, bool const &value)
-{
- db_set_b(NULL, pluginName, name.c_str(), value ? 1 : 0);
-}
-
-void db_usage::DBSetPluginSetting(std::string const &name, DWORD const &value)
-{
- db_set_dw(NULL, pluginName, name.c_str(), value);
-}
-
-Settings *plSets;
diff --git a/plugins/StopSpamPlus/src/settings.h b/plugins/StopSpamPlus/src/settings.h
index e52ec472b2..b1e735e88d 100644
--- a/plugins/StopSpamPlus/src/settings.h
+++ b/plugins/StopSpamPlus/src/settings.h
@@ -1,90 +1,18 @@
-class db_usage
-{
-public:
- //reading from database
- static tstring DBGetPluginSetting(std::string const &name, tstring const &defValue);
- static std::string DBGetPluginSetting(std::string const &name, std::string const &defValue);
- 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);
- static void DBSetPluginSetting(std::string const &name, std::string const &value);
- static void DBSetPluginSetting(std::string const &name, bool const &value);
- static void DBSetPluginSetting(std::string const &name, DWORD const &value);
-
-};
-template <typename T>
-class db_setting
+struct Settings
{
- std::string m_name;
- T m_defValue;
- T m_value;
-public:
- db_setting(std::string const &name, T const &defValue):m_name(name),m_defValue(defValue)
- {
- m_value=db_usage::DBGetPluginSetting(m_name, m_defValue);
- }
- const T & GetDefault()const{return m_defValue;}
- void Set(T const &value)
- {
- m_value=value;
- db_usage::DBSetPluginSetting(m_name, m_value);
- }
- const T & Get()const{return m_value;}
- db_setting<T>& operator=(T const &value)
- {
- m_value=value;
- db_usage::DBSetPluginSetting(m_name, m_value);
- return *this;
- }
- operator T(){return m_value;}
- void SetResident(BOOL bResident){
- db_set_resident(pluginName, m_name.c_str(), bResident);
- }
-};
+ Settings();
-class Settings
-{
-public:
- db_setting<tstring> Question;
- db_setting<tstring> AuthRepl;
- db_setting<tstring> Answer;
- db_setting<tstring> Congratulation;
- db_setting<std::string> DisabledProtoList;
- db_setting<bool> InfTalkProtection;
- db_setting<bool> AddPermanent;
- db_setting<DWORD> MaxQuestCount;
- db_setting<bool> HandleAuthReq;
- db_setting<bool> AnswNotCaseSens;
- db_setting<tstring> AnswSplitString;
- db_setting<bool> RemTmpAll;
- db_setting<bool> HistLog;
-
- Settings():
- Question("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("AuthReply", TranslateW(L"StopSpam: send a message and reply to an anti-spam bot question.")),
- Answer("Answer", L"nospam"),
- Congratulation("Congratulation", TranslateW(L"Congratulations! You just passed human/robot test. Now you can write me a message.")),
- DisabledProtoList("DisabledProtoList", "MetaContacts RSSNews"),
- InfTalkProtection("InfTalkProtection", 1),
- AddPermanent("AddPermanent", 0),
- HandleAuthReq("HandleAuthReq", 0),
- MaxQuestCount("MaxQuestCount", 2),
- AnswNotCaseSens("AnswNotCaseSens", 1),
- AnswSplitString("AnswSplitString", L"|"),
- RemTmpAll("RemTmpAll", 1),
- HistLog("HistLog", 0)
- {
- const std::string &str = DisabledProtoList.Get();
- if (!str.empty() && *(str.rbegin()) != ' ')
- DisabledProtoList = DisabledProtoList.Get() + ' ';
- }
+ CMOption<bool> InfTalkProtection, AddPermanent, HandleAuthReq, AnswNotCaseSens, RemTmpAll, HistLog;
+ CMOption<wchar_t*> Question, AuthRepl, Answer, Congratulation, AnswSplitString;
+ CMOption<char*> DisabledProtoList;
+ CMOption<DWORD> MaxQuestCount;
- bool ProtoDisabled(std::string proto)
+ bool ProtoDisabled(const char *proto)
{
- return std::string::npos != DisabledProtoList.Get().find(proto + " ");
+ std::string temp(proto); temp += ' ';
+ return strstr(DisabledProtoList, temp.c_str()) != nullptr;
}
};
-extern Settings *plSets;
+extern Settings g_sets;
diff --git a/plugins/StopSpamPlus/src/stdafx.h b/plugins/StopSpamPlus/src/stdafx.h
index c1a8802b21..d86a1345f6 100644
--- a/plugins/StopSpamPlus/src/stdafx.h
+++ b/plugins/StopSpamPlus/src/stdafx.h
@@ -38,7 +38,7 @@ extern HINSTANCE hInst;
// utils
tstring &GetDlgItemString(HWND hwnd, int id);
bool IsExistMyMessage(MCONTACT hContact);
-tstring variables_parse(tstring const &tstrFormat, MCONTACT hContact);
+tstring variables_parse(const wchar_t *tstrFormat, MCONTACT hContact);
tstring trim(tstring const &tstr, tstring const &trimChars = L" \f\n\r\t\v");
INT_PTR IsContactPassed(WPARAM wParam, LPARAM /*lParam*/);
diff --git a/plugins/StopSpamPlus/src/stopspam.cpp b/plugins/StopSpamPlus/src/stopspam.cpp
index 3409b6d8e8..ed9ba96a64 100644
--- a/plugins/StopSpamPlus/src/stopspam.cpp
+++ b/plugins/StopSpamPlus/src/stopspam.cpp
@@ -5,7 +5,6 @@ int hLangpack;
/////////////////////////////////////////////////////////////////////////////////////////
// returns plugin's extended information
-
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -39,8 +38,6 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getLP(&pluginInfoEx);
pcli = Clist_GetInterface();
- plSets = new Settings;
-
CreateServiceFunction(MS_STOPSPAM_CONTACTPASSED, IsContactPassed);
HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded);
@@ -49,23 +46,20 @@ extern "C" int __declspec(dllexport) Load(void)
HookEvent(ME_OPT_INITIALISE, OnOptInit);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnDbContactSettingchanged);
- // Add deliting temporary contacts
- CreateServiceFunction(MS_STOPSPAM_REMTEMPCONTACTS, RemoveTempContacts);
-
+ // Add deleting temporary contacts
CMenuItem mi;
SET_UID(mi, 0xf2164e17, 0xa4c1, 0x4b07, 0xae, 0x81, 0x9e, 0xae, 0x7f, 0xa2, 0x55, 0x13);
mi.position = -0x7FFFFFFF;
mi.flags = CMIF_UNICODE;
mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
mi.name.w = LPGENW("Remove Temporary Contacts");
- mi.pszService = pluginName"/RemoveTempContacts";
+ mi.pszService = "StopSpam/RemoveTempContacts";
Menu_AddMainMenuItem(&mi);
-
+ CreateServiceFunction(mi.pszService, RemoveTempContacts);
return 0;
}
extern "C" int __declspec(dllexport) Unload(void)
{
- delete plSets;
return 0;
} \ No newline at end of file
diff --git a/plugins/StopSpamPlus/src/utils.cpp b/plugins/StopSpamPlus/src/utils.cpp
index f2aea2b380..897c403178 100644
--- a/plugins/StopSpamPlus/src/utils.cpp
+++ b/plugins/StopSpamPlus/src/utils.cpp
@@ -31,13 +31,13 @@ bool IsExistMyMessage(MCONTACT hContact)
return false;
}
-tstring variables_parse(tstring const &tstrFormat, MCONTACT hContact)
+tstring variables_parse(const wchar_t *tstrFormat, MCONTACT hContact)
{
if (ServiceExists(MS_VARS_FORMATSTRING)) {
FORMATINFO fi;
memset(&fi, 0, sizeof(fi));
fi.cbSize = sizeof(fi);
- fi.tszFormat = wcsdup(tstrFormat.c_str());
+ fi.tszFormat = wcsdup(tstrFormat);
fi.hContact = hContact;
fi.flags |= FIF_TCHAR;
wchar_t *tszParsed = (wchar_t *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0);
diff --git a/plugins/StopSpamPlus/src/version.h b/plugins/StopSpamPlus/src/version.h
index dc84021f01..369ce2f5d8 100644
--- a/plugins/StopSpamPlus/src/version.h
+++ b/plugins/StopSpamPlus/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 0
-#define __RELEASE_NUM 1
-#define __BUILD_NUM 5
+#define __MINOR_VERSION 1
+#define __RELEASE_NUM 0
+#define __BUILD_NUM 1
#include <stdver.h>