aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-09-05 15:28:18 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-09-05 15:28:18 +0200
commit9168d631d5c266ee79c3112840423d4fca0c96dd (patch)
treed5e9d67627ca46cb04eb63e06a50ffa7dc38aa7d /src/client
parent49d30871e8a605bea9679353afd9a6fb6a877664 (diff)
downloadqxmpp-9168d631d5c266ee79c3112840423d4fca0c96dd.tar.gz
Add support for X-OAUTH2 authentication for Google Talk.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/QXmppConfiguration.cpp22
-rw-r--r--src/client/QXmppConfiguration.h3
-rw-r--r--src/client/QXmppOutgoingClient.cpp5
3 files changed, 29 insertions, 1 deletions
diff --git a/src/client/QXmppConfiguration.cpp b/src/client/QXmppConfiguration.cpp
index d8a4b82e..31ebcd29 100644
--- a/src/client/QXmppConfiguration.cpp
+++ b/src/client/QXmppConfiguration.cpp
@@ -43,6 +43,9 @@ public:
QString facebookAccessToken;
QString facebookAppId;
+ // Google
+ QString googleAccessToken;
+
// Windows Live
QString windowsLiveAccessToken;
@@ -331,6 +334,25 @@ void QXmppConfiguration::setFacebookAppId(const QString& appId)
d->facebookAppId = appId;
}
+/// Returns the access token used for X-OAUTH2 authentication.
+
+QString QXmppConfiguration::googleAccessToken() const
+{
+ return d->googleAccessToken;
+}
+
+/// Sets the access token used for X-OAUTH2 authentication.
+///
+/// This token is returned by Google at the end of the OAuth authentication
+/// process.
+///
+/// \param accessToken
+
+void QXmppConfiguration::setGoogleAccessToken(const QString& accessToken)
+{
+ d->googleAccessToken = accessToken;
+}
+
/// Returns the access token used for X-MESSENGER-OAUTH2 authentication.
QString QXmppConfiguration::windowsLiveAccessToken() const
diff --git a/src/client/QXmppConfiguration.h b/src/client/QXmppConfiguration.h
index 4a690edf..e7d01d3b 100644
--- a/src/client/QXmppConfiguration.h
+++ b/src/client/QXmppConfiguration.h
@@ -107,6 +107,9 @@ public:
QString facebookAppId() const;
void setFacebookAppId(const QString&);
+ QString googleAccessToken() const;
+ void setGoogleAccessToken(const QString &accessToken);
+
QString windowsLiveAccessToken() const;
void setWindowsLiveAccessToken(const QString &accessToken);
diff --git a/src/client/QXmppOutgoingClient.cpp b/src/client/QXmppOutgoingClient.cpp
index 6f84d090..d6b41202 100644
--- a/src/client/QXmppOutgoingClient.cpp
+++ b/src/client/QXmppOutgoingClient.cpp
@@ -370,7 +370,7 @@ void QXmppOutgoingClient::handleStanza(const QDomElement &nodeRecv)
if (saslAvailable && configuration().useSASLAuthentication())
{
// supported and preferred SASL auth mechanisms
- const QStringList supportedMechanisms = QXmppSaslClient::availableMechanisms();
+ QStringList supportedMechanisms = QXmppSaslClient::availableMechanisms();
const QString preferredMechanism = configuration().saslAuthMechanism();
// determine SASL Authentication mechanism to use
@@ -405,6 +405,9 @@ void QXmppOutgoingClient::handleStanza(const QDomElement &nodeRecv)
d->saslClient->setPassword(configuration().facebookAccessToken());
} else if (d->saslClient->mechanism() == "X-MESSENGER-OAUTH2") {
d->saslClient->setPassword(configuration().windowsLiveAccessToken());
+ } else if (d->saslClient->mechanism() == "X-OAUTH2") {
+ d->saslClient->setUsername(configuration().user());
+ d->saslClient->setPassword(configuration().googleAccessToken());
} else {
d->saslClient->setUsername(configuration().user());
d->saslClient->setPassword(configuration().password());