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/MirandaG15/src | |
parent | 2f880bda3aa2d8817ce43481df9d99b12ed82a58 (diff) |
Accounts() : iterator for accounts
Diffstat (limited to 'plugins/MirandaG15/src')
-rw-r--r-- | plugins/MirandaG15/src/CAppletManager.cpp | 11 | ||||
-rw-r--r-- | plugins/MirandaG15/src/CConfig.cpp | 11 |
2 files changed, 6 insertions, 16 deletions
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;
|