aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2014-07-19 10:23:40 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2014-07-19 10:23:40 +0200
commit70e7b6005de3e4a2e0237f18196825d96f4ee4d3 (patch)
tree1b017e68025534d194362a6dc206f04a2ca8f553 /src/client
parent68f89992207c592cf0be8567d5c3d5e43157f9b6 (diff)
parent07ae4a63307928e1af97b75b3de23530c74beb3f (diff)
downloadqxmpp-70e7b6005de3e4a2e0237f18196825d96f4ee4d3.tar.gz
Merge branch 'master' of github.com:qxmpp-project/qxmpp
Diffstat (limited to 'src/client')
-rw-r--r--src/client/QXmppClient.cpp8
-rw-r--r--src/client/QXmppClient.h1
-rw-r--r--src/client/QXmppConfiguration.h9
-rw-r--r--src/client/QXmppDiscoveryManager.cpp3
-rw-r--r--src/client/QXmppOutgoingClient.cpp11
5 files changed, 26 insertions, 6 deletions
diff --git a/src/client/QXmppClient.cpp b/src/client/QXmppClient.cpp
index 4a5eab9c..daf298be 100644
--- a/src/client/QXmppClient.cpp
+++ b/src/client/QXmppClient.cpp
@@ -456,6 +456,14 @@ QAbstractSocket::SocketError QXmppClient::socketError()
return d->stream->socket()->error();
}
+/// Returns the human-readable description of the last socket error if error() is QXmppClient::SocketError.
+///
+
+QString QXmppClient::socketErrorString() const
+{
+ return d->stream->socket()->errorString();
+}
+
/// Returns the XMPP stream error if QXmppClient::Error is QXmppClient::XmppStreamError.
///
diff --git a/src/client/QXmppClient.h b/src/client/QXmppClient.h
index 985ea97c..b2ca9b96 100644
--- a/src/client/QXmppClient.h
+++ b/src/client/QXmppClient.h
@@ -149,6 +149,7 @@ public:
void setLogger(QXmppLogger *logger);
QAbstractSocket::SocketError socketError();
+ QString socketErrorString() const;
State state() const;
QXmppStanza::Error::Condition xmppStreamError();
diff --git a/src/client/QXmppConfiguration.h b/src/client/QXmppConfiguration.h
index 513075c3..0de57e79 100644
--- a/src/client/QXmppConfiguration.h
+++ b/src/client/QXmppConfiguration.h
@@ -53,10 +53,11 @@ public:
/// Depending upon all this user can specify following options.
enum StreamSecurityMode
{
- TLSEnabled = 0, ///< Encryption is used if available (default)
- TLSDisabled, ///< No encryption is server allows
- TLSRequired ///< Encryption is a must otherwise connection would not
- ///< be established
+ TLSEnabled = 0, ///< Encryption is used if available (default).
+ TLSDisabled, ///< No encryption even if the server offers it.
+ TLSRequired, ///< Encryption must be available, otherwise the
+ ///< connection will not be established.
+ LegacySSL ///< Use only legacy SSL mode.
};
/// An enumeration for various Non-SASL authentication mechanisms available.
diff --git a/src/client/QXmppDiscoveryManager.cpp b/src/client/QXmppDiscoveryManager.cpp
index 5188a4e7..7c9a777e 100644
--- a/src/client/QXmppDiscoveryManager.cpp
+++ b/src/client/QXmppDiscoveryManager.cpp
@@ -115,7 +115,8 @@ QXmppDiscoveryIq QXmppDiscoveryManager::capabilities()
<< ns_chat_states // XEP-0085: Chat State Notifications
<< ns_capabilities // XEP-0115: Entity Capabilities
<< ns_ping // XEP-0199: XMPP Ping
- << ns_attention; // XEP-0224: Attention
+ << ns_attention // XEP-0224: Attention
+ << ns_chat_markers; // XEP-0333: Chat Markers
foreach(QXmppClientExtension* extension, client()->extensions())
{
diff --git a/src/client/QXmppOutgoingClient.cpp b/src/client/QXmppOutgoingClient.cpp
index 0ee1d1af..666b0365 100644
--- a/src/client/QXmppOutgoingClient.cpp
+++ b/src/client/QXmppOutgoingClient.cpp
@@ -129,7 +129,16 @@ void QXmppOutgoingClientPrivate::connectToHost(const QString &host, quint16 port
#endif
// connect to host
- q->socket()->connectToHost(host, port);
+ const QXmppConfiguration::StreamSecurityMode localSecurity = q->configuration().streamSecurityMode();
+ if (localSecurity == QXmppConfiguration::LegacySSL) {
+ if (!q->socket()->supportsSsl()) {
+ q->warning("Not connecting as legacy SSL was requested, but SSL support is not available");
+ return;
+ }
+ q->socket()->connectToHostEncrypted(host, port);
+ } else {
+ q->socket()->connectToHost(host, port);
+ }
}
/// Constructs an outgoing client stream.