[SCM] ktp-auth-handler packaging branch, upstream, updated. upstream/0.8.1-9-g4539067
Maximiliano Curia
maxy at moszumanska.debian.org
Wed Jan 27 19:56:09 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-auth-handler.git;a=commitdiff;h=648abfa
The following commit has been merged in the upstream branch:
commit 648abfa9c7c5efc2126a5c136894131f66a39977
Author: Maximiliano Curia <maxy at gnuservers.com.ar>
Date: Mon Oct 12 15:26:54 2015 +0200
Imported Upstream version 15.08.2
---
CMakeLists.txt | 2 +-
sasl-auth-op.cpp | 48 +++++++++++++++++++++++++++++-------------------
sasl-auth-op.h | 2 ++
3 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4e98343..4105ae3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,7 @@ project(ktp-auth-handler)
# KDE Application Version, managed by release script
set(KDE_APPLICATIONS_VERSION_MAJOR "15")
set(KDE_APPLICATIONS_VERSION_MINOR "08")
-set(KDE_APPLICATIONS_VERSION_MICRO "1")
+set(KDE_APPLICATIONS_VERSION_MICRO "2")
set(KTP_AUTH_HANDLER_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}")
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
diff --git a/sasl-auth-op.cpp b/sasl-auth-op.cpp
index 7b465a8..af86b8e 100644
--- a/sasl-auth-op.cpp
+++ b/sasl-auth-op.cpp
@@ -52,41 +52,45 @@ SaslAuthOp::~SaslAuthOp()
void SaslAuthOp::gotProperties(Tp::PendingOperation *op)
{
- if (op->isError()) {
- qWarning() << "Unable to retrieve available SASL mechanisms";
- m_channel->requestClose();
- setFinishedWithError(op->errorName(), op->errorMessage());
- return;
+ if (m_mechanisms.isEmpty()) {
+ if (op->isError()) {
+ qWarning() << "Unable to retrieve available SASL mechanisms";
+ m_channel->requestClose();
+ setFinishedWithError(op->errorName(), op->errorMessage());
+ return;
+ }
+
+ Tp::PendingVariantMap *pvm = qobject_cast<Tp::PendingVariantMap*>(op);
+ m_properties = qdbus_cast<QVariantMap>(pvm->result());
+ m_mechanisms = qdbus_cast<QStringList>(m_properties.value(QLatin1String("AvailableMechanisms")));
+ qDebug() << m_mechanisms;
}
- Tp::PendingVariantMap *pvm = qobject_cast<Tp::PendingVariantMap*>(op);
- QVariantMap props = qdbus_cast<QVariantMap>(pvm->result());
- QStringList mechanisms = qdbus_cast<QStringList>(props.value(QLatin1String("AvailableMechanisms")));
- qDebug() << mechanisms;
+ uint status = qdbus_cast<uint>(m_properties.value(QLatin1String("SASLStatus")));
+ QString error = qdbus_cast<QString>(m_properties.value(QLatin1String("SASLError")));
+ QVariantMap errorDetails = qdbus_cast<QVariantMap>(m_properties.value(QLatin1String("SASLErrorDetails")));
- uint status = qdbus_cast<uint>(props.value(QLatin1String("SASLStatus")));
- QString error = qdbus_cast<QString>(props.value(QLatin1String("SASLError")));
- QVariantMap errorDetails = qdbus_cast<QVariantMap>(props.value(QLatin1String("SASLErrorDetails")));
-
- if (mechanisms.contains(QLatin1String("X-OAUTH2"))) {
+ if (m_mechanisms.contains(QLatin1String("X-OAUTH2"))) {
qDebug() << "Starting X-OAuth2 auth";
+ m_mechanisms.removeAll(QStringLiteral("X-OAUTH2"));
XTelepathySSOGoogleOperation *authop = new XTelepathySSOGoogleOperation(m_account, m_accountStorageId, m_saslIface);
connect(authop,
SIGNAL(finished(Tp::PendingOperation*)),
SLOT(onAuthOperationFinished(Tp::PendingOperation*)));
authop->onSASLStatusChanged(status, error, errorDetails);
- } else if (mechanisms.contains(QLatin1String("X-TELEPATHY-PASSWORD"))) {
+ } else if (m_mechanisms.contains(QLatin1String("X-TELEPATHY-PASSWORD"))) {
qDebug() << "Starting Password auth";
+ m_mechanisms.removeAll(QStringLiteral("X-TELEPATHY-PASSWORD"));
Q_EMIT ready(this);
- XTelepathyPasswordAuthOperation *authop = new XTelepathyPasswordAuthOperation(m_account, m_accountStorageId, m_saslIface, qdbus_cast<bool>(props.value(QLatin1String("CanTryAgain"))));
+ XTelepathyPasswordAuthOperation *authop = new XTelepathyPasswordAuthOperation(m_account, m_accountStorageId, m_saslIface, qdbus_cast<bool>(m_properties.value(QLatin1String("CanTryAgain"))));
connect(authop,
SIGNAL(finished(Tp::PendingOperation*)),
SLOT(onAuthOperationFinished(Tp::PendingOperation*)));
authop->onSASLStatusChanged(status, error, errorDetails);
} else {
- qWarning() << "X-TELEPATHY-PASSWORD, X-OAUTH2 are the only supported SASL mechanism and are not available:" << mechanisms;
+ qWarning() << "X-TELEPATHY-PASSWORD, X-OAUTH2 are the only supported SASL mechanism and are not available:" << m_mechanisms;
m_channel->requestClose();
setFinishedWithError(TP_QT_ERROR_NOT_IMPLEMENTED,
QLatin1String("X-TELEPATHY-PASSWORD, X-OAUTH2 are the only supported SASL mechanism and are not available:"));
@@ -96,11 +100,17 @@ void SaslAuthOp::gotProperties(Tp::PendingOperation *op)
void SaslAuthOp::onAuthOperationFinished(Tp::PendingOperation *op)
{
- m_channel->requestClose();
if (op->isError()) {
- setFinishedWithError(op->errorName(), op->errorMessage());
+ if (!m_mechanisms.isEmpty()) {
+ // if we have other mechanisms left, try again with different one
+ gotProperties(0);
+ } else {
+ setFinishedWithError(op->errorName(), op->errorMessage());
+ m_channel->requestClose();
+ }
} else {
setFinished();
+ m_channel->requestClose();
}
}
diff --git a/sasl-auth-op.h b/sasl-auth-op.h
index 0e88465..38be8dc 100644
--- a/sasl-auth-op.h
+++ b/sasl-auth-op.h
@@ -53,6 +53,8 @@ private:
Tp::ChannelPtr m_channel;
Tp::Client::ChannelInterfaceSASLAuthenticationInterface *m_saslIface;
int m_accountStorageId;
+ QStringList m_mechanisms;
+ QVariantMap m_properties;
};
#endif // SASL_AUTH_OP_H
--
ktp-auth-handler packaging
More information about the pkg-kde-commits
mailing list