mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00: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);
|
std::string method = pt.get<std::string>(I2P_CONTROL_PROPERTY_METHOD);
|
||||||
auto it = m_MethodHanders.find (method);
|
auto it = m_MethodHanders.find (method);
|
||||||
if (it != m_MethodHanders.end ())
|
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
|
else
|
||||||
LogPrint (eLogWarning, "Unknown I2PControl method ", method);
|
LogPrint (eLogWarning, "Unknown I2PControl method ", method);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ namespace client
|
|||||||
boost::asio::io_service m_Service;
|
boost::asio::io_service m_Service;
|
||||||
boost::asio::ip::tcp::acceptor m_Acceptor;
|
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;
|
std::map<std::string, MethodHandler> m_MethodHanders;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user