Quassel _should_ now compile again if Qt doesn't provide SSL-Support.
authorMarcus Eggenberger <egs@quassel-irc.org>
Mon, 31 Mar 2008 22:19:33 +0000 (22:19 +0000)
committerMarcus Eggenberger <egs@quassel-irc.org>
Mon, 31 Mar 2008 22:19:33 +0000 (22:19 +0000)
This is untested, so please let me know if there's still work to be done.

src/client/clientsyncer.cpp
src/client/clientsyncer.h
src/core/core.cpp
src/core/core.h
src/core/sslserver.cpp
src/core/sslserver.h
src/qtui/coreconnectdlg.cpp
version.inc

index 952860a..2c2a5df 100644 (file)
 #include "signalproxy.h"
 
 
 #include "signalproxy.h"
 
 
-ClientSyncer::ClientSyncer(QObject *parent) : QObject(parent) {
+ClientSyncer::ClientSyncer(QObject *parent)
+  : QObject(parent)
+{
   socket = 0;
   blockSize = 0;
 
   connect(Client::signalProxy(), SIGNAL(disconnected()), this, SLOT(coreSocketDisconnected()));
   socket = 0;
   blockSize = 0;
 
   connect(Client::signalProxy(), SIGNAL(disconnected()), this, SLOT(coreSocketDisconnected()));
-
 }
 
 ClientSyncer::~ClientSyncer() {
 }
 
 ClientSyncer::~ClientSyncer() {
-
-
 }
 
 void ClientSyncer::coreHasData() {
 }
 
 void ClientSyncer::coreHasData() {
@@ -125,6 +124,11 @@ void ClientSyncer::connectToCore(const QVariantMap &conn) {
 #ifndef QT_NO_OPENSSL
     QSslSocket *sock = new QSslSocket(Client::instance());
 #else
 #ifndef QT_NO_OPENSSL
     QSslSocket *sock = new QSslSocket(Client::instance());
 #else
+    if(conn["useSsl"].toBool()) {
+       emit connectionError(tr("<b>This client is built without SSL Support!</b><br />Disable the usage of SSL in the account settings."));
+       emit encrypted(false);
+       return;
+    }
     QTcpSocket *sock = new QTcpSocket(Client::instance());
 #endif
 
     QTcpSocket *sock = new QTcpSocket(Client::instance());
 #endif
 
@@ -180,19 +184,15 @@ void ClientSyncer::clientInitAck(const QVariantMap &msg) {
     return;
   }
   emit connectionMsg(msg["CoreInfo"].toString());
     return;
   }
   emit connectionMsg(msg["CoreInfo"].toString());
+
+#ifndef QT_NO_OPENSSL
   if(coreConnectionInfo["useSsl"].toBool()) {
     if(msg["SupportSsl"].toBool()) {
       QSslSocket *sslSocket = qobject_cast<QSslSocket *>(socket);
   if(coreConnectionInfo["useSsl"].toBool()) {
     if(msg["SupportSsl"].toBool()) {
       QSslSocket *sslSocket = qobject_cast<QSslSocket *>(socket);
-      if(sslSocket) {
-       connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(sslErrors(const QList<QSslError> &)));
-       sslSocket->startClientEncryption();
-       emit encrypted(true);
-      } else {
-       emit connectionError(tr("<b>This client is built without SSL Support!</b><br />Disable the usage of SSL in the account settings."));
-       emit encrypted(false);
-       disconnectFromCore();
-       return;
-      }
+      Q_ASSERT(sslSocket);
+      connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(sslErrors(const QList<QSslError> &)));
+      sslSocket->startClientEncryption();
+      emit encrypted(true);
     } else {
       emit connectionError(tr("<b>The Quassel Core you are trying to connect to does not support SSL!</b><br />If you want to connect anyways, disable the usage of SSL in the account settings."));
       emit encrypted(false);
     } else {
       emit connectionError(tr("<b>The Quassel Core you are trying to connect to does not support SSL!</b><br />If you want to connect anyways, disable the usage of SSL in the account settings."));
       emit encrypted(false);
@@ -200,6 +200,7 @@ void ClientSyncer::clientInitAck(const QVariantMap &msg) {
       return;
     }
   }
       return;
     }
   }
+#endif
 
   if(!msg["Configured"].toBool()) {
     // start wizard
 
   if(!msg["Configured"].toBool()) {
     // start wizard
@@ -359,6 +360,7 @@ void ClientSyncer::checkSyncState() {
   }
 }
 
   }
 }
 
+#ifndef QT_NO_OPENSSL
 void ClientSyncer::sslErrors(const QList<QSslError> &errors) {
   qDebug() << "SSL Errors:";
   foreach(QSslError err, errors)
 void ClientSyncer::sslErrors(const QList<QSslError> &errors) {
   qDebug() << "SSL Errors:";
   foreach(QSslError err, errors)
@@ -368,3 +370,4 @@ void ClientSyncer::sslErrors(const QList<QSslError> &errors) {
   if(socket)
     socket->ignoreSslErrors();
 }
   if(socket)
     socket->ignoreSslErrors();
 }
+#endif
index 5ea2ae4..44e3373 100644 (file)
 
 #include <QPointer>
 #include <QString>
 
 #include <QPointer>
 #include <QString>
-#include <QTcpSocket>
-#include <QSslSocket>
 #include <QVariantMap>
 
 #include <QVariantMap>
 
+#ifndef QT_NO_OPENSSL
+#include <QSslSocket>
+#else
+#include <QTcpSocket>
+#endif
+
 class IrcUser;
 class IrcChannel;
 
 class IrcUser;
 class IrcChannel;
 
@@ -85,7 +89,9 @@ class ClientSyncer : public QObject {
     void sessionStateReceived(const QVariantMap &state);
 
     void doCoreSetup(const QVariant &setupData);
     void sessionStateReceived(const QVariantMap &state);
 
     void doCoreSetup(const QVariant &setupData);
+#ifndef QT_NO_OPENSSL
     void sslErrors(const QList<QSslError> &errors);
     void sslErrors(const QList<QSslError> &errors);
+#endif
   
   private:
     QPointer<QIODevice> socket;
   
   private:
     QPointer<QIODevice> socket;
index 50bfa73..8a1c777 100644 (file)
@@ -334,7 +334,6 @@ void Core::stopListening() {
 }
 
 void Core::incomingConnection() {
 }
 
 void Core::incomingConnection() {
-  // TODO implement SSL
   while(server.hasPendingConnections()) {
     QTcpSocket *socket = server.nextPendingConnection();
     connect(socket, SIGNAL(disconnected()), this, SLOT(clientDisconnected()));
   while(server.hasPendingConnections()) {
     QTcpSocket *socket = server.nextPendingConnection();
     connect(socket, SIGNAL(disconnected()), this, SLOT(clientDisconnected()));
@@ -385,9 +384,14 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
                             "Up %3d%4h%5m (since %6)").arg(Global::quasselVersion).arg(Global::quasselBuild)
                             .arg(updays).arg(uphours,2,10,QChar('0')).arg(upmins,2,10,QChar('0')).arg(startTime.toString(Qt::TextDate));
 
                             "Up %3d%4h%5m (since %6)").arg(Global::quasselVersion).arg(Global::quasselBuild)
                             .arg(updays).arg(uphours,2,10,QChar('0')).arg(upmins,2,10,QChar('0')).arg(startTime.toString(Qt::TextDate));
 
+#ifndef QT_NO_OPENSSL
     SslServer *sslServer = qobject_cast<SslServer *>(&server);
     QSslSocket *sslSocket = qobject_cast<QSslSocket *>(socket);
     bool supportSsl = (bool)sslServer && (bool)sslSocket && sslServer->certIsValid();
     SslServer *sslServer = qobject_cast<SslServer *>(&server);
     QSslSocket *sslSocket = qobject_cast<QSslSocket *>(socket);
     bool supportSsl = (bool)sslServer && (bool)sslSocket && sslServer->certIsValid();
+#else
+    bool supportSsl = false;
+#endif
+    
     reply["SupportSsl"] = supportSsl;
     // switch to ssl after client has been informed about our capabilities (see below)
 
     reply["SupportSsl"] = supportSsl;
     // switch to ssl after client has been informed about our capabilities (see below)
 
@@ -422,13 +426,14 @@ void Core::processClientMessage(QTcpSocket *socket, const QVariantMap &msg) {
     reply["MsgType"] = "ClientInitAck";
     SignalProxy::writeDataToDevice(socket, reply);
 
     reply["MsgType"] = "ClientInitAck";
     SignalProxy::writeDataToDevice(socket, reply);
 
+#ifndef QT_NO_OPENSSL
     // after we told the client that we are ssl capable we switch to ssl mode
     if(supportSsl && msg["UseSsl"].toBool()) {
       qDebug() << "Starting TLS for Client:"  << qPrintable(socket->peerAddress().toString());
       connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(sslErrors(const QList<QSslError> &)));
       sslSocket->startServerEncryption();
     }
     // after we told the client that we are ssl capable we switch to ssl mode
     if(supportSsl && msg["UseSsl"].toBool()) {
       qDebug() << "Starting TLS for Client:"  << qPrintable(socket->peerAddress().toString());
       connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(sslErrors(const QList<QSslError> &)));
       sslSocket->startServerEncryption();
     }
-    
+#endif
 
   } else {
     // for the rest, we need an initialized connection
 
   } else {
     // for the rest, we need an initialized connection
@@ -515,12 +520,14 @@ SessionThread *Core::createSession(UserId uid, bool restore) {
   return sess;
 }
 
   return sess;
 }
 
+#ifndef QT_NO_OPENSSL
 void Core::sslErrors(const QList<QSslError> &errors) {
   Q_UNUSED(errors);
   QSslSocket *socket = qobject_cast<QSslSocket *>(sender());
   if(socket)
     socket->ignoreSslErrors();
 }
 void Core::sslErrors(const QList<QSslError> &errors) {
   Q_UNUSED(errors);
   QSslSocket *socket = qobject_cast<QSslSocket *>(sender());
   if(socket)
     socket->ignoreSslErrors();
 }
+#endif
 
 void Core::socketError(QAbstractSocket::SocketError err) {
   QAbstractSocket *socket = qobject_cast<QAbstractSocket *>(sender());
 
 void Core::socketError(QAbstractSocket::SocketError err) {
   QAbstractSocket *socket = qobject_cast<QAbstractSocket *>(sender());
index 277c43c..f32502e 100644 (file)
 #include <QString>
 #include <QVariant>
 #include <QTimer>
 #include <QString>
 #include <QVariant>
 #include <QTimer>
-#include <QTcpSocket>
+
+#ifndef QT_NO_OPENSSL
 #include <QSslSocket>
 #include <QSslSocket>
+#include "sslserver.h"
+#else
+#include <QTcpSocket>
+#include <QTcpServer>
+#endif
 
 #include "bufferinfo.h"
 #include "message.h"
 #include "global.h"
 #include "sessionthread.h"
 
 #include "bufferinfo.h"
 #include "message.h"
 #include "global.h"
 #include "sessionthread.h"
-#include "sslserver.h"
 #include "types.h"
 
 class CoreSession;
 #include "types.h"
 
 class CoreSession;
@@ -271,7 +276,9 @@ class Core : public QObject {
 
     bool initStorage(QVariantMap dbSettings, bool setup = false);
 
 
     bool initStorage(QVariantMap dbSettings, bool setup = false);
 
+#ifndef QT_NO_OPENSSL
     void sslErrors(const QList<QSslError> &errors);
     void sslErrors(const QList<QSslError> &errors);
+#endif
     void socketError(QAbstractSocket::SocketError);
 
   private:
     void socketError(QAbstractSocket::SocketError);
 
   private:
index b007a65..b19ee5f 100644 (file)
@@ -18,6 +18,8 @@
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
+#ifndef QT_NO_OPENSSL
+
 #include "sslserver.h"
 
 #include <QSslSocket>
 #include "sslserver.h"
 
 #include <QSslSocket>
@@ -66,3 +68,5 @@ void SslServer::incomingConnection(int socketDescriptor) {
     delete serverSocket;
   }
 }
     delete serverSocket;
   }
 }
+
+#endif // QT_NO_OPENSSL
index 3dd5bd9..f96f54f 100644 (file)
@@ -18,6 +18,8 @@
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
+#ifndef QT_NO_OPENSSL
+
 #ifndef SSLSERVER_H
 #define SSLSERVER_H
 
 #ifndef SSLSERVER_H
 #define SSLSERVER_H
 
@@ -50,3 +52,5 @@ private:
 };
 
 #endif //SSLSERVER_H
 };
 
 #endif //SSLSERVER_H
+
+#endif QT_NO_OPENSSL
index b4225ef..bc4cf31 100644 (file)
@@ -459,7 +459,6 @@ void CoreConnectDlg::syncFinished() {
 /*****************************************************************************************
  * CoreAccountEditDlg
  *****************************************************************************************/
 /*****************************************************************************************
  * CoreAccountEditDlg
  *****************************************************************************************/
-
 CoreAccountEditDlg::CoreAccountEditDlg(AccountId id, const QVariantMap &acct, const QStringList &_existing, QWidget *parent) : QDialog(parent) {
   ui.setupUi(this);
   existing = _existing;
 CoreAccountEditDlg::CoreAccountEditDlg(AccountId id, const QVariantMap &acct, const QStringList &_existing, QWidget *parent) : QDialog(parent) {
   ui.setupUi(this);
   existing = _existing;
@@ -479,7 +478,12 @@ CoreAccountEditDlg::CoreAccountEditDlg(AccountId id, const QVariantMap &acct, co
     ui.port->setValue(acct["Port"].toUInt());
     ui.useInternal->setChecked(acct["UseInternal"].toBool());
     ui.accountName->setText(acct["AccountName"].toString());
     ui.port->setValue(acct["Port"].toUInt());
     ui.useInternal->setChecked(acct["UseInternal"].toBool());
     ui.accountName->setText(acct["AccountName"].toString());
+#ifndef QT_NO_OPENSSL
     ui.useSsl->setChecked(account["useSsl"].toBool());
     ui.useSsl->setChecked(account["useSsl"].toBool());
+#else
+    ui.useSsl->setChecked(false);
+    ui.useSsl->setEnabled(false);
+#endif
     ui.useProxy->setChecked(account["useProxy"].toBool());
     ui.proxyHost->setText(account["proxyHost"].toString());
     ui.proxyPort->setValue(account["proxyPort"].toUInt());
     ui.useProxy->setChecked(account["useProxy"].toBool());
     ui.proxyHost->setText(account["proxyHost"].toString());
     ui.proxyPort->setValue(account["proxyPort"].toUInt());
index 38887a2..7b919d6 100644 (file)
@@ -4,8 +4,8 @@
 { using namespace Global;
 
   quasselVersion = "0.2.0-alpha5-pre";
 { using namespace Global;
 
   quasselVersion = "0.2.0-alpha5-pre";
-  quasselDate = "2008-03-31";
-  quasselBuild = 677;
+  quasselDate = "2008-04-01";
+  quasselBuild = 679;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 642;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 642;