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/TipperYM/src/options.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'plugins/TipperYM/src') diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 02786dbd07..13cf5ad354 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -1916,17 +1916,13 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA tvi.hInsertAfter = TVI_LAST; tvi.item.mask = TVIF_TEXT | TVIF_STATE; - int count = 0; - PROTOACCOUNT **accs; - Proto_EnumAccounts(&count, &accs); - - for (int i = 0; i < count; i++) { - if (CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) != 0) { - tvi.item.pszText = accs[i]->tszAccountName; + for (auto &pa : Accounts()) { + if (CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) != 0) { + tvi.item.pszText = pa->tszAccountName; tvi.item.stateMask = TVIS_STATEIMAGEMASK; - tvi.item.state = INDEXTOSTATEIMAGEMASK(IsTrayProto(accs[i]->tszAccountName, false) ? 2 : 1); + tvi.item.state = INDEXTOSTATEIMAGEMASK(IsTrayProto(pa->tszAccountName, false) ? 2 : 1); TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS), &tvi); - tvi.item.state = INDEXTOSTATEIMAGEMASK(IsTrayProto(accs[i]->tszAccountName, true) ? 2 : 1); + tvi.item.state = INDEXTOSTATEIMAGEMASK(IsTrayProto(pa->tszAccountName, true) ? 2 : 1); TreeView_InsertItem(GetDlgItem(hwndDlg, IDC_TREE_SECOND_PROTOS), &tvi); } } -- cgit v1.2.3