Changeset - 1c04886a3686
[Not reviewed]
0 6 0
Vitaly Takmazov - 10 years ago 2016-01-21 13:58:35
vitalyster@gmail.com
win32 build fixes
6 files changed with 26 insertions and 16 deletions:
0 comments (0 inline, 0 general)
CMakeLists.txt
Show inline comments
 
@@ -229,110 +229,109 @@ endif()
 
	if(LOG4CXX_INCLUDE_DIR AND LOG4CXX_LIBRARY)
 
		set(LOG4CXX_LIBRARIES ${LOG4CXX_LIBRARY})
 
		set(LOG4CXX_FOUND 1)
 
		message(STATUS "Using log4cxx: ${CPPUNIT_INCLUDE_DIR} ${LOG4CXX_INCLUDE_DIR}")
 
	else()
 
		set(log4cxx_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
 
		find_package(log4cxx)
 
	endif()
 
# endif()
 

	
 
# FIND CPPUNIT
 
if(ENABLE_TESTS)
 
	set(cppunit_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
 
	find_package(cppunit)
 

	
 
	if(NOT CPPUNIT_FOUND AND CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARY)
 
		set(CCPUNIT_LIBRARIES ${CPPUNIT_LIBRARY})
 
		set(CPPUNIT_FOUND 1)
 
		message(STATUS "Using cppunit: ${CPPUNIT_INCLUDE_DIR} ${CPPUNIT_LIBRARIES}")
 
	endif()
 
endif()
 

	
 
message("  Supported features")
 
message("-----------------------")
 

	
 
if (SPECTRUM_VERSION)
 
	ADD_DEFINITIONS(-DSPECTRUM_VERSION="${SPECTRUM_VERSION}")
 
else (SPECTRUM_VERSION)
 
	if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
 
		if (NOT GIT_EXECUTABLE)
 
		set (GIT_EXECUTABLE git)
 
		endif()
 
		execute_process(COMMAND ${GIT_EXECUTABLE} "--git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git" rev-parse --short HEAD
 
						OUTPUT_VARIABLE GIT_REVISION
 
						OUTPUT_STRIP_TRAILING_WHITESPACE
 
		)
 
		set(SPECTRUM_VERSION 2.0.0-git-${GIT_REVISION})
 
		ADD_DEFINITIONS(-DSPECTRUM_VERSION="${SPECTRUM_VERSION}")
 
	else (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
 
		set(SPECTRUM_VERSION 2.0.0)
 
		ADD_DEFINITIONS(-DSPECTRUM_VERSION="${SPECTRUM_VERSION}")
 
	endif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
 
endif (SPECTRUM_VERSION)
 

	
 
message("Version           : " ${SPECTRUM_VERSION})
 

	
 
if (SQLITE3_FOUND)
 
	ADD_DEFINITIONS(-DWITH_SQLITE)
 
if (WIN32)
 
	include_directories("${CMAKE_SOURCE_DIR}/msvc-deps/sqlite3")
 
	message("SQLite3           : bundled")
 
else (WIN32)
 
	include_directories(${SQLITE3_INCLUDE_DIR})
 
	message("SQLite3           : yes")
 
endif (WIN32)
 
else (SQLITE3_FOUND)
 
	if (WIN32)
 
		ADD_DEFINITIONS(-DWITH_SQLITE)
 
		include_directories("${CMAKE_SOURCE_DIR}/msvc-deps/sqlite3")
 
		message("SQLite3           : bundled")
 
	else()
 
		set(SQLITE3_LIBRARIES "")
 
		if(ENABLE_SQLITE3)
 
			message("SQLite3           : no (install sqlite3)")
 
		else(ENABLE_SQLITE3)
 
			message("SQLite3           : no (user disabled)")
 
		endif()
 
	set(SQLITE3_LIBRARIES "")
 
	if(ENABLE_SQLITE3)
 
		message("SQLite3           : no (install sqlite3)")
 
	else(ENABLE_SQLITE3)
 
		message("SQLite3           : no (user disabled)")
 
	endif()
 
endif (SQLITE3_FOUND)
 

	
 
if (MYSQL_FOUND)
 
	ADD_DEFINITIONS(-DWITH_MYSQL)
 
	include_directories(${MYSQL_INCLUDE_DIR})
 
	message("MySQL             : yes")
 
else (MYSQL_FOUND)
 
	set(MYSQL_LIBRARIES "")
 
	if(ENABLE_MYSQL)
 
		message("MySQL             : no (install mysql-devel)")
 
	else(ENABLE_MYSQL)
 
		message("MySQL             : no (user disabled)")
 
	endif()
 
endif (MYSQL_FOUND)
 

	
 
if (PQXX_FOUND)
 
	ADD_DEFINITIONS(-DWITH_PQXX)
 
	include_directories(${PQXX_INCLUDE_DIR})
 
	message("PostgreSQL        : yes")
 
else (PQXX_FOUND)
 
	set(PQXX_LIBRARY "")
 
	set(PQ_LIBRARY "")
 
	if(ENABLE_PQXX)
 
		message("PostgreSQL        : no (install libpqxx-devel)")
 
	else(ENABLE_PQXX)
 
		message("PostgreSQL        : no (user disabled)")
 
	endif()
 
endif (PQXX_FOUND)
 

	
 
if (PROTOBUF_FOUND)
 
	ADD_DEFINITIONS(-DWITH_PROTOBUF)
 
	include_directories(${PROTOBUF_INCLUDE_DIRS})
 
	message("Network plugins   : yes")
 

	
 
	if(PURPLE_FOUND)
 
		message("Libpurple plugin  : yes")
 
		include_directories(${PURPLE_INCLUDE_DIR})
 
		include_directories(${GLIB2_INCLUDE_DIR})
 
	else()
 
		if(ENABLE_PURPLE)
 
			message("Libpurple plugin  : no (install libpurple)")
 
		else(ENABLE_PURPLE)
 
			message("Libpurple plugin  : no (user disabled)")
 
		endif()
 
	endif()
 

	
 
	if (HAVE_EVENT)
backends/twitter/libtwitcurl/twitcurl.h
Show inline comments
 
#ifndef _TWITCURL_H_
 
#define _TWITCURL_H_
 

	
 
#include <string>
 
#include <sstream>
 
#include <cstring>
 
#include <vector>
 
#include <algorithm>
 
#include "oauthlib.h"
 
#include "curl/curl.h"
 

	
 
/* Few common types used by twitCurl */
 
namespace twitCurlTypes
 
{
 
    typedef enum _eTwitCurlApiFormatType
 
    {
 
        eTwitCurlApiFormatJson = 0,
 
        eTwitCurlApiFormatXml,
 
        eTwitCurlApiFormatMax
 
    } eTwitCurlApiFormatType;
 

	
 
    typedef enum _eTwitCurlProtocolType
 
    {
 
        eTwitCurlProtocolHttps = 0,
 
        eTwitCurlProtocolHttp,
 
        eTwitCurlProtocolMax
 
    } eTwitCurlProtocolType;
 
};
 

	
 
/* twitCurl class */
 
class twitCurl
 
{
 
public:
 
    twitCurl();
 
    ~twitCurl();
 

	
 
    /* Twitter OAuth authorization methods */
 
    oAuth& getOAuth();
 
    bool oAuthRequestToken( std::string& authorizeUrl /* out */ );
 
    bool oAuthAccessToken();
 
    bool oAuthHandlePIN( const std::string& authorizeUrl /* in */ );
 

	
 
    /* Twitter login APIs, set once and forget */
 
    std::string& getTwitterUsername();
 
    std::string& getTwitterPassword();
 
    void setTwitterUsername( std::string& userName /* in */ );
 
    void setTwitterPassword( std::string& passWord /* in */ );
 

	
 
    /* Twitter search APIs */
 
    bool search( std::string& searchQuery /* in */, std::string resultCount = "" /* in */ );
 

	
 
    /* Twitter status APIs */
 
    bool statusUpdate( std::string& newStatus /* in */, std::string inReplyToStatusId = "" /* in */ );
 
    bool statusShowById( std::string& statusId /* in */ );
 
    bool statusDestroyById( std::string& statusId /* in */ );
 
    bool retweetById( std::string& statusId /* in */ );
cmake_modules/SwiftenConfig.cmake
Show inline comments
 
FIND_LIBRARY(SWIFTEN_LIBRARY NAMES Swiften Swiften3 HINTS ../lib)
 
FIND_PATH(SWIFTEN_INCLUDE_DIR NAMES "Swiften/Swiften.h" PATH_SUFFIXES libSwiften Swiften HINTS ../include)
 

	
 
if( SWIFTEN_LIBRARY AND SWIFTEN_INCLUDE_DIR )
 
	find_program(SWIFTEN_CONFIG_EXECUTABLE NAMES swiften-config DOC "swiften-config executable" HINTS ../bin)
 
	set( SWIFTEN_CFLAGS "" )
 
	if (SWIFTEN_CONFIG_EXECUTABLE)
 
		execute_process(
 
			COMMAND ${SWIFTEN_CONFIG_EXECUTABLE} --version
 
			OUTPUT_VARIABLE SWIFTEN_VERSION)
 
		string(REGEX MATCH "([0-9])" SWIFTEN_VERSION "${SWIFTEN_VERSION}")
 
		message(STATUS "Swiften version ${SWIFTEN_VERSION}")
 
		execute_process(
 
			COMMAND ${SWIFTEN_CONFIG_EXECUTABLE} --libs
 
			OUTPUT_VARIABLE SWIFTEN_LIB)
 
		string(REGEX REPLACE "[\r\n]"                  " " SWIFTEN_LIB "${SWIFTEN_LIB}")
 
		string(REGEX REPLACE " +$"                     ""  SWIFTEN_LIB "${SWIFTEN_LIB}")
 
		set(SWIFTEN_LIBRARY "")
 
		if (APPLE)
 
			string(REGEX MATCHALL "-framework [A-Za-z]+" APPLE_FRAMEWORKS "${SWIFTEN_LIB}")
 
			foreach(framework ${APPLE_FRAMEWORKS})
 
				list(APPEND SWIFTEN_LIBRARY ${framework} )
 
			endforeach(framework)
 
			string(REGEX REPLACE "-framework [A-Za-z]+" "" SWIFTEN_LIB "${SWIFTEN_LIB}")
 
		endif(APPLE)
 
		string(REGEX REPLACE " " ";" SWIFTEN_LIB "${SWIFTEN_LIB}")
 
		foreach(f ${SWIFTEN_LIB})
 
			STRING(SUBSTRING ${f} 0 2 f_out)
 
			STRING(COMPARE EQUAL ${f_out} "/L" IS_PATH)
 
			if(${IS_PATH})
 
				string(REGEX REPLACE "/LIBPATH:" ""  f_replaced "${f}")
 
				message("Added link directory: ${f_replaced}")
 
				link_directories(${f_replaced})
 
			else()
 
				list(APPEND SWIFTEN_LIBRARY ${f})
 
			endif()
 
		endforeach(f) 
 
		set( SWIFTEN_FOUND 1 )
 
	else()
 
		message( STATUS "Could NOT find swiften-config" )
 
	endif()
 

	
 
	if (SWIFTEN_FOUND)
 
		set( SWIFTEN_INCLUDE_DIR ${SWIFTEN_INCLUDE_DIR} )
 
		message( STATUS "Found libSwiften: ${SWIFTEN_LIBRARY}, ${SWIFTEN_INCLUDE_DIR}")
 
	endif()
 

	
 
else( SWIFTEN_LIBRARY AND SWIFTEN_INCLUDE_DIR )
 
    message( STATUS "Could NOT find libSwiften" )
 
endif( SWIFTEN_LIBRARY AND SWIFTEN_INCLUDE_DIR )
libtransport/CMakeLists.txt
Show inline comments
 
cmake_minimum_required(VERSION 2.6)
 
FILE(GLOB SRC *.cpp *.h)
 
FILE(GLOB_RECURSE SWIFTEN_SRC ../include/Swiften/*.cpp)
 

	
 
# Build without openssl on msvc
 
if (NOT MSVC)
 
if (APPLE)
 
	string(REGEX REPLACE "[^;]+;?/Schannel/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}")
 
	string(REGEX REPLACE "[^;]+;?/OpenSSL/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}")
 
else()
 
	string(REGEX REPLACE "[^;]+;?/Schannel/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}")
 
	string(REGEX REPLACE "[^;]+;?/SecureTransport/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}") 
 
endif()
 
else()
 
	string(REGEX REPLACE "[^;]+;?/OpenSSL/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}") 
 
	string(REGEX REPLACE "[^;]+;?/SecureTransport/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}")
 
endif()
 

	
 
if (SWIFTEN_VERSION GREATER 2)
 
	list(REMOVE_ITEM SWIFTEN_SRC "${CMAKE_CURRENT_SOURCE_DIR}/../include/Swiften/Network/DummyConnectionServer.h")
 
	list(REMOVE_ITEM SWIFTEN_SRC "${CMAKE_CURRENT_SOURCE_DIR}/../include/Swiften/Network/DummyConnectionServerFactory.h")
 
	list(REMOVE_ITEM SWIFTEN_SRC "${CMAKE_CURRENT_SOURCE_DIR}/../include/Swiften/Network/DummyConnectionServer.cpp")
 
	list(REMOVE_ITEM SWIFTEN_SRC "${CMAKE_CURRENT_SOURCE_DIR}/../include/Swiften/Network/DummyConnectionServerFactory.cpp")
 
endif()
 
FILE(GLOB HEADERS ../include/transport/*.h)
 
include_directories(../spectrum/src/frontends/xmpp/)
 

	
 
if (NOT WIN32)
 
include_directories(${POPT_INCLUDE_DIR})
 
endif()
 

	
 
# SOURCE_GROUP(headers FILES ${HEADERS})
 

	
 

	
 
if (PROTOBUF_FOUND)
 
	if (NOT WIN32)
 
		ADD_LIBRARY(transport SHARED ${HEADERS} ${SRC} ${SWIFTEN_SRC})
 
	else()
 
		ADD_LIBRARY(transport STATIC ${HEADERS} ${SRC} ${SWIFTEN_SRC})
 
	endif()
 
#	SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/../include/transport/protocol.pb.cc PROPERTIES GENERATED 1)
 
	ADD_DEPENDENCIES(transport pb) 
 
else(PROTOBUF_FOUND)
 
	ADD_LIBRARY(transport SHARED ${HEADERS} ${SRC} ${SWIFTEN_SRC})
 
endif(PROTOBUF_FOUND)
 

	
 
# if (CMAKE_COMPILER_IS_GNUCXX)
 
	if (NOT WIN32)
 
		ADD_DEFINITIONS(-fPIC)
 
	endif()
 
# endif()
 

	
 
find_package(CURL)
 

	
 
if (WIN32)
 
	include_directories("${CMAKE_SOURCE_DIR}/msvc-deps/sqlite3")
 
	TARGET_LINK_LIBRARIES(transport transport-plugin sqlite3 ${PQXX_LIBRARY} ${CURL_LIBRARIES ${PQ_LIBRARY} ${MYSQL_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES} ${PROTOBUF_LIBRARY} psapi.lib)
 
	TARGET_LINK_LIBRARIES(transport transport-plugin sqlite3 ${PQXX_LIBRARY} ${CURL_LIBRARIES} ${PQ_LIBRARY} ${MYSQL_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES} ${PROTOBUF_LIBRARY} psapi.lib)
 
else()
 
	TARGET_LINK_LIBRARIES(transport transport-plugin ${PQXX_LIBRARY} ${CURL_LIBRARIES} ${PQ_LIBRARY} ${SQLITE3_LIBRARIES} ${MYSQL_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES} ${POPT_LIBRARY} ${PROTOBUF_LIBRARY})
 
endif()
 

	
 
SET_TARGET_PROPERTIES(transport PROPERTIES
 
      VERSION ${TRANSPORT_VERSION} SOVERSION ${TRANSPORT_VERSION}
 
)
 
if (APPLE)
 
	TARGET_LINK_LIBRARIES(transport ${APPLE_FRAMEWORKS})
 
endif()
 

	
 
INSTALL(TARGETS transport LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries)
 

	
 
#CONFIGURE_FILE(transport.pc.in "${CMAKE_CURRENT_BINARY_DIR}/transport.pc")
 
#INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/transport.pc" DESTINATION lib/pkgconfig)
libtransport/FileTransferManager.cpp
Show inline comments
 
@@ -38,65 +38,65 @@ FileTransferManager::FileTransferManager(Component *component, UserManager *user
 
// #if !HAVE_SWIFTEN_3
 
// 	m_connectivityManager = new Swift::ConnectivityManager(m_component->getNetworkFactories()->getNATTraverser());
 
// #endif
 
// 	m_bytestreamRegistry = new Swift::SOCKS5BytestreamRegistry();
 
// #if !HAVE_SWIFTEN_3
 
// 	m_bytestreamProxy = new Swift::SOCKS5BytestreamProxy(m_component->getNetworkFactories()->getConnectionFactory(), m_component->getNetworkFactories()->getTimerFactory());
 
// 	m_localCandidateGeneratorFactory = new Swift::DefaultLocalJingleTransportCandidateGeneratorFactory(m_connectivityManager, m_bytestreamRegistry, m_bytestreamProxy, "thishouldnotbeused");
 
// 	m_remoteCandidateSelectorFactory = new Swift::DefaultRemoteJingleTransportCandidateSelectorFactory(m_component->getNetworkFactories()->getConnectionFactory(), m_component->getNetworkFactories()->getTimerFactory());
 
// #else
 
// 	m_proxyManager = new Swift::SOCKS5BytestreamProxiesManager(m_component->getNetworkFactories()->getConnectionFactory(), m_component->getNetworkFactories()->getTimerFactory(), m_component->getNetworkFactories()->getDomainNameResolver(), m_component->getIQRouter(), "bar.com");
 
// #endif
 
// 	boost::shared_ptr<Swift::ConnectionServer> server = m_component->getNetworkFactories()->getConnectionServerFactory()->createConnectionServer(19645);
 
// 	server->start();
 
// #if HAVE_SWIFTEN_3
 
// 	m_proxyServerManager = new Swift::SOCKS5BytestreamServerManager(m_bytestreamRegistry, m_component->getNetworkFactories()->getConnectionServerFactory(), m_component->getNetworkFactories()->getNetworkEnvironment(), m_component->getNetworkFactories()->getNATTraverser());
 
// #else
 
// 	m_bytestreamServer = new Swift::SOCKS5BytestreamServer(server, m_bytestreamRegistry);
 
// 	m_bytestreamServer->start();
 
// 	m_outgoingFTManager = new Swift::CombinedOutgoingFileTransferManager(m_jingleSessionManager, m_component->getIQRouter(),
 
// 		m_userManager, m_remoteCandidateSelectorFactory,
 
// 		m_localCandidateGeneratorFactory, m_bytestreamRegistry,
 
// 		m_bytestreamProxy, m_component->getPresenceOracle(),
 
// 		m_bytestreamServer);
 
// #endif
 

	
 
	
 

	
 
// WARNING: Swiften crashes when this is uncommented... But we probably need it for working Jingle FT
 
// 	m_connectivityManager->addListeningPort(19645);
 
}
 

	
 
FileTransferManager::~FileTransferManager() {
 
// #if !HAVE_SWIFTEN_3
 
// 	m_bytestreamServer->stop();
 
// 	delete m_remoteCandidateSelectorFactory;
 
// 	delete m_localCandidateGeneratorFactory;
 
// #endif
 
// 	delete m_outgoingFTManager;
 
// 	delete m_jingleSessionManager;
 
// 	delete m_bytestreamRegistry;
 
// #if !HAVE_SWIFTEN_3
 
// 	delete m_bytestreamServer;
 
// 	delete m_bytestreamProxy;
 
// 	delete m_connectivityManager;
 
// #endif
 
}
 

	
 
FileTransferManager::Transfer FileTransferManager::sendFile(User *user, Buddy *buddy, boost::shared_ptr<Swift::ReadBytestream> byteStream, const Swift::StreamInitiationFileInfo &info) {
 
// 	FileTransferManager::Transfer transfer;
 
 	FileTransferManager::Transfer transfer;
 
// 	transfer.from = buddy->getJID();
 
// 	transfer.to = user->getJID();
 
// 	transfer.readByteStream = byteStream;
 
// 
 
// 	LOG4CXX_INFO(logger, "Starting FT from '" << transfer.from << "' to '" << transfer.to << "'")
 
// 
 
// 	transfer.ft = m_outgoingFTManager->createOutgoingFileTransfer(transfer.from, transfer.to, transfer.readByteStream, info);
 
// // 	if (transfer.ft) {
 
// // 		m_filetransfers.push_back(ft);
 
// // 		ft->onStateChange.connect(boost::bind(&User::handleFTStateChanged, this, _1, Buddy::JIDToLegacyName(from), info.getName(), info.getSize(), id));
 
// // 		transfer.ft->start();
 
// // 	}
 
// 	return transfer;
 
 	return transfer;
 
}
 

	
 
}
spectrum/src/frontends/xmpp/XMPPFrontend.cpp
Show inline comments
 
@@ -302,97 +302,97 @@ void XMPPFrontend::handleBackendConfigChanged() {
 
		m_rawXML = true;
 
		m_iqRouter->addHandler(this);
 
	}
 
}
 

	
 
Swift::StanzaChannel *XMPPFrontend::getStanzaChannel() {
 
	return m_stanzaChannel;
 
}
 

	
 
void XMPPFrontend::connectToServer() {
 
	if (m_component && !m_component->isAvailable()) {
 
		LOG4CXX_INFO(logger, "Connecting XMPP server " << CONFIG_STRING(m_config, "service.server") << " port " << CONFIG_INT(m_config, "service.port"));
 
		if (CONFIG_INT(m_config, "service.port") == 5222) {
 
			LOG4CXX_WARN(logger, "Port 5222 is usually used for client connections, not for component connections! Are you sure you are using right port?");
 
		}
 
		m_component->connect(CONFIG_STRING(m_config, "service.server"), CONFIG_INT(m_config, "service.port"));
 
	}
 
	else if (m_server) {
 
		LOG4CXX_INFO(logger, "Starting XMPPFrontend in server mode on port " << CONFIG_INT(m_config, "service.port"));
 
		m_server->start();
 

	
 
		//Type casting to BoostConnectionServer since onStopped signal is not defined in ConnectionServer
 
		//Ideally, onStopped must be defined in ConnectionServer
 
		if (boost::dynamic_pointer_cast<Swift::BoostConnectionServer>(m_server->getConnectionServer())) {
 
			boost::dynamic_pointer_cast<Swift::BoostConnectionServer>(m_server->getConnectionServer())->onStopped.connect(boost::bind(&XMPPFrontend::handleServerStopped, this, _1));
 
		}
 
		
 
		// We're connected right here, because we're in server mode...
 
		handleConnected();
 
	}
 
}
 

	
 
void XMPPFrontend::disconnectFromServer() {
 
	if (m_component) {
 
		// TODO: Call this once swiften will fix assert(!session_);
 
// 		m_component->disconnect();
 
	}
 
	else if (m_server) {
 
		LOG4CXX_INFO(logger, "Stopping component in server mode on port " << CONFIG_INT(m_config, "service.port"));
 
		m_server->stop();
 
	}
 
}
 

	
 
void XMPPFrontend::handleConnected() {
 
	m_transport->handleConnected();
 
}
 

	
 
void XMPPFrontend::handleServerStopped(boost::optional<Swift::BoostConnectionServer::Error> e) {
 
	if(e != NULL ) {
 
	if(e) {
 
		if(*e == Swift::BoostConnectionServer::Conflict) {
 
			LOG4CXX_INFO(logger, "Port "<< CONFIG_INT(m_config, "service.port") << " already in use! Stopping server..");
 
			if (CONFIG_INT(m_config, "service.port") == 5347) {
 
				LOG4CXX_INFO(logger, "Port 5347 is usually used for components. You are using server_mode=1. Are you sure you don't want to use server_mode=0 and run spectrum as component?");
 
			}
 
		}
 
		if(*e == Swift::BoostConnectionServer::UnknownError)
 
			LOG4CXX_INFO(logger, "Unknown error occured! Stopping server..");
 
		exit(1);
 
	}
 
}
 

	
 

	
 
void XMPPFrontend::handleConnectionError(const ComponentError &error) {
 
	std::string str = "Unknown error";
 
	switch (error.getType()) {
 
		case ComponentError::UnknownError: str = "Unknown error"; break;
 
		case ComponentError::ConnectionError: str = "Connection error"; break;
 
		case ComponentError::ConnectionReadError: str = "Connection read error"; break;
 
		case ComponentError::ConnectionWriteError: str = "Connection write error"; break;
 
		case ComponentError::XMLError: str = "XML Error"; break;
 
		case ComponentError::AuthenticationFailedError: str = "Authentication failed error"; break;
 
		case ComponentError::UnexpectedElementError: str = "Unexpected element error"; break;
 
	}
 

	
 
	m_transport->handleConnectionError(str);
 
}
 

	
 
void XMPPFrontend::handleDataRead(const Swift::SafeByteArray &data) {
 
	std::string d = safeByteArrayToString(data);
 
	m_transport->handleDataRead(d);
 
}
 

	
 
void XMPPFrontend::handleDataWritten(const Swift::SafeByteArray &data) {
 
	std::string d = safeByteArrayToString(data);
 
	m_transport->handleDataWritten(d);
 
}
 

	
 
void XMPPFrontend::handleDiscoInfoResponse(boost::shared_ptr<Swift::DiscoInfo> info, Swift::ErrorPayload::ref error, const Swift::JID& jid) {
 
#ifdef SUPPORT_LEGACY_CAPS
 
	onCapabilitiesReceived(jid, info);
 
#endif
 
}
 

	
 
void XMPPFrontend::handleCapsChanged(const Swift::JID& jid) {
 
	onCapabilitiesReceived(jid, m_entityCapsManager->getCaps(jid));
 
}
 

	
0 comments (0 inline, 0 general)