aboutsummaryrefslogtreecommitdiff
path: root/src/client/QXmppConfiguration.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-07-18 15:17:22 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-07-18 15:17:22 +0200
commitef9f9a57f1dd2e70d29afa26fa0d1ab38a5e3aca (patch)
tree2fe85d94ccefcbd24f83bc91e1bfe271beb6337b /src/client/QXmppConfiguration.cpp
parent89a558dfbbbde668666e7d8af8f52c23fa61530b (diff)
downloadqxmpp-ef9f9a57f1dd2e70d29afa26fa0d1ab38a5e3aca.tar.gz
Make SASL mechanisms string based.
Deprecate QXmppConfiguration::setSASLAuthMechanism(), replaced by the string-based QXmppConfiguration::setSaslAuthMechanism().
Diffstat (limited to 'src/client/QXmppConfiguration.cpp')
-rw-r--r--src/client/QXmppConfiguration.cpp58
1 files changed, 45 insertions, 13 deletions
diff --git a/src/client/QXmppConfiguration.cpp b/src/client/QXmppConfiguration.cpp
index 544997be..62fa7a07 100644
--- a/src/client/QXmppConfiguration.cpp
+++ b/src/client/QXmppConfiguration.cpp
@@ -64,7 +64,7 @@ public:
QXmppConfiguration::StreamSecurityMode streamSecurityMode;
QXmppConfiguration::NonSASLAuthMechanism nonSASLAuthMechanism;
- QXmppConfiguration::SASLAuthMechanism SASLAuthMechanism;
+ QString saslAuthMechanism;
QNetworkProxy networkProxy;
@@ -84,7 +84,7 @@ QXmppConfigurationPrivate::QXmppConfigurationPrivate()
, ignoreSslErrors(true)
, streamSecurityMode(QXmppConfiguration::TLSEnabled)
, nonSASLAuthMechanism(QXmppConfiguration::NonSASLDigest)
- , SASLAuthMechanism(QXmppConfiguration::SASLDigestMD5)
+ , saslAuthMechanism("DIGEST-MD5")
{
}
@@ -447,25 +447,22 @@ void QXmppConfiguration::setNonSASLAuthMechanism(
d->nonSASLAuthMechanism = mech;
}
-/// Returns the SASL authentication mechanism configuration.
-///
-/// \return QXmppConfiguration::SASLAuthMechanism
+/// Returns the preferred SASL authentication mechanism.
///
+/// Default value: "DIGEST-MD5"
-QXmppConfiguration::SASLAuthMechanism QXmppConfiguration::sASLAuthMechanism() const
+QString QXmppConfiguration::saslAuthMechanism() const
{
- return d->SASLAuthMechanism;
+ return d->saslAuthMechanism;
}
-/// Hints the library the SASL authentication mechanism to be used for authentication.
-///
-/// \param mech QXmppConfiguration::SASLAuthMechanism
+/// Sets the preferred SASL authentication \a mechanism.
///
+/// Valid values: "PLAIN", "DIGEST-MD5", "ANONYMOUS", "X-FACEBOOK-PLATFORM"
-void QXmppConfiguration::setSASLAuthMechanism(
- QXmppConfiguration::SASLAuthMechanism mech)
+void QXmppConfiguration::setSaslAuthMechanism(const QString &mechanism)
{
- d->SASLAuthMechanism = mech;
+ d->saslAuthMechanism = mechanism;
}
/// Specifies the network proxy used for the connection made by QXmppClient.
@@ -547,3 +544,38 @@ QList<QSslCertificate> QXmppConfiguration::caCertificates() const
return d->caCertificates;
}
+// obsolete
+
+QXmppConfiguration::SASLAuthMechanism QXmppConfiguration::sASLAuthMechanism() const
+{
+ if (d->saslAuthMechanism == "PLAIN")
+ return SASLPlain;
+ else if (d->saslAuthMechanism == "DIGEST-MD5")
+ return SASLDigestMD5;
+ else if (d->saslAuthMechanism == "ANONYMOUS")
+ return SASLAnonymous;
+ else if (d->saslAuthMechanism == "X-FACEBOOK-PLATFORM")
+ return SASLXFacebookPlatform;
+ else
+ return SASLDigestMD5;
+}
+
+void QXmppConfiguration::setSASLAuthMechanism(
+ QXmppConfiguration::SASLAuthMechanism mech)
+{
+ switch (mech) {
+ case QXmppConfiguration::SASLPlain:
+ d->saslAuthMechanism = "PLAIN";
+ break;
+ case QXmppConfiguration::SASLDigestMD5:
+ d->saslAuthMechanism = "DIGEST-MD5";
+ break;
+ case QXmppConfiguration::SASLAnonymous:
+ d->saslAuthMechanism = "ANONYMOUS";
+ break;
+ case QXmppConfiguration::SASLXFacebookPlatform:
+ d->saslAuthMechanism = "X-FACEBOOK-PLATFORM";
+ break;
+ }
+}
+