summaryrefslogtreecommitdiff
path: root/plugins/StopSpamMod
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-03 16:30:25 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-03 16:30:25 +0300
commit9613f96e6a6f96ad02a0fc926054132811ae2bb1 (patch)
treef8fe94a3efe7598a2af926f264d354f7a08fb943 /plugins/StopSpamMod
parent2f880bda3aa2d8817ce43481df9d99b12ed82a58 (diff)
Accounts() : iterator for accounts
Diffstat (limited to 'plugins/StopSpamMod')
-rwxr-xr-xplugins/StopSpamMod/src/options.cpp12
-rwxr-xr-xplugins/StopSpamMod/src/utilities.cpp9
2 files changed, 8 insertions, 13 deletions
diff --git a/plugins/StopSpamMod/src/options.cpp b/plugins/StopSpamMod/src/options.cpp
index 86ef404329..7d7e6f5770 100755
--- a/plugins/StopSpamMod/src/options.cpp
+++ b/plugins/StopSpamMod/src/options.cpp
@@ -123,18 +123,16 @@ public:
btn_ADDALL.OnClick = Callback(this, &COptProtoDlg::onClick_ADDALL);
btn_REMOVEALL.OnClick = Callback(this, &COptProtoDlg::onClick_REMOVEALL);
}
+
virtual void OnInitDialog() override
{
- int nAccs;
- PROTOACCOUNT **pppd;
- Proto_EnumAccounts(&nAccs, &pppd);
- for (int i = 0; i < nAccs; ++i)
- {
- wchar_t *str = mir_utf8decodeW(pppd[i]->szModuleName);
- ProtoInList(pppd[i]->szModuleName) ? list_USEDPROTO.AddString(str) : list_ALLPROTO.AddString(str);
+ for (auto &pa : Accounts()) {
+ wchar_t *str = mir_utf8decodeW(pa->szModuleName);
+ ProtoInList(pa->szModuleName) ? list_USEDPROTO.AddString(str) : list_ALLPROTO.AddString(str);
mir_free(str);
}
}
+
virtual void OnApply() override
{
diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp
index be3667ed3a..b001fa98db 100755
--- a/plugins/StopSpamMod/src/utilities.cpp
+++ b/plugins/StopSpamMod/src/utilities.cpp
@@ -305,12 +305,9 @@ void __cdecl CleanProtocolExclThread(void *param)
void __cdecl CleanThread(void*)
{
std::list<std::string> protocols;
- int count = 0;
- PROTOACCOUNT **accounts;
- Proto_EnumAccounts(&count, &accounts);
- for (int i = 0; i < count; i++)
- if (!strstr(accounts[i]->szModuleName, "MetaContacts") && !strstr(accounts[i]->szModuleName, "Weather")) //not real protocols
- protocols.push_back(accounts[i]->szModuleName);
+ for (auto &pa : Accounts())
+ if (!strstr(pa->szModuleName, "MetaContacts") && !strstr(pa->szModuleName, "Weather")) //not real protocols
+ protocols.push_back(pa->szModuleName);
std::list<std::string>::iterator end = protocols.end();
for (std::list<std::string>::iterator i = protocols.begin(); i != end; ++i) {