Browse Source

extract params

pull/146/head
orignal 10 years ago
parent
commit
bc11689f35
  1. 10
      I2PControl.cpp
  2. 2
      I2PControl.h

10
I2PControl.cpp

@ -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);
} }

2
I2PControl.h

@ -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…
Cancel
Save