From 9613f96e6a6f96ad02a0fc926054132811ae2bb1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 3 Apr 2018 16:30:25 +0300 Subject: Accounts() : iterator for accounts --- plugins/StopSpamPlus/src/options.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'plugins/StopSpamPlus') diff --git a/plugins/StopSpamPlus/src/options.cpp b/plugins/StopSpamPlus/src/options.cpp index 158f0f5acd..db5d0f6588 100644 --- a/plugins/StopSpamPlus/src/options.cpp +++ b/plugins/StopSpamPlus/src/options.cpp @@ -115,19 +115,14 @@ public: item.mask = LVIF_TEXT | LVIF_PARAM; item.iItem = 1000; - int n; - PROTOACCOUNT **pa; - Proto_EnumAccounts(&n, &pa); - - for (int i = 0; i < n; i++) { - PROTOACCOUNT *p = pa[i]; - if (!p->IsEnabled() || p->bIsVirtual) + for (auto &pa : Accounts()) { + if (!pa->IsEnabled() || pa->bIsVirtual) continue; - item.lParam = (LPARAM)p->szModuleName; - item.pszText = p->tszAccountName; + item.lParam = (LPARAM)pa->szModuleName; + item.pszText = pa->tszAccountName; int idx = m_accounts.InsertItem(&item); - m_accounts.SetCheckState(idx, g_sets.ProtoDisabled(p->szModuleName)); + m_accounts.SetCheckState(idx, g_sets.ProtoDisabled(pa->szModuleName)); } } -- cgit v1.2.3