SSL errors (untrusted/invalid certs etc) are silently ignored at the moment; proper handling
will come soonish.
You can activate SSL encryption for a given server (not network, as this is a per-server
setting) in the server edit dialog in network settings. Please to be testink this :)
connect(network, SIGNAL(autoReconnectIntervalSet(quint32)), this, SLOT(autoReconnectSettingsChanged()));
connect(network, SIGNAL(autoReconnectRetriesSet(quint16)), this, SLOT(autoReconnectSettingsChanged()));
connect(network, SIGNAL(autoReconnectIntervalSet(quint32)), this, SLOT(autoReconnectSettingsChanged()));
connect(network, SIGNAL(autoReconnectRetriesSet(quint16)), this, SLOT(autoReconnectSettingsChanged()));
+#ifndef QT_NO_OPENSSL
+ connect(&socket, SIGNAL(encrypted()), this, SLOT(socketEncrypted()));
+ connect(&socket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(sslErrors(const QList<QSslError> &)));
+#endif
connect(&socket, SIGNAL(connected()), this, SLOT(socketConnected()));
connect(&socket, SIGNAL(connected()), this, SLOT(socketConnected()));
connect(&socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError)));
connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(socketStateChanged(QAbstractSocket::SocketState)));
connect(&socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError)));
connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(socketStateChanged(QAbstractSocket::SocketState)));
connect(_ircServerHandler, SIGNAL(nickChanged(const QString &, const QString &)),
this, SLOT(nickChanged(const QString &, const QString &)));
connect(_ircServerHandler, SIGNAL(nickChanged(const QString &, const QString &)),
this, SLOT(nickChanged(const QString &, const QString &)));
+
+ network->proxy()->attachSignal(this, SIGNAL(sslErrors(const QVariant &)));
}
NetworkConnection::~NetworkConnection() {
}
NetworkConnection::~NetworkConnection() {
}
}
_previousConnectionAttemptFailed = false;
}
}
_previousConnectionAttemptFailed = false;
QString host = serverList[_lastUsedServerlistIndex].toMap()["Host"].toString();
quint16 port = serverList[_lastUsedServerlistIndex].toMap()["Port"].toUInt();
displayStatusMsg(tr("Connecting to %1:%2...").arg(host).arg(port));
QString host = serverList[_lastUsedServerlistIndex].toMap()["Host"].toString();
quint16 port = serverList[_lastUsedServerlistIndex].toMap()["Port"].toUInt();
displayStatusMsg(tr("Connecting to %1:%2...").arg(host).arg(port));
+#ifndef QT_NO_OPENSSL
+
+void NetworkConnection::sslErrors(const QList<QSslError> &errors) {
+ socket.ignoreSslErrors();
+ /* TODO errorhandling
+ QVariantMap errmsg;
+ QVariantList errnums;
+ foreach(QSslError err, errors) errnums << err.error();
+ errmsg["SslErrors"] = errnums;
+ errmsg["SslCert"] = socket.peerCertificate().toPem();
+ errmsg["PeerAddress"] = socket.peerAddress().toString();
+ errmsg["PeerPort"] = socket.peerPort();
+ errmsg["PeerName"] = socket.peerName();
+ emit sslErrors(errmsg);
+ disconnectFromIrc();
+ */
+}
+
+void NetworkConnection::socketEncrypted() {
+ //qDebug() << "encrypted!";
+ socketInitialized();
+}
+
+#endif // QT_NO_OPENSSL
+
void NetworkConnection::socketConnected() {
void NetworkConnection::socketConnected() {
+#ifdef QT_NO_OPENSSL
+ socketInitialized();
+ return;
+#else
+ if(!network()->serverList()[_lastUsedServerlistIndex].toMap()["UseSSL"].toBool()) {
+ socketInitialized();
+ return;
+ }
+ //qDebug() << "starting handshake";
+ socket.startClientEncryption();
+#endif
+}
+
+void NetworkConnection::socketInitialized() {
//emit connected(networkId()); initialize first!
Identity *identity = coreSession()->identity(network()->identity());
if(!identity) {
//emit connected(networkId()); initialize first!
Identity *identity = coreSession()->identity(network()->identity());
if(!identity) {
#include <QAbstractSocket>
#include <QString>
#include <QStringList>
#include <QAbstractSocket>
#include <QString>
#include <QStringList>
+#ifndef QT_NO_OPENSSL
+# include <QSslSocket>
+# include <QSslError>
+#else
+# include <QTcpSocket>
+#endif
+
#include "identity.h"
#include "message.h"
#include "network.h"
#include "identity.h"
#include "message.h"
#include "network.h"
void channelJoined(NetworkId, const QString &channel, const QString &key = QString());
void channelParted(NetworkId, const QString &channel);
void channelJoined(NetworkId, const QString &channel, const QString &key = QString());
void channelParted(NetworkId, const QString &channel);
+ void sslErrors(const QVariant &errorData);
+
private slots:
void socketHasData();
void socketError(QAbstractSocket::SocketError);
void socketConnected();
private slots:
void socketHasData();
void socketError(QAbstractSocket::SocketError);
void socketConnected();
+ void socketInitialized();
void socketDisconnected();
void socketStateChanged(QAbstractSocket::SocketState);
void setConnectionState(Network::ConnectionState);
void networkInitialized(const QString ¤tServer);
void socketDisconnected();
void socketStateChanged(QAbstractSocket::SocketState);
void setConnectionState(Network::ConnectionState);
void networkInitialized(const QString ¤tServer);
+#ifndef QT_NO_OPENSSL
+ void socketEncrypted();
+ void sslErrors(const QList<QSslError> &errors);
+#endif
+
+#ifndef QT_NO_OPENSSL
+ QSslSocket socket;
+#else
Network::ConnectionState _connectionState;
Network *_network;
Network::ConnectionState _connectionState;
Network *_network;
<x>0</x>
<y>0</y>
<width>264</width>
<x>0</x>
<y>0</y>
<width>264</width>
</rect>
</property>
<property name="windowTitle" >
</rect>
</property>
<property name="windowTitle" >
<item>
<widget class="QCheckBox" name="useSSL" >
<property name="enabled" >
<item>
<widget class="QCheckBox" name="useSSL" >
<property name="enabled" >
</property>
<property name="text" >
<string>Use SSL</string>
</property>
<property name="icon" >
</property>
<property name="text" >
<string>Use SSL</string>
</property>
<property name="icon" >
- <iconset resource="../../icons/icons.qrc" >:/16x16/actions/oxygen/16x16/actions/document-encrypt.png</iconset>
+ <iconset resource="../../icons/icons.qrc" >
+ <normaloff>:/16x16/actions/oxygen/16x16/actions/document-encrypt.png</normaloff>:/16x16/actions/oxygen/16x16/actions/document-encrypt.png</iconset>
</property>
</widget>
</item>
</property>
</widget>
</item>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
<size>
<width>20</width>
<height>40</height>
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</property>
</widget>
</item>
quasselVersion = "0.2.0-alpha3-pre";
quasselDate = "2008-03-13";
quasselVersion = "0.2.0-alpha3-pre";
quasselDate = "2008-03-13";
//! Minimum client build number the core needs
clientBuildNeeded = 628;
//! Minimum client build number the core needs
clientBuildNeeded = 628;