diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-03 16:30:25 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-03 16:30:25 +0300 |
commit | 9613f96e6a6f96ad02a0fc926054132811ae2bb1 (patch) | |
tree | f8fe94a3efe7598a2af926f264d354f7a08fb943 /utils | |
parent | 2f880bda3aa2d8817ce43481df9d99b12ed82a58 (diff) |
Accounts() : iterator for accounts
Diffstat (limited to 'utils')
-rw-r--r-- | utils/mir_options.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/utils/mir_options.cpp b/utils/mir_options.cpp index 0f4239def3..c027b4e7e1 100644 --- a/utils/mir_options.cpp +++ b/utils/mir_options.cpp @@ -207,25 +207,20 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha lvi.iSubItem = 0; lvi.iItem = 1000; - int count; - PROTOACCOUNT **protos; - Proto_EnumAccounts(&count, &protos); - - for (int k = 0; k < count; k++) { - PROTOACCOUNT *p = protos[k]; - if (p->szModuleName == nullptr || p->szModuleName[0] == '\0') + for (auto &pa : Accounts()) { + if (pa->szModuleName == nullptr || pa->szModuleName[0] == '\0') continue; - if (ctrl->allowProtocol != nullptr && !ctrl->allowProtocol(p->szModuleName)) + if (ctrl->allowProtocol != nullptr && !ctrl->allowProtocol(pa->szModuleName)) continue; char *setting = (char *)mir_alloc(128 * sizeof(char)); - mir_snprintf(setting, 128, ctrl->setting, p->szModuleName); + mir_snprintf(setting, 128, ctrl->setting, pa->szModuleName); BOOL show = (BOOL)db_get_b(NULL, module, setting, ctrl->dwDefValue); lvi.lParam = (LPARAM)setting; - lvi.pszText = p->tszAccountName; + lvi.pszText = pa->tszAccountName; lvi.iItem = ListView_InsertItem(hwndProtocols, &lvi); ListView_SetItemState(hwndProtocols, lvi.iItem, INDEXTOSTATEIMAGEMASK(show ? 2 : 1), LVIS_STATEIMAGEMASK); } |