diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-03 16:30:25 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-03 16:30:25 +0300 |
commit | 9613f96e6a6f96ad02a0fc926054132811ae2bb1 (patch) | |
tree | f8fe94a3efe7598a2af926f264d354f7a08fb943 /plugins/Spamotron | |
parent | 2f880bda3aa2d8817ce43481df9d99b12ed82a58 (diff) |
Accounts() : iterator for accounts
Diffstat (limited to 'plugins/Spamotron')
-rw-r--r-- | plugins/Spamotron/src/options.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp index f4d4733a49..43035e9f59 100644 --- a/plugins/Spamotron/src/options.cpp +++ b/plugins/Spamotron/src/options.cpp @@ -91,8 +91,7 @@ extern HINSTANCE hInst; INT_PTR CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- static int bInitializing = 0, i, j, numProtocols;
- PROTOACCOUNT **pd;
+ static int bInitializing = 0, i, j;
wchar_t pName[256] = {0};
char protoOption[256] = {0};
HWND hProtocolsList = GetDlgItem(optDlg, IDC_OPT_PROTOCOLS);
@@ -125,18 +124,17 @@ INT_PTR CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM lvc.cx = 120;
ListView_InsertColumn(hProtocolsList, 0, &lvc);
lvi.mask = LVIF_TEXT | LVIF_STATE;
- Proto_EnumAccounts(&numProtocols, &pd);
- for (i = 0, j = 0; i < numProtocols; i++)
- {
+
+ for (auto &pa : Accounts()) {
lvi.iItem = i;
- _getMOptS(pName, 200*sizeof(wchar_t), pd[i]->szModuleName, "AM_BaseProto", L"");
+ _getMOptS(pName, 200*sizeof(wchar_t), pa->szModuleName, "AM_BaseProto", L"");
if (mir_wstrcmp(pName, L"ICQ") != 0)
continue;
- lvi.pszText = mir_a2u(pd[i]->szModuleName);
+ lvi.pszText = mir_a2u(pa->szModuleName);
ListView_InsertItem(hProtocolsList, &lvi);
memset(protoOption, 0, sizeof(protoOption));
mir_strcat(protoOption, "proto_");
- mir_strcat(protoOption, pd[i]->szModuleName);
+ mir_strcat(protoOption, pa->szModuleName);
ListView_SetCheckState(hProtocolsList, j++, _getOptB(protoOption, 0));
}
@@ -196,7 +194,8 @@ INT_PTR CALLBACK DlgProcOptionsMain(HWND optDlg, UINT msg, WPARAM wParam, LPARAM _saveDlgItemText(optDlg, IDC_OPT_DONT_REPLY_MSG_WORDLIST, "DontReplyMsgWordlist");
_saveDlgItemInt(optDlg, IDC_OPT_MAX_MSG_CONTACT, "MaxMsgContactCountPerDay");
_saveDlgItemInt(optDlg, IDC_OPT_MAX_SAME_MSG, "MaxSameMsgCountPerDay");
- numProtocols = ListView_GetItemCount(hProtocolsList);
+
+ int numProtocols = ListView_GetItemCount(hProtocolsList);
for (i = 0; i < numProtocols; i++) {
ListView_GetItemText(hProtocolsList, i, 0, buf, _countof(buf));
//wcstombs(protoName, buf, _countof(buf));
|