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/SecureIM/src/crypt_lists.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'plugins/SecureIM/src') diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp index 5844557134..e927f7a853 100644 --- a/plugins/SecureIM/src/crypt_lists.cpp +++ b/plugins/SecureIM/src/crypt_lists.cpp @@ -19,16 +19,12 @@ void loadSupportedProtocols() db_set_s(0, MODULENAME, "protos", szNames); } - int numberOfProtocols; - PROTOACCOUNT **protos; - Proto_EnumAccounts(&numberOfProtocols, &protos); - - for (int i = 0; i < numberOfProtocols; i++) { - if (!protos[i]->szModuleName || !CallProtoService(protos[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)) + for (auto &pa : Accounts()) { + if (!pa->szModuleName || !CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)) continue; SupPro *p = (SupPro*)mir_calloc(sizeof(SupPro)); - p->name = mir_strdup(protos[i]->szModuleName); + p->name = mir_strdup(pa->szModuleName); if (szNames && p->name) { char tmp[128]; strncpy(tmp, p->name, sizeof(tmp) - 1); mir_strncat(tmp, ":", _countof(tmp) - mir_strlen(tmp)); LPSTR szName = strstr(szNames, tmp); -- cgit v1.2.3