Say hello to compression!
[quassel.git] / src / client / clientsyncer.cpp
index a4a4be8..e7f68b0 100644 (file)
@@ -20,7 +20,9 @@
 
 #include "clientsyncer.h"
 
-#include <QNetworkProxy>
+#ifndef QT_NO_NETWORKPROXY
+#  include <QNetworkProxy>
+#endif
 
 #include "client.h"
 #include "global.h"
@@ -131,11 +133,12 @@ void ClientSyncer::connectToCore(const QVariantMap &conn) {
     }
     QTcpSocket *sock = new QTcpSocket(Client::instance());
 #endif
-
+#ifndef QT_NO_NETWORKPROXY
     if(conn.contains("useProxy") && conn["useProxy"].toBool()) {
       QNetworkProxy proxy((QNetworkProxy::ProxyType)conn["proxyType"].toInt(), conn["proxyHost"].toString(), conn["proxyPort"].toUInt(), conn["proxyUser"].toString(), conn["proxyPassword"].toString());
       sock->setProxy(proxy);
     }
+#endif
     socket = sock;
     connect(sock, SIGNAL(readyRead()), this, SLOT(coreHasData()));
     connect(sock, SIGNAL(connected()), this, SLOT(coreSocketConnected()));
@@ -157,6 +160,12 @@ void ClientSyncer::coreSocketConnected() {
   clientInit["ClientDate"] = Global::quasselDate;
   clientInit["ClientBuild"] = Global::quasselBuild; // this is a minimum, since we probably won't update for every commit
   clientInit["UseSsl"] = coreConnectionInfo["useSsl"];
+#ifndef QT_NO_COMPRESS
+  clientInit["UseCompression"] = true;
+#else
+  clientInit["UseCompression"] = false;
+#endif
+
   
   SignalProxy::writeDataToDevice(socket, clientInit);
 }
@@ -203,6 +212,12 @@ void ClientSyncer::clientInitAck(const QVariantMap &msg) {
   }
 #endif
 
+#ifndef QT_NO_COMPRESS
+  if(msg["SupportsCompression"].toBool()) {
+    socket->setProperty("UseCompression", true);
+  }
+#endif
+  
   if(!msg["Configured"].toBool()) {
     // start wizard
     emit startCoreSetup(msg["StorageBackends"].toList());