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/Clist_blind/src/clistopts.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'plugins/Clist_blind/src') diff --git a/plugins/Clist_blind/src/clistopts.cpp b/plugins/Clist_blind/src/clistopts.cpp index 05423af61c..7192649702 100644 --- a/plugins/Clist_blind/src/clistopts.cpp +++ b/plugins/Clist_blind/src/clistopts.cpp @@ -90,16 +90,13 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP int item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)TranslateT("Global")); SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)0); - int count; - PROTOACCOUNT **accs; - Proto_EnumAccounts(&count, &accs); - for (int i = 0; i < count; i++) { - if (!accs[i]->IsEnabled() || CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0) + for (auto &pa : Accounts()) { + if (!pa->IsEnabled() || CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0) continue; - item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)accs[i]->tszAccountName); - SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)accs[i]); - if (!mir_strcmp(szPrimaryStatus, accs[i]->szModuleName)) + item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)pa->tszAccountName); + SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETITEMDATA, item, (LPARAM)pa); + if (!mir_strcmp(szPrimaryStatus, pa->szModuleName)) SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_SETCURSEL, item, 0); } } -- cgit v1.2.3