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/AddContactPlus/src/main.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'plugins/AddContactPlus/src/main.cpp') diff --git a/plugins/AddContactPlus/src/main.cpp b/plugins/AddContactPlus/src/main.cpp index 9c80075431..30611ab8aa 100644 --- a/plugins/AddContactPlus/src/main.cpp +++ b/plugins/AddContactPlus/src/main.cpp @@ -74,15 +74,12 @@ static INT_PTR AddContactPlusDialog(WPARAM, LPARAM) static int OnAccListChanged(WPARAM, LPARAM) { - PROTOACCOUNT** pAccounts; - int iRealAccCount, iAccCount = 0; - - Proto_EnumAccounts(&iRealAccCount, &pAccounts); - for (int i = 0; i < iRealAccCount; i++) { - if (!pAccounts[i]->IsEnabled()) + int iAccCount = 0; + for (auto &pa : Accounts()) { + if (!pa->IsEnabled()) continue; - DWORD dwCaps = (DWORD)CallProtoService(pAccounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + DWORD dwCaps = (DWORD)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if (dwCaps & PF1_BASICSEARCH || dwCaps & PF1_EXTSEARCH || dwCaps & PF1_SEARCHBYEMAIL || dwCaps & PF1_SEARCHBYNAME) iAccCount++; } -- cgit v1.2.3