mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
extract params
This commit is contained in:
parent
0339a4f963
commit
bc11689f35
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user