X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclientsyncer.cpp;h=1af95b8f791ffe64b64f24658eb07a87a01b1842;hp=c73d3590a9d3cd84151c8246db3070b6e2e6f255;hb=cf0e5a5e8d6b27cd377b594a4342a7b493f815b0;hpb=0ccf33bdae81a1e2f66221e5afc7c6e5a6f1dc3a
diff --git a/src/client/clientsyncer.cpp b/src/client/clientsyncer.cpp
index c73d3590..1af95b8f 100644
--- a/src/client/clientsyncer.cpp
+++ b/src/client/clientsyncer.cpp
@@ -91,8 +91,6 @@ void ClientSyncer::coreSocketError(QAbstractSocket::SocketError) {
}
void ClientSyncer::disconnectFromCore() {
- if(_socket)
- _socket->close();
resetConnection();
}
@@ -199,7 +197,7 @@ void ClientSyncer::clientInitAck(const QVariantMap &msg) {
disconnectFromCore();
return;
}
- emit connectionMsg(msg["CoreInfo"].toString());
+ emit connectionMsg(coreInfoString(msg));
#ifndef QT_NO_COMPRESS
if(msg["SupportsCompression"].toBool()) {
@@ -347,6 +345,28 @@ void ClientSyncer::resetConnection() {
numNetsToSync = 0;
}
+QString ClientSyncer::coreInfoString(const QVariantMap &coreData) {
+ // check if we use a new enough core
+ // FIXME: this can go away after v11 protocol bump
+ if(!coreData.contains("CoreStartTime"))
+ return coreData.value("CoreInfo").toString();
+
+ QDateTime startTime = coreData.value("CoreStartTime").toDateTime().toLocalTime();
+ int uptime = startTime.secsTo(QDateTime::currentDateTime());
+ int updays = uptime / 86400; uptime %= 86400;
+ int uphours = uptime / 3600; uptime %= 3600;
+ int upmins = uptime / 60; uptime %= 60;
+
+ QString reply = tr("Quassel Core Version %1
"
+ "Built: %2
"
+ "Up %3d%4h%5m (since %6)")
+ .arg(coreData.value("CoreVersion").toString())
+ .arg(coreData.value("CoreDate").toString())
+ .arg(updays).arg(uphours,2,10,QChar('0')).arg(upmins,2,10,QChar('0')).arg(startTime.toString(Qt::TextDate));
+
+ return reply;
+}
+
#ifdef HAVE_SSL
void ClientSyncer::ignoreSslWarnings(bool permanently) {
QSslSocket *sock = qobject_cast(_socket);
@@ -360,7 +380,7 @@ void ClientSyncer::ignoreSslWarnings(bool permanently) {
else
KnownHostsSettings().saveKnownHost(sock);
}
- emit connectionMsg(_coreMsgBuffer["CoreInfo"].toString());
+ emit connectionMsg(coreInfoString(_coreMsgBuffer));
connectionReady();
}