extract params

This commit is contained in:
orignal 2015-01-07 16:41:11 -05:00
parent 0339a4f963
commit bc11689f35
2 changed files with 10 additions and 2 deletions

View File

@ -106,7 +106,15 @@ namespace client
std::string method = pt.get<std::string>(I2P_CONTROL_PROPERTY_METHOD);
auto it = m_MethodHanders.find (method);
if (it != m_MethodHanders.end ())
(this->*(it->second))();
{
std::map<std::string, std::string> 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);
}

View File

@ -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<std::string, std::string>& params);
std::map<std::string, MethodHandler> m_MethodHanders;
};
}