From 0fa08124e61618acc0d3c4cc6e9050fa1eed1832 Mon Sep 17 00:00:00 2001 From: HanzZ Date: Tue, 18 Oct 2011 19:25:53 +0200 Subject: [PATCH] link spectrum2 against boost/swiften --- backends/frotz/main.cpp | 14 ++++++++++++++ spectrum/src/CMakeLists.txt | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/backends/frotz/main.cpp b/backends/frotz/main.cpp index c54466f9..cf9737f4 100644 --- a/backends/frotz/main.cpp +++ b/backends/frotz/main.cpp @@ -146,8 +146,22 @@ static void start_dfrotz(dfrotz &p, const std::string &game) { class FrotzNetworkPlugin : public NetworkPlugin { public: + Swift::BoostNetworkFactories *m_factories; + Swift::BoostIOServiceThread m_boostIOServiceThread; + boost::shared_ptr m_conn; + FrotzNetworkPlugin(Config *config, Swift::SimpleEventLoop *loop, const std::string &host, int port) : NetworkPlugin() { this->config = config; + m_factories = new Swift::BoostNetworkFactories(loop); + m_conn = m_factories->getConnectionFactory()->createConnection(); + m_conn->onDataRead.connect(boost::bind(&FrotzNetworkPlugin::_handleDataRead, this, _1)); +// m_conn->onConnectFinished.connect(boost::bind(&FrotzNetworkPlugin::_handleConnected, this, _1)); +// m_conn->onDisconnected.connect(boost::bind(&FrotzNetworkPlugin::handleDisconnected, this)); + } + + void _handleDataRead(boost::shared_ptr data) { + std::string d = Swift::safeByteArrayToString(*data); + handleDataRead(d); } void handleLoginRequest(const std::string &user, const std::string &legacyName, const std::string &password) { diff --git a/spectrum/src/CMakeLists.txt b/spectrum/src/CMakeLists.txt index c2b3d0ad..5a78327f 100644 --- a/spectrum/src/CMakeLists.txt +++ b/spectrum/src/CMakeLists.txt @@ -6,7 +6,7 @@ ADD_EXECUTABLE(spectrum2 ${SRC}) ADD_DEPENDENCIES(spectrum2 spectrum2_libpurple_backend) ADD_DEPENDENCIES(spectrum2 spectrum2_libircclient-qt_backend) -target_link_libraries(spectrum2 transport) +target_link_libraries(spectrum2 transport ${Boost_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES}) INSTALL(TARGETS spectrum2 RUNTIME DESTINATION bin)