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/HistoryStats/src/dlgoption_subglobal.cpp | 13 ++----------- plugins/HistoryStats/src/dlgoption_subinput.cpp | 13 ++----------- plugins/HistoryStats/src/mirandahistory.cpp | 10 +++------- 3 files changed, 7 insertions(+), 29 deletions(-) (limited to 'plugins/HistoryStats/src') diff --git a/plugins/HistoryStats/src/dlgoption_subglobal.cpp b/plugins/HistoryStats/src/dlgoption_subglobal.cpp index 2ceed39e26..5f340c857e 100644 --- a/plugins/HistoryStats/src/dlgoption_subglobal.cpp +++ b/plugins/HistoryStats/src/dlgoption_subglobal.cpp @@ -239,17 +239,8 @@ void DlgOption::SubGlobal::onWMInitDialog() // insert known protocols m_hHideContactMenuProtos.clear(); - PROTOACCOUNT **protoList; - int protoCount; - Proto_EnumAccounts(&protoCount, &protoList); - upto_each_(i, protoCount) - { - m_hHideContactMenuProtos.push_back(m_Options.insertCheck( - m_hProtocols, - protoList[i]->tszAccountName, - 0, - reinterpret_cast(protoList[i]->szModuleName))); - } + for (auto &pa : Accounts()) + m_hHideContactMenuProtos.push_back(m_Options.insertCheck(m_hProtocols, pa->tszAccountName, 0, INT_PTR(pa->szModuleName))); m_Options.ensureVisible(nullptr); diff --git a/plugins/HistoryStats/src/dlgoption_subinput.cpp b/plugins/HistoryStats/src/dlgoption_subinput.cpp index f87cf76cde..31f836c87f 100644 --- a/plugins/HistoryStats/src/dlgoption_subinput.cpp +++ b/plugins/HistoryStats/src/dlgoption_subinput.cpp @@ -99,17 +99,8 @@ void DlgOption::SubInput::onWMInitDialog() // insert known protocols m_hProtosIgnore.clear(); - PROTOACCOUNT **protoList; - int protoCount; - Proto_EnumAccounts(&protoCount, &protoList); - upto_each_(i, protoCount) - { - m_hProtosIgnore.push_back(m_Options.insertCheck( - m_hProtocols, - protoList[i]->tszAccountName, - 0, - reinterpret_cast(protoList[i]->szModuleName))); - } + for (auto &pa : Accounts()) + m_hProtosIgnore.push_back(m_Options.insertCheck(m_hProtocols, pa->tszAccountName, 0, INT_PTR(pa->szModuleName))); // diable filtering raw RTF if 'rtfconv.dll' isn't available if (!RTFFilter::available()) diff --git a/plugins/HistoryStats/src/mirandahistory.cpp b/plugins/HistoryStats/src/mirandahistory.cpp index 792b6fcf46..6caea4fb75 100644 --- a/plugins/HistoryStats/src/mirandahistory.cpp +++ b/plugins/HistoryStats/src/mirandahistory.cpp @@ -11,13 +11,9 @@ void MirandaHistory::populateProtocols() { m_Protocols.clear(); - PROTOACCOUNT **protoList; - int protoCount; - Proto_EnumAccounts(&protoCount, &protoList); - upto_each_(i, protoCount) - { - ext::a::string protoName = protoList[i]->szModuleName; - m_Protocols[protoName] = protoList[i]->tszAccountName; + for (auto &pa : Accounts()) { + ext::a::string protoName = pa->szModuleName; + m_Protocols[protoName] = pa->tszAccountName; } m_DefaultProtocol = TranslateT("(Unknown)"); -- cgit v1.2.3