Files
@ 02ac300e5e39
Branch filter:
Location: libtransport.git/backends/skype/main.cpp - annotation
02ac300e5e39
1.9 KiB
text/x-c++hdr
Skype backend: do not force exit when user logged out (fixes crash)
c643e5b81d60 7a3c38c46d32 7a3c38c46d32 c643e5b81d60 c643e5b81d60 c643e5b81d60 a06a47ed110e c643e5b81d60 c643e5b81d60 4c9f82cb3591 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c63df9499f11 c643e5b81d60 c63df9499f11 c643e5b81d60 7a3c38c46d32 7a3c38c46d32 ac2fd6dbfb75 c643e5b81d60 7c93aee6f49a c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 c643e5b81d60 1b8fef4d70b5 1b8fef4d70b5 1b8fef4d70b5 1b8fef4d70b5 c643e5b81d60 c643e5b81d60 7a3c38c46d32 c643e5b81d60 7a3c38c46d32 7a3c38c46d32 7a3c38c46d32 7a3c38c46d32 c643e5b81d60 712c55a9f486 7a3c38c46d32 7a3c38c46d32 7a3c38c46d32 7a3c38c46d32 060510d6958e 060510d6958e 060510d6958e 060510d6958e 712c55a9f486 712c55a9f486 712c55a9f486 060510d6958e c643e5b81d60 712c55a9f486 c643e5b81d60 712c55a9f486 c643e5b81d60 7a3c38c46d32 c643e5b81d60 7a3c38c46d32 c643e5b81d60 712c55a9f486 712c55a9f486 c643e5b81d60 712c55a9f486 712c55a9f486 c643e5b81d60 c643e5b81d60 7a3c38c46d32 c643e5b81d60 | #include "glib.h"
#include <dbus-1.0/dbus/dbus-glib-lowlevel.h>
#include "sqlite3.h"
#include <iostream>
#include "transport/config.h"
#include "transport/logging.h"
#include "transport/transport.h"
#include "transport/usermanager.h"
#include "transport/memoryusage.h"
#include "transport/sqlite3backend.h"
#include "transport/userregistration.h"
#include "transport/user.h"
#include "transport/storagebackend.h"
#include "transport/rostermanager.h"
#include "transport/conversation.h"
#include "transport/networkplugin.h"
#include <boost/filesystem.hpp>
#include "sys/wait.h"
#include "sys/signal.h"
// #include "valgrind/memcheck.h"
#ifndef __FreeBSD__
#include "malloc.h"
#endif
#include "skype.h"
#include "skypeplugin.h"
DEFINE_LOGGER(logger, "backend");
using namespace Transport;
static void spectrum_sigchld_handler(int sig)
{
int status;
pid_t pid;
do {
pid = waitpid(-1, &status, WNOHANG);
} while (pid != 0 && pid != (pid_t)-1);
if ((pid == (pid_t) - 1) && (errno != ECHILD)) {
char errmsg[BUFSIZ];
snprintf(errmsg, BUFSIZ, "Warning: waitpid() returned %d", pid);
perror(errmsg);
}
}
static void log_glib_error(const gchar *string) {
LOG4CXX_ERROR(logger, "GLIB ERROR:" << string);
}
int main(int argc, char **argv) {
#ifndef WIN32
signal(SIGPIPE, SIG_IGN);
if (signal(SIGCHLD, spectrum_sigchld_handler) == SIG_ERR) {
std::cout << "SIGCHLD handler can't be set\n";
return -1;
}
#endif
std::string host;
int port = 10000;
std::string error;
Config *cfg = Config::createFromArgs(argc, argv, error, host, port);
if (cfg == NULL) {
std::cerr << error;
return 1;
}
Logging::initBackendLogging(cfg);
g_type_init();
g_set_printerr_handler(log_glib_error);
dbus_threads_init_default();
SkypePlugin *np = new SkypePlugin(cfg, host, port);
GMainLoop *m_loop;
m_loop = g_main_loop_new(NULL, FALSE);
if (m_loop) {
g_main_loop_run(m_loop);
}
return 0;
}
|