[SCM] ktp-auth-handler packaging branch, master, updated. debian/15.12.1-2-282-g080758e

Maximiliano Curia maxy at moszumanska.debian.org
Fri May 27 23:59:44 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-auth-handler.git;a=commitdiff;h=d56ed86

The following commit has been merged in the master branch:
commit d56ed86e85979b43270edd979d988bc34b36fb55
Author: Martin Klapetek <mklapetek at kde.org>
Date:   Fri Mar 20 01:07:58 2015 +0100

    Bring back the AccountStorageInterface support
---
 sasl-auth-op.cpp                     | 28 ++++++++++++++++++++--------
 sasl-auth-op.h                       |  3 ++-
 x-telepathy-sso-google-operation.cpp |  6 +++---
 x-telepathy-sso-google-operation.h   |  4 ++--
 4 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/sasl-auth-op.cpp b/sasl-auth-op.cpp
index dd42daa..e94920d 100644
--- a/sasl-auth-op.cpp
+++ b/sasl-auth-op.cpp
@@ -38,11 +38,13 @@ SaslAuthOp::SaslAuthOp(const Tp::AccountPtr &account,
       m_channel(channel),
       m_saslIface(channel->interface<Tp::Client::ChannelInterfaceSASLAuthenticationInterface>())
 {
-    KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("kaccounts-ktprc"));
-    KConfigGroup ktpKaccountsGroup = config->group(QStringLiteral("ktp-kaccounts"));
-    m_kaccountsId = ktpKaccountsGroup.readEntry(account->objectPath()).toUInt();
+    //Check if the account has any StorageIdentifier, in which case we will
+    //prioritize those mechanism related with KDE Accounts integration
+    QScopedPointer<Tp::Client::AccountInterfaceStorageInterface> accountStorageInterface(
+        new Tp::Client::AccountInterfaceStorageInterface(m_account->busName(), m_account->objectPath()));
 
-    setReady();
+    Tp::PendingVariantMap *pendingMap = accountStorageInterface->requestAllProperties();
+    connect(pendingMap, SIGNAL(finished(Tp::PendingOperation*)), SLOT(onGetAccountStorageFetched(Tp::PendingOperation*)));
 }
 
 SaslAuthOp::~SaslAuthOp()
@@ -67,17 +69,17 @@ void SaslAuthOp::gotProperties(Tp::PendingOperation *op)
     QString error = qdbus_cast<QString>(props.value(QLatin1String("SASLError")));
     QVariantMap errorDetails = qdbus_cast<QVariantMap>(props.value(QLatin1String("SASLErrorDetails")));
 
-    if (mechanisms.contains(QLatin1String("X-FACEBOOK-PLATFORM")) && m_kaccountsId != 0) {
+    if (mechanisms.contains(QLatin1String("X-FACEBOOK-PLATFORM"))) {
         qDebug() << "Starting Facebook OAuth auth";
-        XTelepathySSOFacebookOperation *authop = new XTelepathySSOFacebookOperation(m_account, m_kaccountsId, m_saslIface);
+        XTelepathySSOFacebookOperation *authop = new XTelepathySSOFacebookOperation(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-OAUTH2")) && m_kaccountsId != 0) {
+    } else if (mechanisms.contains(QLatin1String("X-OAUTH2"))) {
         qDebug() << "Starting X-OAuth2 auth";
-        XTelepathySSOGoogleOperation *authop = new XTelepathySSOGoogleOperation(m_account, m_kaccountsId, m_saslIface);
+        XTelepathySSOGoogleOperation *authop = new XTelepathySSOGoogleOperation(m_account, m_accountStorageId, m_saslIface);
         connect(authop,
                 SIGNAL(finished(Tp::PendingOperation*)),
                 SLOT(onAuthOperationFinished(Tp::PendingOperation*)));
@@ -117,3 +119,13 @@ void SaslAuthOp::setReady()
             SIGNAL(finished(Tp::PendingOperation*)),
             SLOT(gotProperties(Tp::PendingOperation*)));
 }
+
+void SaslAuthOp::onGetAccountStorageFetched(Tp::PendingOperation* op)
+{
+    Tp::PendingVariantMap *pendingMap = qobject_cast<Tp::PendingVariantMap*>(op);
+
+    m_accountStorageId = pendingMap->result()["StorageIdentifier"].value<QDBusVariant>().variant().toInt();
+    qDebug() << m_accountStorageId;
+
+    setReady();
+}
diff --git a/sasl-auth-op.h b/sasl-auth-op.h
index 182fe04..0e88465 100644
--- a/sasl-auth-op.h
+++ b/sasl-auth-op.h
@@ -44,6 +44,7 @@ Q_SIGNALS:
 private Q_SLOTS:
     void gotProperties(Tp::PendingOperation *op);
     void onAuthOperationFinished(Tp::PendingOperation *op);
+    void onGetAccountStorageFetched(Tp::PendingOperation *op);
 
 private:
     void setReady();
@@ -51,7 +52,7 @@ private:
     Tp::AccountPtr m_account;
     Tp::ChannelPtr m_channel;
     Tp::Client::ChannelInterfaceSASLAuthenticationInterface *m_saslIface;
-    quint32 m_kaccountsId;
+    int m_accountStorageId;
 };
 
 #endif // SASL_AUTH_OP_H
diff --git a/x-telepathy-sso-google-operation.cpp b/x-telepathy-sso-google-operation.cpp
index 5656c07..5a14ddf 100644
--- a/x-telepathy-sso-google-operation.cpp
+++ b/x-telepathy-sso-google-operation.cpp
@@ -25,10 +25,10 @@
 #include <KSharedConfig>
 #include <KConfigGroup>
 
-XTelepathySSOGoogleOperation::XTelepathySSOGoogleOperation(const Tp::AccountPtr &account, quint32 kaccountsId, Tp::Client::ChannelInterfaceSASLAuthenticationInterface *saslIface)
+XTelepathySSOGoogleOperation::XTelepathySSOGoogleOperation(const Tp::AccountPtr &account, int accountStorageId, Tp::Client::ChannelInterfaceSASLAuthenticationInterface *saslIface)
     : PendingOperation(account)
     , m_saslIface(saslIface)
-    , m_kaccountsId(kaccountsId)
+    , m_accountStorageId(accountStorageId)
 {
     connect(m_saslIface, SIGNAL(SASLStatusChanged(uint,QString,QVariantMap)), SLOT(onSASLStatusChanged(uint,QString,QVariantMap)));
 }
@@ -39,7 +39,7 @@ void XTelepathySSOGoogleOperation::onSASLStatusChanged(uint status, const QStrin
     case Tp::SASLStatusNotStarted:
     {
         qDebug() << "Status Not started";
-        GetCredentialsJob *job = new GetCredentialsJob(m_kaccountsId, this);
+        GetCredentialsJob *job = new GetCredentialsJob(m_accountStorageId, this);
         connect(job, SIGNAL(finished(KJob*)), SLOT(gotCredentials(KJob*)));
         job->start();
         break;
diff --git a/x-telepathy-sso-google-operation.h b/x-telepathy-sso-google-operation.h
index 1fad244..dcfa71b 100644
--- a/x-telepathy-sso-google-operation.h
+++ b/x-telepathy-sso-google-operation.h
@@ -35,7 +35,7 @@ class XTelepathySSOGoogleOperation : public Tp::PendingOperation
 public:
     explicit XTelepathySSOGoogleOperation(
             const Tp::AccountPtr &account,
-            quint32 kaccountsId,
+            int accountStorageId,
             Tp::Client::ChannelInterfaceSASLAuthenticationInterface *saslIface);
 
 private Q_SLOTS:
@@ -46,7 +46,7 @@ private:
     Tp::AccountPtr m_account;
     Tp::Client::ChannelInterfaceSASLAuthenticationInterface *m_saslIface;
 
-    quint32 m_kaccountsId;
+    int m_accountStorageId;
     QByteArray m_challengeData;
 
     friend class SaslAuthOp;

-- 
ktp-auth-handler packaging



More information about the pkg-kde-commits mailing list