Merge branch 'master' of github.com:hanzz/libtransport
This commit is contained in:
commit
b38cc30c44
12 changed files with 38 additions and 17 deletions
|
@ -274,20 +274,19 @@ 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)
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <sstream>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include "oauthlib.h"
|
||||
#include "curl/curl.h"
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ namespace Logging {
|
|||
|
||||
void initBackendLogging(Config *config);
|
||||
void initMainLogging(Config *config);
|
||||
void initManagerLogging(Config *config);
|
||||
void shutdownLogging();
|
||||
void redirect_stderr();
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ else()
|
|||
string(REGEX REPLACE "[^;]+;?/OpenSSL/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}")
|
||||
string(REGEX REPLACE "[^;]+;?/SecureTransport/[^;]+;?" "" SWIFTEN_SRC "${SWIFTEN_SRC}")
|
||||
endif()
|
||||
|
||||
FILE(GLOB HEADERS ../include/transport/*.h)
|
||||
include_directories(../spectrum/src/frontends/xmpp/)
|
||||
|
||||
|
@ -48,7 +47,7 @@ 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()
|
||||
|
|
|
@ -83,7 +83,7 @@ FileTransferManager::~FileTransferManager() {
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -96,7 +96,7 @@ FileTransferManager::Transfer FileTransferManager::sendFile(User *user, Buddy *b
|
|||
// // ft->onStateChange.connect(boost::bind(&User::handleFTStateChanged, this, _1, Buddy::JIDToLegacyName(from), info.getName(), info.getSize(), id));
|
||||
// // transfer.ft->start();
|
||||
// // }
|
||||
// return transfer;
|
||||
return transfer;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -203,6 +203,9 @@ void initMainLogging(Config *config) {
|
|||
initLogging(config, "logging.config");
|
||||
initLogging(config, "logging.backend_config", true);
|
||||
}
|
||||
void initManagerLogging(Config *config) {
|
||||
initLogging(config, "logging.config");
|
||||
}
|
||||
|
||||
void redirect_stderr() {
|
||||
intercepter_cerr = new intercept_stream(std::cerr, "cerr");
|
||||
|
|
|
@ -49,4 +49,8 @@ INSTALL(FILES
|
|||
DESTINATION /etc/spectrum2
|
||||
)
|
||||
|
||||
INSTALL(FILES
|
||||
manager-logging.cfg
|
||||
DESTINATION /etc/spectrum2
|
||||
)
|
||||
|
||||
|
|
|
@ -347,7 +347,7 @@ void XMPPFrontend::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) {
|
||||
|
|
11
spectrum/src/manager-logging.cfg
Normal file
11
spectrum/src/manager-logging.cfg
Normal file
|
@ -0,0 +1,11 @@
|
|||
log4j.rootLogger=debug, R
|
||||
|
||||
log4j.appender.R=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.R.File=/var/log/spectrum2/spectrum_manager.log
|
||||
|
||||
log4j.appender.R.MaxFileSize=10000KB
|
||||
# Keep one backup file
|
||||
log4j.appender.R.MaxBackupIndex=1
|
||||
|
||||
log4j.appender.R.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.R.layout.ConversionPattern=%d %-5p %c: %m%n
|
|
@ -44,6 +44,7 @@ bool ManagerConfig::load(const std::string &configfile, boost::program_options::
|
|||
("database.password", value<std::string>()->default_value(""), "Database Password.")
|
||||
("database.port", value<int>()->default_value(0), "Database port.")
|
||||
("database.prefix", value<std::string>()->default_value(""), "Prefix of tables in database")
|
||||
("logging.config", value<std::string>()->default_value("/etc/spectrum2/manager_logging.cfg"), "Logging configuration file")
|
||||
;
|
||||
|
||||
store(parse_config_file(ifs, opts), m_variables);
|
||||
|
|
|
@ -105,7 +105,8 @@ Server::Server(ManagerConfig *config, const std::string &config_file) {
|
|||
|
||||
m_storageCfg = new Config();
|
||||
m_storageCfg->load(config_file);
|
||||
|
||||
|
||||
Logging::initManagerLogging(m_storageCfg);
|
||||
std::string error;
|
||||
m_storage = StorageBackend::createBackend(m_storageCfg, error);
|
||||
if (m_storage == NULL) {
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "managerconfig.h"
|
||||
|
||||
#include "transport/Config.h"
|
||||
#include "transport/Logging.h"
|
||||
#include "transport/SQLite3Backend.h"
|
||||
#include "transport/MySQLBackend.h"
|
||||
#include "transport/PQXXBackend.h"
|
||||
|
|
Loading…
Add table
Reference in a new issue