X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fquassel.cpp;h=28fb2b08ab6301f60bfd0d72f3a1240d0fe8d6e6;hp=f43423cc6445557e47cc27653872ee99b39ea842;hb=25a3ae50ac0d9835283e4f5f10fcfcc10ed5575d;hpb=eaa1bd30bc088e5cae6d8a742d7aedb3d8ff1897 diff --git a/src/common/quassel.cpp b/src/common/quassel.cpp index f43423cc..28fb2b08 100644 --- a/src/common/quassel.cpp +++ b/src/common/quassel.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2015 by the Quassel Project * + * Copyright (C) 2005-2016 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -42,6 +42,7 @@ #include "logger.h" #include "message.h" #include "network.h" +#include "peer.h" #include "protocol.h" #include "syncableobject.h" #include "types.h" @@ -71,6 +72,11 @@ Quassel::Quassel() // We catch SIGTERM and SIGINT (caused by Ctrl+C) to graceful shutdown Quassel. signal(SIGTERM, handleSignal); signal(SIGINT, handleSignal); +#ifndef Q_OS_WIN + // SIGHUP is used to reload configuration (i.e. SSL certificates) + // Windows does not support SIGHUP + signal(SIGHUP, handleSignal); +#endif } @@ -193,7 +199,9 @@ void Quassel::registerMetaTypes() qRegisterMetaType("MsgId"); qRegisterMetaType("QHostAddress"); + qRegisterMetaTypeStreamOperators("QHostAddress"); qRegisterMetaType("QUuid"); + qRegisterMetaTypeStreamOperators("QUuid"); qRegisterMetaTypeStreamOperators("IdentityId"); qRegisterMetaTypeStreamOperators("BufferId"); @@ -203,6 +211,8 @@ void Quassel::registerMetaTypes() qRegisterMetaTypeStreamOperators("MsgId"); qRegisterMetaType("Protocol::SessionState"); + qRegisterMetaType("PeerPtr"); + qRegisterMetaTypeStreamOperators("PeerPtr"); // Versions of Qt prior to 4.7 didn't define QVariant as a meta type if (!QMetaType::type("QVariant")) { @@ -256,15 +266,16 @@ void Quassel::setupBuildInfo() _buildInfo.baseVersion = QUASSEL_VERSION_STRING; _buildInfo.generatedVersion = GIT_DESCRIBE; - // This will be imprecise for incremental builds not touching this file, but we really don't want to always recompile - _buildInfo.buildDate = QString("%1 %2").arg(__DATE__, __TIME__); - // Check if we got a commit hash - if (!QString(GIT_HEAD).isEmpty()) + if (!QString(GIT_HEAD).isEmpty()) { _buildInfo.commitHash = GIT_HEAD; + QDateTime date; + date.setTime_t(GIT_COMMIT_DATE); + _buildInfo.commitDate = date.toString(); + } else if (!QString(DIST_HASH).contains("Format")) { _buildInfo.commitHash = DIST_HASH; - _buildInfo.commitDate = QString(DIST_DATE).toUInt(); + _buildInfo.commitDate = QString(DIST_DATE); } // create a nice version string @@ -317,6 +328,20 @@ void Quassel::handleSignal(int sig) else QCoreApplication::quit(); break; +#ifndef Q_OS_WIN +// Windows does not support SIGHUP + case SIGHUP: + // Most applications use this as the 'configuration reload' command, e.g. nginx uses it for + // graceful reloading of processes. + if (_instance) { + // If the instance exists, reload the configuration + quInfo() << "Caught signal" << SIGHUP <<"- reloading configuration"; + if (_instance->reloadConfig()) { + quInfo() << "Successfully reloaded configuration"; + } + } + break; +#endif case SIGABRT: case SIGSEGV: #ifndef Q_OS_WIN