From bc11689f358054a3b004075c559e3fe9e65b2321 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 7 Jan 2015 16:41:11 -0500 Subject: [PATCH] extract params --- I2PControl.cpp | 10 +++++++++- I2PControl.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/I2PControl.cpp b/I2PControl.cpp index efb425e2..203dce8e 100644 --- a/I2PControl.cpp +++ b/I2PControl.cpp @@ -106,7 +106,15 @@ namespace client std::string method = pt.get(I2P_CONTROL_PROPERTY_METHOD); auto it = m_MethodHanders.find (method); if (it != m_MethodHanders.end ()) - (this->*(it->second))(); + { + std::map params; + for (auto& v: pt.get_child (I2P_CONTROL_PROPERTY_PARAMS)) + { + if (!v.first.empty()) + params[v.first] = v.second.data (); + } + (this->*(it->second))(params); + } else LogPrint (eLogWarning, "Unknown I2PControl method ", method); } diff --git a/I2PControl.h b/I2PControl.h index 38dca6b1..f46afcb7 100644 --- a/I2PControl.h +++ b/I2PControl.h @@ -48,7 +48,7 @@ namespace client boost::asio::io_service m_Service; boost::asio::ip::tcp::acceptor m_Acceptor; - typedef void (I2PControlService::*MethodHandler)(); + typedef void (I2PControlService::*MethodHandler)(const std::map& params); std::map m_MethodHanders; }; }