+void LegacyPeer::dispatch(const RegisterClient &msg) {
+ QVariantMap m;
+ m["MsgType"] = "ClientInit";
+ m["ClientVersion"] = msg.clientVersion;
+ m["ClientDate"] = Quassel::buildInfo().buildDate;
+
+ // FIXME only in compat mode
+ m["ProtocolVersion"] = protocolVersion;
+ m["UseSsl"] = msg.sslSupported;
+#ifndef QT_NO_COMPRESS
+ m["UseCompression"] = true;
+#else
+ m["UseCompression"] = false;
+#endif
+
+ writeMessage(m);
+}
+
+
+void LegacyPeer::dispatch(const ClientDenied &msg) {
+ QVariantMap m;
+ m["MsgType"] = "ClientInitReject";
+ m["Error"] = msg.errorString;
+
+ writeMessage(m);
+}
+
+
+void LegacyPeer::dispatch(const ClientRegistered &msg) {
+ QVariantMap m;
+ m["MsgType"] = "ClientInitAck";
+ m["CoreFeatures"] = msg.coreFeatures;
+ m["StorageBackends"] = msg.backendInfo;
+
+ // FIXME only in compat mode
+ m["ProtocolVersion"] = protocolVersion;
+ 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));
+
+ m["LoginEnabled"] = m["Configured"] = msg.coreConfigured;
+
+ writeMessage(m);
+}
+
+
+void LegacyPeer::dispatch(const SetupData &msg)
+{
+ QVariantMap map;
+ map["AdminUser"] = msg.adminUser;
+ map["AdminPasswd"] = msg.adminPassword;
+ map["Backend"] = msg.backend;
+ map["ConnectionProperties"] = msg.setupData;
+
+ QVariantMap m;
+ m["MsgType"] = "CoreSetupData";
+ m["SetupData"] = map;
+ writeMessage(m);
+}
+
+
+void LegacyPeer::dispatch(const SetupFailed &msg)
+{
+ QVariantMap m;
+ m["MsgType"] = "CoreSetupReject";
+ m["Error"] = msg.errorString;
+
+ writeMessage(m);
+}
+
+
+void LegacyPeer::dispatch(const SetupDone &msg)
+{
+ Q_UNUSED(msg)
+
+ QVariantMap m;
+ m["MsgType"] = "CoreSetupAck";
+
+ writeMessage(m);
+}
+
+
+void LegacyPeer::dispatch(const Login &msg)
+{
+ QVariantMap m;
+ m["MsgType"] = "ClientLogin";
+ m["User"] = msg.user;
+ m["Password"] = msg.password;
+
+ writeMessage(m);
+}
+
+
+void LegacyPeer::dispatch(const LoginFailed &msg)
+{
+ QVariantMap m;
+ m["MsgType"] = "ClientLoginReject";
+ m["Error"] = msg.errorString;
+
+ writeMessage(m);
+}
+
+
+void LegacyPeer::dispatch(const LoginSuccess &msg)
+{
+ Q_UNUSED(msg)
+
+ QVariantMap m;
+ m["MsgType"] = "ClientLoginAck";
+
+ writeMessage(m);
+}
+
+
+void LegacyPeer::dispatch(const SessionState &msg)
+{
+ QVariantMap m;
+ m["MsgType"] = "SessionInit";
+
+ QVariantMap map;
+ map["BufferInfos"] = msg.bufferInfos;
+ map["NetworkIds"] = msg.networkIds;
+ map["Identities"] = msg.identities;
+ m["SessionState"] = map;
+
+ writeMessage(m);
+}
+
+
+/*** Standard messages ***/
+