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 /plugins/DbEditorPP | |
parent | 2f880bda3aa2d8817ce43481df9d99b12ed82a58 (diff) |
Accounts() : iterator for accounts
Diffstat (limited to 'plugins/DbEditorPP')
-rw-r--r-- | plugins/DbEditorPP/src/icons.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/plugins/DbEditorPP/src/icons.cpp b/plugins/DbEditorPP/src/icons.cpp index 6a98c9a86d..a80958d752 100644 --- a/plugins/DbEditorPP/src/icons.cpp +++ b/plugins/DbEditorPP/src/icons.cpp @@ -72,14 +72,10 @@ HIMAGELIST LoadIcons() for (auto &it : dbeIcons)
ImageList_AddIcon(hil, LoadSkinnedDBEIcon(it));
- int protoCount = 0;
- PROTOACCOUNT **protocols = nullptr;
- Proto_EnumAccounts(&protoCount, &protocols);
-
- for (int i = 0; i < protoCount; i++) {
- if (!Proto_GetAccount(protocols[i]->szModuleName))
+ for (auto &pa : Accounts()) {
+ if (!Proto_GetAccount(pa->szModuleName))
ImageList_AddIcon(hil, LoadSkinnedDBEIcon(ICO_OFFLINE));
- else if (hIcon = Skin_LoadProtoIcon(protocols[i]->szModuleName, ID_STATUS_ONLINE))
+ else if (hIcon = Skin_LoadProtoIcon(pa->szModuleName, ID_STATUS_ONLINE))
ImageList_AddIcon(hil, hIcon);
else
ImageList_AddIcon(hil, LoadSkinnedDBEIcon(ICO_ONLINE));
@@ -91,13 +87,10 @@ HIMAGELIST LoadIcons() int GetProtoIconIndex(const char *szProto)
{
if (szProto && szProto[0]) {
- int protoCount = 0;
- PROTOACCOUNT **protocols = nullptr;
- Proto_EnumAccounts(&protoCount, &protocols);
-
- for (int i = 0; i < protoCount; i++)
- if (!mir_strcmp(protocols[i]->szModuleName, szProto))
- return i + _countof(dbeIcons);
+ auto &accs = Accounts();
+ for (auto &pa : accs)
+ if (!mir_strcmp(pa->szModuleName, szProto))
+ return accs.indexOf(&pa) + _countof(dbeIcons);
if (Proto_GetAccount(szProto))
return _countof(dbeIcons) - 2; // ICO_ONLINE;
|