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/stdaway/src/sendmsg.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'src/core/stdaway') diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp index 52b727f8fe..cbdfe8e782 100644 --- a/src/core/stdaway/src/sendmsg.cpp +++ b/src/core/stdaway/src/sendmsg.cpp @@ -172,12 +172,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar void ChangeAllProtoMessages(char *szProto, int statusMode, wchar_t *msg) { if (szProto == nullptr) { - int nAccounts; - PROTOACCOUNT **accounts; - Proto_EnumAccounts(&nAccounts, &accounts); - - for (int i = 0; i < nAccounts; i++) { - PROTOACCOUNT *pa = accounts[i]; + for (auto &pa : Accounts()) { if (!pa->IsEnabled()) continue; @@ -536,15 +531,9 @@ static int AwayMsgSendAccountsChanged(WPARAM, LPARAM) { protoModeMsgFlags = 0; - int nAccounts; - PROTOACCOUNT **accounts; - Proto_EnumAccounts(&nAccounts, &accounts); - for (int i = 0; i < nAccounts; i++) { - if (!accounts[i]->IsEnabled()) - continue; - - protoModeMsgFlags |= CallProtoService(accounts[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0); - } + for (auto &pa : Accounts()) + if (pa->IsEnabled()) + protoModeMsgFlags |= CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0); return 0; } -- cgit v1.2.3