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/MirandaG15/src/CAppletManager.cpp | 11 +++-------- plugins/MirandaG15/src/CConfig.cpp | 11 +++-------- 2 files changed, 6 insertions(+), 16 deletions(-) (limited to 'plugins/MirandaG15/src') diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 3abdd9c0cb..2f3375b481 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -81,23 +81,18 @@ bool CAppletManager::Initialize(tstring strAppletName) m_hMIHookChatEvent = HookEvent(ME_GC_HOOK_EVENT, CAppletManager::HookChatInbound); // enumerate protocols - int iCount; int iProtoCount = 0; - PROTOACCOUNT **ppAccounts; CProtocolData *pProtoData = nullptr; CIRCConnection *pIRCConnection = nullptr; - Proto_EnumAccounts(&iCount, &ppAccounts); - for (int i = 0; i < iCount; i++) { - /**if(ppProtocolDescriptor[i]->type != PROTOTYPE_PROTOCOL) - continue;**/ - if (ppAccounts[i]->bIsEnabled == 0) + for (auto &pa : Accounts()) { + if (pa->bIsEnabled == 0) continue; iProtoCount++; pProtoData = new CProtocolData(); pProtoData->iStatus = ID_STATUS_OFFLINE; - pProtoData->strProtocol = toTstring(ppAccounts[i]->szModuleName); + pProtoData->strProtocol = toTstring(pa->szModuleName); pProtoData->lTimeStamp = 0; // try to create an irc connection for that protocol (will fail if it is no irc protocol) diff --git a/plugins/MirandaG15/src/CConfig.cpp b/plugins/MirandaG15/src/CConfig.cpp index 351755a572..0d56bdf3a6 100644 --- a/plugins/MirandaG15/src/CConfig.cpp +++ b/plugins/MirandaG15/src/CConfig.cpp @@ -110,22 +110,17 @@ void CConfig::LoadSettings() LoadFontSettings(i); // Load protocol specific settings - int iCount; int iProtoCount = 0; - PROTOACCOUNT **ppAccounts; CProtoFilter *pProtoFilter; tstring strSetting; - Proto_EnumAccounts(&iCount, &ppAccounts); - for (int i = 0; i < iCount; i++) { - /*if(ppProtocolDescriptor[i]->type != PROTOTYPE_PROTOCOL) - continue;*/ - if (ppAccounts[i]->bIsEnabled == 0) + for (auto &pa : Accounts()) { + if (pa->bIsEnabled == 0) continue; iProtoCount++; pProtoFilter = new CProtoFilter(); - pProtoFilter->strName = toTstring(ppAccounts[i]->szModuleName); + pProtoFilter->strName = toTstring(pa->szModuleName); strSetting = L"ProtoFilter_" + pProtoFilter->strName; pProtoFilter->bNotificationFilter = db_get_dw(NULL, "MirandaG15", toNarrowString(strSetting).c_str(), 1) != 0; -- cgit v1.2.3