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 --- src/core/stduseronline/src/useronline.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/core/stduseronline') diff --git a/src/core/stduseronline/src/useronline.cpp b/src/core/stduseronline/src/useronline.cpp index 2a3c16d49f..ab01edd77a 100644 --- a/src/core/stduseronline/src/useronline.cpp +++ b/src/core/stduseronline/src/useronline.cpp @@ -84,14 +84,9 @@ static int UserOnlineAck(WPARAM, LPARAM lParam) static int UserOnlineModulesLoaded(WPARAM, LPARAM) { - int numAccounts; - PROTOACCOUNT** accounts; - Proto_EnumAccounts(&numAccounts, &accounts); - - // reset the counter - for (int i = 0; i < numAccounts; i++) - if (accounts[i]->IsEnabled()) - db_set_dw(NULL, "UserOnline", accounts[i]->szModuleName, GetTickCount()); + for (auto &pa : Accounts()) + if (pa->IsEnabled()) + db_set_dw(NULL, "UserOnline", pa->szModuleName, GetTickCount()); return 0; } -- cgit v1.2.3