X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fquassel.cpp;h=49d88928c084d430bb38a843edf8507e9160d250;hb=e30092afc1803d753914a7ab9fa88bba818de559;hp=c166ee64d08d27b03cb1f7c156d3b02063b067c7;hpb=d82f98b8cf9c7c83f3aab1d7f010ccf8bdd2c003;p=quassel.git diff --git a/src/common/quassel.cpp b/src/common/quassel.cpp index c166ee64..49d88928 100644 --- a/src/common/quassel.cpp +++ b/src/common/quassel.cpp @@ -72,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 } @@ -259,15 +264,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 @@ -320,6 +326,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