Remove CoreInfo from the ClientRegistered handshake message
[quassel.git] / src / common / protocols / legacy / legacypeer.cpp
index 49c77fd..9ceb460 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2014 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  *
  ***************************************************************************/
 
 #include <QHostAddress>
+#include <QDataStream>
 #include <QTcpSocket>
 
 #include "legacypeer.h"
-#include "quassel.h"
 
 /* version.inc is no longer used for this */
 const uint protocolVersion = 10;
@@ -31,8 +31,8 @@ const uint clientNeedsProtocol = protocolVersion;
 
 using namespace Protocol;
 
-LegacyPeer::LegacyPeer(::AuthHandler *authHandler, QTcpSocket *socket, QObject *parent)
-    : RemotePeer(authHandler, socket, Compressor::NoCompression, parent),
+LegacyPeer::LegacyPeer(::AuthHandler *authHandler, QTcpSocket *socket, Compressor::CompressionLevel level, QObject *parent)
+    : RemotePeer(authHandler, socket, level, parent),
     _useCompression(false)
 {
 
@@ -151,7 +151,7 @@ void LegacyPeer::handleHandshakeMessage(const QVariant &msg)
             socket()->setProperty("UseCompression", true);
         }
 #endif
-        handle(RegisterClient(m["ClientVersion"].toString(), m["UseSsl"].toBool()));
+        handle(RegisterClient(m["ClientVersion"].toString(), m["ClientDate"].toString(), m["UseSsl"].toBool()));
     }
 
     else if (msgType == "ClientInitReject") {
@@ -170,7 +170,7 @@ void LegacyPeer::handleHandshakeMessage(const QVariant &msg)
             socket()->setProperty("UseCompression", true);
 #endif
 
-        handle(ClientRegistered(m["CoreFeatures"].toUInt(), m["Configured"].toBool(), m["StorageBackends"].toList(), m["SupportSsl"].toBool(), QDateTime()));
+        handle(ClientRegistered(m["CoreFeatures"].toUInt(), m["Configured"].toBool(), m["StorageBackends"].toList(), m["SupportSsl"].toBool()));
     }
 
     else if (msgType == "CoreSetupData") {
@@ -213,7 +213,7 @@ void LegacyPeer::dispatch(const RegisterClient &msg) {
     QVariantMap m;
     m["MsgType"] = "ClientInit";
     m["ClientVersion"] = msg.clientVersion;
-    m["ClientDate"] = Quassel::buildInfo().buildDate;
+    m["ClientDate"] = msg.buildDate;
 
     // FIXME only in compat mode
     m["ProtocolVersion"] = protocolVersion;
@@ -248,16 +248,8 @@ void LegacyPeer::dispatch(const ClientRegistered &msg) {
     m["SupportSsl"] = msg.sslSupported;
     m["SupportsCompression"] = socket()->property("UseCompression").toBool(); // this property gets already set in the ClientInit handler
 
-    // This is only used for old v10 clients (pre-0.5)
-    int uptime = msg.coreStartTime.secsTo(QDateTime::currentDateTime().toUTC());
-    int updays = uptime / 86400; uptime %= 86400;
-    int uphours = uptime / 3600; uptime %= 3600;
-    int upmins = uptime / 60;
-    m["CoreInfo"] = tr("<b>Quassel Core Version %1</b><br>"
-                       "Built: %2<br>"
-                       "Up %3d%4h%5m (since %6)").arg(Quassel::buildInfo().fancyVersionString)
-                       .arg(Quassel::buildInfo().buildDate)
-                       .arg(updays).arg(uphours, 2, 10, QChar('0')).arg(upmins, 2, 10, QChar('0')).arg(msg.coreStartTime.toString(Qt::TextDate));
+    // This is only used for display by really old v10 clients (pre-0.5), and we no longer set this
+    m["CoreInfo"] = QString();
 
     m["LoginEnabled"] = m["Configured"] = msg.coreConfigured;