Merge branch 'master' of github.com:hanzz/libtransport

This commit is contained in:
Jan Kaluza 2012-03-22 07:40:56 +01:00
commit fa9b984708
39 changed files with 129 additions and 245 deletions

View file

@ -167,10 +167,12 @@ else()
endif()
if (LOG4CXX_FOUND)
message("Logging : yes")
message("Log4cxx : yes")
include_directories(${LOG4CXX_INCLUDE_DIR})
ADD_DEFINITIONS(-DWITH_LOG4CXX)
else()
message(FATAL_ERROR "Logging : no (install log4cxx-devel)")
set(LOG4CXX_LIBRARIES "")
message("Log4cxx : no (install log4cxx-devel)")
endif()
if (WIN32)

View file

@ -6,6 +6,10 @@ Version 2.0.0-beta2 (2012-XX-XX):
* Fixed username_mask setting.
* Added new fields into statistics (backends_crashed, messages related
stats).
* Log4cxx is now optional dependency. Without Log4cxx, Spectrum 2 logs
to standard output.
* Fixed crash when Log4cxx configuration file didn't exist.
* Admin can now see "Admin" contact in server-mode.
libpurple:
* Added support for MUC for prpl-jabber protocol.

View file

@ -18,19 +18,9 @@
#include "ircnetworkplugin.h"
#include "singleircnetworkplugin.h"
#include "log4cxx/logger.h"
#include "log4cxx/consoleappender.h"
#include "log4cxx/patternlayout.h"
#include "log4cxx/propertyconfigurator.h"
#include "log4cxx/helpers/properties.h"
#include "log4cxx/helpers/fileinputstream.h"
#include "log4cxx/helpers/transcoder.h"
using namespace boost::program_options;
using namespace Transport;
using namespace log4cxx;
NetworkPlugin * np = NULL;
int main (int argc, char* argv[]) {

View file

@ -15,11 +15,9 @@
#include <IrcCommand>
#include <IrcMessage>
#include "log4cxx/logger.h"
#include "transport/logging.h"
using namespace log4cxx;
static LoggerPtr logger = log4cxx::Logger::getLogger("IRCSession");
DEFINE_LOGGER(logger, "IRCSession");
MyIrcSession::MyIrcSession(const std::string &user, NetworkPlugin *np, const std::string &suffix, QObject* parent) : IrcSession(parent)
{

View file

@ -1,11 +1,9 @@
#include "singleircnetworkplugin.h"
#include "log4cxx/logger.h"
#include "transport/logging.h"
#include <IrcCommand>
#include <IrcMessage>
using namespace log4cxx;
static LoggerPtr logger = log4cxx::Logger::getLogger("SingleIRCNetworkPlugin");
DEFINE_LOGGER(logger, "SingleIRCNetworkPlugin");
SingleIRCNetworkPlugin::SingleIRCNetworkPlugin(Config *config, Swift::QtEventLoop *loop, const std::string &host, int port) {
this->config = config;

View file

@ -28,11 +28,9 @@
#include "event.h"
#endif
#include "log4cxx/logger.h"
#include "transport/logging.h"
using namespace log4cxx;
static LoggerPtr logger = Logger::getLogger("EventLoop");
DEFINE_LOGGER(logger, "EventLoop");
typedef struct _PurpleIOClosure {
PurpleInputFunction function;

View file

@ -6,14 +6,10 @@
#include <iostream>
#include "transport/networkplugin.h"
#include "transport/logging.h"
#include "transport/config.h"
#include "transport/logging.h"
#include "geventloop.h"
#include "log4cxx/logger.h"
#include "log4cxx/consoleappender.h"
#include "log4cxx/patternlayout.h"
#include "log4cxx/propertyconfigurator.h"
#include "log4cxx/helpers/properties.h"
#include "log4cxx/helpers/fileinputstream.h"
#include "log4cxx/helpers/transcoder.h"
// #include "valgrind/memcheck.h"
#include "malloc.h"
@ -31,10 +27,9 @@
#define getpid _getpid
#endif
using namespace log4cxx;
DEFINE_LOGGER(logger_libpurple, "libpurple");
DEFINE_LOGGER(logger, "backend");
static LoggerPtr logger_libpurple = log4cxx::Logger::getLogger("libpurple");
static LoggerPtr logger = log4cxx::Logger::getLogger("backend");
int main_socket;
static int writeInput;
@ -1648,44 +1643,12 @@ int main(int argc, char **argv) {
return 1;
}
if (KEYFILE_STRING("logging", "backend_config").empty()) {
LoggerPtr root = log4cxx::Logger::getRootLogger();
#ifndef _MSC_VER
root->addAppender(new ConsoleAppender(new PatternLayout("%d %-5p %c: %m%n")));
#else
root->addAppender(new ConsoleAppender(new PatternLayout(L"%d %-5p %c: %m%n")));
#endif
}
else {
log4cxx::helpers::Properties p;
log4cxx::helpers::FileInputStream *istream = NULL;
try {
istream = new log4cxx::helpers::FileInputStream(KEYFILE_STRING("logging", "backend_config"));
}
catch(log4cxx::helpers::IOException &ex) {
std::cerr << "Can't create FileInputStream logger instance: " << ex.what() << "\n";
}
catch (...) {
std::cerr << "Can't create FileInputStream logger instance\n";
}
if (!istream) {
return 1;
}
p.load(istream);
LogString pid, jid;
log4cxx::helpers::Transcoder::decode(stringOf(getpid()), pid);
log4cxx::helpers::Transcoder::decode(KEYFILE_STRING("service", "jid"), jid);
#ifdef _MSC_VER
p.setProperty(L"pid", pid);
p.setProperty(L"jid", jid);
#else
p.setProperty("pid", pid);
p.setProperty("jid", jid);
#endif
log4cxx::PropertyConfigurator::configure(p);
Config config;
if (!config.load(argv[1])) {
std::cerr << "Can't open " << argv[1] << " configuration file.\n";
return 1;
}
Logging::initBackendLogging(&config);
initPurple();

View file

@ -14,13 +14,8 @@
#include "transport/rostermanager.h"
#include "transport/conversation.h"
#include "transport/networkplugin.h"
#include "transport/logger.h"
#include <boost/filesystem.hpp>
#include "log4cxx/logger.h"
#include "log4cxx/consoleappender.h"
#include "log4cxx/patternlayout.h"
#include "log4cxx/propertyconfigurator.h"
#include "log4cxx/helpers/properties.h"
#include "log4cxx/helpers/fileinputstream.h"
#include "sys/wait.h"
#include "sys/signal.h"
// #include "valgrind/memcheck.h"
@ -28,9 +23,7 @@
#include <dbus-1.0/dbus/dbus-glib-lowlevel.h>
using namespace log4cxx;
static LoggerPtr logger = Logger::getLogger("backend");
DEFINE_LOGGER(logger, "backend");
using namespace Transport;

View file

@ -26,13 +26,6 @@
Swift::SimpleEventLoop *loop_;
#include "log4cxx/logger.h"
#include "log4cxx/consoleappender.h"
#include "log4cxx/patternlayout.h"
#include "log4cxx/propertyconfigurator.h"
#include "log4cxx/helpers/properties.h"
#include "log4cxx/helpers/fileinputstream.h"
#include "log4cxx/helpers/transcoder.h"
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
@ -41,9 +34,7 @@ using namespace boost::filesystem;
using namespace boost::program_options;
using namespace Transport;
using namespace log4cxx;
static LoggerPtr logger = log4cxx::Logger::getLogger("SMSNetworkPlugin");
DEFINE_LOGGER(logger, "SMSNetworkPlugin");
#define INTERNAL_USER "/sms@backend@internal@user"

View file

@ -1,6 +1,7 @@
// Transport includes
#include "transport/config.h"
#include "transport/networkplugin.h"
#include "transport/logging.h"
// Swiften
#include "Swiften/Swiften.h"
@ -11,24 +12,13 @@
#include "sys/wait.h"
#include "sys/signal.h"
// Log4cxx
#include "log4cxx/logger.h"
#include "log4cxx/consoleappender.h"
#include "log4cxx/patternlayout.h"
#include "log4cxx/propertyconfigurator.h"
#include "log4cxx/helpers/properties.h"
#include "log4cxx/helpers/fileinputstream.h"
#include "log4cxx/helpers/transcoder.h"
// Boost
#include <boost/algorithm/string.hpp>
using namespace boost::filesystem;
using namespace boost::program_options;
using namespace Transport;
// log4cxx main logger
using namespace log4cxx;
static LoggerPtr logger = log4cxx::Logger::getLogger("Backend Template");
DEFINE_LOGGER(logger, "Backend Template");
// eventloop
Swift::SimpleEventLoop *loop_;
@ -147,30 +137,7 @@ int main (int argc, char* argv[]) {
return 1;
}
if (CONFIG_STRING(&config, "logging.backend_config").empty()) {
LoggerPtr root = log4cxx::Logger::getRootLogger();
#ifndef _MSC_VER
root->addAppender(new ConsoleAppender(new PatternLayout("%d %-5p %c: %m%n")));
#else
root->addAppender(new ConsoleAppender(new PatternLayout(L"%d %-5p %c: %m%n")));
#endif
}
else {
log4cxx::helpers::Properties p;
log4cxx::helpers::FileInputStream *istream = new log4cxx::helpers::FileInputStream(CONFIG_STRING(&config, "logging.backend_config"));
p.load(istream);
LogString pid, jid;
log4cxx::helpers::Transcoder::decode(boost::lexical_cast<std::string>(getpid()), pid);
log4cxx::helpers::Transcoder::decode(CONFIG_STRING(&config, "service.jid"), jid);
#ifdef _MSC_VER
p.setProperty(L"pid", pid);
p.setProperty(L"jid", jid);
#else
p.setProperty("pid", pid);
p.setProperty("jid", jid);
#endif
log4cxx::PropertyConfigurator::configure(p);
}
Logging::initBackendLogging(&config);
Swift::SimpleEventLoop eventLoop;
loop_ = &eventLoop;

View file

@ -14,12 +14,8 @@
#include <openssl/err.h>
#include <openssl/pkcs12.h>
#include "log4cxx/logger.h"
#include "log4cxx/consoleappender.h"
#include "log4cxx/patternlayout.h"
#include "log4cxx/propertyconfigurator.h"
using namespace log4cxx;
static LoggerPtr logger = Logger::getLogger("OpenSSLServerContext");
#include "transport/logging.h"
DEFINE_LOGGER(logger, "OpenSSLServerContext");
#include "Swiften/TLS/OpenSSL/OpenSSLServerContext.h"

View file

@ -24,6 +24,28 @@
#include <stdlib.h>
#include <vector>
#include <string>
#include <iostream>
#ifdef WITH_LOG4CXX
#include "log4cxx/logger.h"
#include "log4cxx/consoleappender.h"
#include "log4cxx/patternlayout.h"
#include "log4cxx/propertyconfigurator.h"
#include "log4cxx/helpers/properties.h"
#include "log4cxx/helpers/fileinputstream.h"
#include "log4cxx/helpers/transcoder.h"
#include "log4cxx/logger.h"
#define DEFINE_LOGGER(VAR, NAME) static log4cxx::LoggerPtr VAR = log4cxx::Logger::getLogger(NAME);
using namespace log4cxx;
#else
#define DEFINE_LOGGER(VARIABLE, NAME) static const char *VARIABLE = NAME;
#define LOG4CXX_ERROR(LOGGER, DATA) std::cerr << "E: <" << LOGGER << "> " << DATA << "\n";
#define LOG4CXX_WARN(LOGGER, DATA) std::cout << "W: <" << LOGGER << "> " << DATA << "\n";
#define LOG4CXX_INFO(LOGGER, DATA) std::cout << "I: <" << LOGGER << "> " << DATA << "\n";
#endif
namespace Transport {

View file

@ -3,6 +3,8 @@ FILE(GLOB SRC *.cpp *.h)
FILE(GLOB HEADERS ../include/transport/*.h)
set(EXTRA_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/../../src/memoryusage.cpp)
set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/../../src/logging.cpp)
set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/../../src/config.cpp)
set(EXTRA_SOURCES ${EXTRA_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/../../include/transport/protocol.pb.cc)
if (NOT WIN32)
@ -18,9 +20,9 @@ if (CMAKE_COMPILER_IS_GNUCXX)
endif()
if (NOT WIN32)
TARGET_LINK_LIBRARIES(transport-plugin ${PROTOBUF_LIBRARIES} ${LOG4CXX_LIBRARIES})
TARGET_LINK_LIBRARIES(transport-plugin ${PROTOBUF_LIBRARIES} ${LOG4CXX_LIBRARIES} ${Boost_LIBRARIES})
else()
TARGET_LINK_LIBRARIES(transport-plugin ${PROTOBUF_LIBRARIES} ${LOG4CXX_LIBRARIES} ws2_32.lib)
TARGET_LINK_LIBRARIES(transport-plugin ${PROTOBUF_LIBRARIES} ${LOG4CXX_LIBRARIES} ${Boost_LIBRARIES} ws2_32.lib)
endif()
SET_TARGET_PROPERTIES(transport-plugin PROPERTIES

View file

@ -19,9 +19,10 @@
*/
#include "transport/networkplugin.h"
#include "log4cxx/logger.h"
#include "log4cxx/basicconfigurator.h"
#include "transport/memoryusage.h"
#include "transport/logging.h"
#include <sstream>
#ifndef WIN32
#include <arpa/inet.h>
@ -32,9 +33,7 @@
#define getpid _getpid
#endif
using namespace log4cxx;
static LoggerPtr logger = Logger::getLogger("NetworkPlugin");
DEFINE_LOGGER(logger, "NetworkPlugin");
namespace Transport {

View file

@ -26,20 +26,11 @@
#else
#include <windows.h>
#endif
#include "log4cxx/logger.h"
#include "log4cxx/consoleappender.h"
#include "log4cxx/patternlayout.h"
#include "log4cxx/propertyconfigurator.h"
#include "log4cxx/helpers/properties.h"
#include "log4cxx/helpers/transcoder.h"
#include "log4cxx/helpers/fileinputstream.h"
#include <sys/stat.h>
using namespace log4cxx;
using namespace Transport;
static LoggerPtr logger = log4cxx::Logger::getLogger("Spectrum");
DEFINE_LOGGER(logger, "Spectrum");
Swift::SimpleEventLoop *eventLoop_ = NULL;
Component *component_ = NULL;

View file

@ -26,16 +26,14 @@
#include "transport/rostermanager.h"
#include "transport/usermanager.h"
#include "transport/networkpluginserver.h"
#include "transport/logging.h"
#include "storageresponder.h"
#include "log4cxx/logger.h"
#include "transport/memoryusage.h"
#include <boost/foreach.hpp>
using namespace log4cxx;
namespace Transport {
static LoggerPtr logger = Logger::getLogger("AdminInterface");
DEFINE_LOGGER(logger, "AdminInterface");
static std::string getArg(const std::string &body) {
std::string ret;

View file

@ -29,16 +29,14 @@
#include "transport/user.h"
#include "transport/buddy.h"
#include "transport/rostermanager.h"
#include "log4cxx/logger.h"
using namespace log4cxx;
#include "transport/logging.h"
using namespace Swift;
using namespace boost;
namespace Transport {
static LoggerPtr logger = Logger::getLogger("BlockResponder");
DEFINE_LOGGER(logger, "BlockResponder");
BlockResponder::BlockResponder(Swift::IQRouter *router, UserManager *userManager) : Swift::SetResponder<BlockPayload>(router) {
m_userManager = userManager;

View file

@ -19,7 +19,6 @@
*/
#include "transport/config.h"
#include "transport/util.h"
#include <fstream>
#ifdef _MSC_VER
#include <direct.h>
@ -31,6 +30,14 @@
using namespace boost::program_options;
namespace Transport {
int getRandomPort(const std::string &s) {
unsigned long r = 0;
BOOST_FOREACH(char c, s) {
r += (int) c;
}
srand(time(NULL) + r);
return 30000 + rand() % 10000;
}
bool Config::load(const std::string &configfile, boost::program_options::options_description &opts, const std::string &jid) {
std::ifstream ifs(configfile.c_str());
@ -126,7 +133,7 @@ bool Config::load(std::istream &ifs, boost::program_options::options_description
else if (opt.string_key == "service.backend_port") {
found_backend_port = true;
if (opt.value[0] == "0") {
opt.value[0] = boost::lexical_cast<std::string>(Util::getRandomPort(_jid.empty() ? jid : _jid));
opt.value[0] = boost::lexical_cast<std::string>(getRandomPort(_jid.empty() ? jid : _jid));
}
}
else if (opt.string_key == "service.working_dir") {
@ -152,7 +159,7 @@ bool Config::load(std::istream &ifs, boost::program_options::options_description
}
if (!found_backend_port) {
std::vector<std::string> value;
std::string p = boost::lexical_cast<std::string>(Util::getRandomPort(_jid.empty() ? jid : _jid));
std::string p = boost::lexical_cast<std::string>(getRandomPort(_jid.empty() ? jid : _jid));
value.push_back(p);
parsed.options.push_back(boost::program_options::basic_option<char>("service.backend_port", value));
}

View file

@ -25,14 +25,9 @@
#include "transport/transport.h"
#include "transport/buddy.h"
#include "transport/rostermanager.h"
#include "log4cxx/logger.h"
using namespace log4cxx;
namespace Transport {
// static LoggerPtr logger = Logger::getLogger("Conversation");
Conversation::Conversation(ConversationManager *conversationManager, const std::string &legacyName, bool isMUC) : m_conversationManager(conversationManager) {
m_legacyName = legacyName;
m_conversationManager->addConversation(this);

View file

@ -24,16 +24,14 @@
#include "transport/buddy.h"
#include "transport/factory.h"
#include "transport/user.h"
#include "transport/logging.h"
#include "Swiften/Roster/SetRosterRequest.h"
#include "Swiften/Elements/RosterPayload.h"
#include "Swiften/Elements/RosterItemPayload.h"
#include "log4cxx/logger.h"
using namespace log4cxx;
namespace Transport {
static LoggerPtr logger = Logger::getLogger("ConversationManager");
DEFINE_LOGGER(logger, "ConversationManager");
ConversationManager::ConversationManager(User *user, Component *component){
m_user = user;

View file

@ -23,13 +23,11 @@
#include "transport/usermanager.h"
#include "transport/user.h"
#include "transport/buddy.h"
#include "log4cxx/logger.h"
using namespace log4cxx;
#include "transport/logging.h"
namespace Transport {
static LoggerPtr logger = Logger::getLogger("FileTransferManager");
DEFINE_LOGGER(logger, "FileTransferManager");
FileTransferManager::FileTransferManager(Component *component, UserManager *userManager) {
m_component = component;

View file

@ -28,16 +28,14 @@
#include "transport/usermanager.h"
#include "transport/user.h"
#include "transport/transport.h"
#include "log4cxx/logger.h"
using namespace log4cxx;
#include "transport/logging.h"
using namespace Swift;
using namespace boost;
namespace Transport {
static LoggerPtr logger = Logger::getLogger("GatewayResponder");
DEFINE_LOGGER(logger, "GatewayResponder");
GatewayResponder::GatewayResponder(Swift::IQRouter *router, UserManager *userManager) : Swift::Responder<GatewayPayload>(router) {
m_userManager = userManager;

View file

@ -25,13 +25,7 @@
#include <iterator>
#include <algorithm>
#include "log4cxx/logger.h"
#include "log4cxx/consoleappender.h"
#include "log4cxx/patternlayout.h"
#include "log4cxx/propertyconfigurator.h"
#include "log4cxx/helpers/properties.h"
#include "log4cxx/helpers/fileinputstream.h"
#include "log4cxx/helpers/transcoder.h"
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
@ -48,12 +42,14 @@
#endif
using namespace boost::filesystem;
using namespace log4cxx;
namespace Transport {
namespace Logging {
#ifdef WITH_LOG4CXX
using namespace log4cxx;
static LoggerPtr root;
static void initLogging(Config *config, std::string key) {
@ -143,6 +139,14 @@ void initMainLogging(Config *config) {
initLogging(config, "logging.config");
}
#else /* WITH_LOG4CXX */
void initBackendLogging(Config */*config*/) {
}
void initMainLogging(Config */*config*/) {
}
#endif /* WITH_LOG4CXX */
}
}

View file

@ -19,11 +19,8 @@
*/
#include "transport/memoryreadbytestream.h"
#include "log4cxx/logger.h"
#include <boost/foreach.hpp>
using namespace log4cxx;
namespace Transport {
MemoryReadBytestream::MemoryReadBytestream(unsigned long size) {

View file

@ -22,10 +22,8 @@
#include "transport/mysqlbackend.h"
#include "transport/util.h"
#include "transport/logging.h"
#include <boost/bind.hpp>
#include "log4cxx/logger.h"
using namespace log4cxx;
#define MYSQL_DB_VERSION 2
#define CHECK_DB_RESPONSE(stmt) \
@ -92,7 +90,7 @@ using namespace boost;
namespace Transport {
static LoggerPtr logger = Logger::getLogger("MySQLBackend");
DEFINE_LOGGER(logger, "MySQLBackend");
static bool exec_ok;
MySQLBackend::Statement::Statement(MYSQL *conn, const std::string &format, const std::string &statement) {

View file

@ -31,6 +31,7 @@
#include "transport/vcardresponder.h"
#include "transport/rosterresponder.h"
#include "transport/memoryreadbytestream.h"
#include "transport/logging.h"
#include "blockresponder.h"
#include "Swiften/Swiften.h"
#include "Swiften/Server/ServerStanzaChannel.h"
@ -41,7 +42,6 @@
#include "Swiften/Elements/InvisiblePayload.h"
#include "Swiften/Elements/SpectrumErrorPayload.h"
#include "transport/protocol.pb.h"
#include "log4cxx/logger.h"
#include <Swiften/FileTransfer/ReadBytestream.h>
#include <Swiften/Elements/StreamInitiationFileInfo.h>
@ -55,14 +55,12 @@
#include "popt.h"
#endif
using namespace log4cxx;
namespace Transport {
static unsigned long backend_id;
static unsigned long bytestream_id;
static LoggerPtr logger = Logger::getLogger("NetworkPluginServer");
DEFINE_LOGGER(logger, "NetworkPluginServer");
class NetworkConversation : public Conversation {
public:

View file

@ -25,21 +25,19 @@
#include "transport/usermanager.h"
#include "transport/buddy.h"
#include "transport/user.h"
#include "transport/logging.h"
#include "Swiften/Roster/SetRosterRequest.h"
#include "Swiften/Elements/RosterPayload.h"
#include "Swiften/Elements/RosterItemPayload.h"
#include "Swiften/Elements/RosterItemExchangePayload.h"
#include "log4cxx/logger.h"
#include <boost/foreach.hpp>
#include <map>
#include <iterator>
using namespace log4cxx;
namespace Transport {
static LoggerPtr logger = Logger::getLogger("RosterManager");
DEFINE_LOGGER(logger, "RosterManager");
RosterManager::RosterManager(User *user, Component *component){
m_rosterStorage = NULL;

View file

@ -28,16 +28,14 @@
#include "transport/usermanager.h"
#include "transport/rostermanager.h"
#include "transport/buddy.h"
#include "log4cxx/logger.h"
using namespace log4cxx;
#include "transport/logging.h"
using namespace Swift;
using namespace boost;
namespace Transport {
static LoggerPtr logger = Logger::getLogger("RosterResponder");
DEFINE_LOGGER(logger, "RosterResponder");
RosterResponder::RosterResponder(Swift::IQRouter *router, UserManager *userManager) : Swift::Responder<RosterPayload>(router) {
m_userManager = userManager;

View file

@ -22,10 +22,8 @@
#include "transport/sqlite3backend.h"
#include "transport/util.h"
#include "transport/logging.h"
#include <boost/bind.hpp>
#include "log4cxx/logger.h"
using namespace log4cxx;
#define SQLITE_DB_VERSION 3
#define CHECK_DB_RESPONSE(stmt) \
@ -65,7 +63,7 @@ using namespace boost;
namespace Transport {
static LoggerPtr logger = Logger::getLogger("SQLite3Backend");
DEFINE_LOGGER(logger, "SQLite3Backend");
SQLite3Backend::SQLite3Backend(Config *config) {
m_config = config;

View file

@ -34,16 +34,14 @@
#include "transport/rostermanager.h"
#include "transport/usermanager.h"
#include "transport/networkpluginserver.h"
#include "log4cxx/logger.h"
using namespace log4cxx;
#include "transport/logging.h"
using namespace Swift;
using namespace boost;
namespace Transport {
static LoggerPtr logger = Logger::getLogger("StatsResponder");
DEFINE_LOGGER(logger, "StatsResponder");
StatsResponder::StatsResponder(Component *component, UserManager *userManager, NetworkPluginServer *server, StorageBackend *storageBackend) : Swift::Responder<StatsPayload>(component->getIQRouter()) {
m_component = component;

View file

@ -27,16 +27,14 @@
#include "Swiften/Swiften.h"
#include "transport/usermanager.h"
#include "transport/user.h"
#include "log4cxx/logger.h"
using namespace log4cxx;
#include "transport/logging.h"
using namespace Swift;
using namespace boost;
namespace Transport {
static LoggerPtr logger = Logger::getLogger("StorageResponder");
DEFINE_LOGGER(logger, "StorageResponder");
StorageResponder::StorageResponder(Swift::IQRouter *router, StorageBackend *storageBackend, UserManager *userManager) : Swift::Responder<PrivateStorage>(router) {
m_storageBackend = storageBackend;

View file

@ -5,18 +5,22 @@
#include <cppunit/TestResultCollector.h>
#include <cppunit/TestRunner.h>
#include <cppunit/BriefTestProgressListener.h>
#ifdef WITH_LOG4CXX
#include "log4cxx/logger.h"
#include "log4cxx/fileappender.h"
#include "log4cxx/patternlayout.h"
#include "log4cxx/propertyconfigurator.h"
using namespace log4cxx;
#endif
int main (int argc, char* argv[])
{
#ifdef WITH_LOG4CXX
LoggerPtr root = Logger::getRootLogger();
root->addAppender(new FileAppender(new PatternLayout("%d %-5p %c: %m%n"), "libtransport_test.log", false));
#endif
// informs test-listener about testresults
CPPUNIT_NS :: TestResult testresult;

View file

@ -24,6 +24,7 @@
#include "transport/storagebackend.h"
#include "transport/factory.h"
#include "transport/userregistry.h"
#include "transport/logging.h"
#include "discoinforesponder.h"
#include "discoitemsresponder.h"
#include "storageparser.h"
@ -43,20 +44,15 @@
#include "transport/BlockSerializer.h"
#include "Swiften/Parser/PayloadParsers/InvisibleParser.h"
#include "Swiften/Serializer/PayloadSerializers/InvisibleSerializer.h"
#include "log4cxx/logger.h"
#include "log4cxx/consoleappender.h"
#include "log4cxx/patternlayout.h"
#include "log4cxx/propertyconfigurator.h"
#include "Swiften/Swiften.h"
using namespace Swift;
using namespace boost;
using namespace log4cxx;
namespace Transport {
static LoggerPtr logger = Logger::getLogger("Component");
static LoggerPtr logger_xml = Logger::getLogger("Component.XML");
DEFINE_LOGGER(logger, "Component");
DEFINE_LOGGER(logger_xml, "Component.XML");
Component::Component(Swift::EventLoop *loop, Swift::NetworkFactories *factories, Config *config, Factory *factory, Transport::UserRegistry *userRegistry) {
m_component = NULL;

View file

@ -25,24 +25,23 @@
#include "transport/usermanager.h"
#include "transport/conversationmanager.h"
#include "transport/presenceoracle.h"
#include "transport/logging.h"
#include "Swiften/Swiften.h"
#include "Swiften/Server/ServerStanzaChannel.h"
#include "Swiften/Elements/StreamError.h"
#include "Swiften/Elements/MUCPayload.h"
#include "Swiften/Elements/SpectrumErrorPayload.h"
#include "log4cxx/logger.h"
#include <boost/foreach.hpp>
#include <stdio.h>
#include <stdlib.h>
using namespace log4cxx;
using namespace boost;
#define foreach BOOST_FOREACH
namespace Transport {
static LoggerPtr logger = Logger::getLogger("User");
DEFINE_LOGGER(logger, "User");
User::User(const Swift::JID &jid, UserInfo &userInfo, Component *component, UserManager *userManager) {
m_jid = jid.toBare();

View file

@ -25,19 +25,18 @@
#include "transport/conversationmanager.h"
#include "transport/rostermanager.h"
#include "transport/userregistry.h"
#include "transport/logging.h"
#include "storageresponder.h"
#include "log4cxx/logger.h"
#include "Swiften/Swiften.h"
#include "Swiften/Server/ServerStanzaChannel.h"
#include "Swiften/Elements/StreamError.h"
#include "malloc.h"
// #include "valgrind/memcheck.h"
using namespace log4cxx;
namespace Transport {
static LoggerPtr logger = Logger::getLogger("UserManager");
DEFINE_LOGGER(logger, "UserManager");
UserManager::UserManager(Component *component, UserRegistry *userRegistry, StorageBackend *storageBackend) {
m_cachedUser = NULL;

View file

@ -24,18 +24,17 @@
#include "transport/transport.h"
#include "transport/rostermanager.h"
#include "transport/user.h"
#include "transport/logging.h"
#include "Swiften/Elements/ErrorPayload.h"
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include "log4cxx/logger.h"
using namespace Swift;
using namespace log4cxx;
namespace Transport {
static LoggerPtr logger = Logger::getLogger("UserRegistration");
DEFINE_LOGGER(logger, "UserRegistration");
UserRegistration::UserRegistration(Component *component, UserManager *userManager, StorageBackend *storageBackend) : Swift::Responder<Swift::InBandRegistrationPayload>(component->m_iqRouter) {
m_component = component;

View file

@ -23,13 +23,11 @@
#include "Swiften/Swiften.h"
#include "Swiften/Server/UserRegistry.h"
#include "transport/userregistry.h"
#include "log4cxx/logger.h"
using namespace log4cxx;
#include "transport/logging.h"
namespace Transport {
static LoggerPtr logger = Logger::getLogger("UserRegistry");
DEFINE_LOGGER(logger, "UserRegistry");
UserRegistry::UserRegistry(Config *cfg, Swift::NetworkFactories *factories) {
config = cfg;

View file

@ -26,16 +26,14 @@
#include "Swiften/Swiften.h"
#include "transport/storagebackend.h"
#include "transport/transport.h"
#include "log4cxx/logger.h"
using namespace log4cxx;
#include "transport/logging.h"
using namespace Swift;
using namespace boost;
namespace Transport {
static LoggerPtr logger = Logger::getLogger("UserReconnecter");
DEFINE_LOGGER(logger, "UserReconnecter");
UsersReconnecter::UsersReconnecter(Component *component, StorageBackend *storageBackend) {
m_component = component;

View file

@ -28,16 +28,14 @@
#include "transport/usermanager.h"
#include "transport/rostermanager.h"
#include "transport/transport.h"
#include "log4cxx/logger.h"
using namespace log4cxx;
#include "transport/logging.h"
using namespace Swift;
using namespace boost;
namespace Transport {
static LoggerPtr logger = Logger::getLogger("VCardResponder");
DEFINE_LOGGER(logger, "VCardResponder");
VCardResponder::VCardResponder(Swift::IQRouter *router, Swift::NetworkFactories *factories, UserManager *userManager) : Swift::Responder<VCard>(router) {
m_id = 0;