[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:58:22 UTC 2016


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

The following commit has been merged in the master branch:
commit fb3a83e5d45f2bf2629866fe69f3cb094fd3906a
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date:   Wed Oct 26 22:34:14 2011 +0200

    Update common repository and use WalletInterface instead of KWallet directly
    
    Reviewed-by: David Edmundson <kde at davidedmundson.co.uk>
    BUG: 283679
---
 CMakeLists.txt   |  1 +
 common           |  2 +-
 sasl-auth-op.cpp | 65 +++++++++++++++++++-------------------------------------
 sasl-auth-op.h   |  6 +-----
 sasl-handler.cpp |  4 +---
 sasl-handler.h   |  3 ---
 6 files changed, 26 insertions(+), 55 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30afa63..fcebaa1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,6 +33,7 @@ endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules)
 
 set (telepathy_kde_common_internals_SRCS
      common/telepathy-handler-application.cpp
+     common/wallet-interface.cpp
 )
 
 set(telepathy_kde_auth_handler_SRCS
diff --git a/common b/common
index 702f544..c0b6bc9 160000
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 702f544476ecc2b87f69eb0b4e4349259f791001
+Subproject commit c0b6bc91daab6c4992a38191db471513546af25e
diff --git a/sasl-auth-op.cpp b/sasl-auth-op.cpp
index 0db9810..ebefb30 100644
--- a/sasl-auth-op.cpp
+++ b/sasl-auth-op.cpp
@@ -26,17 +26,16 @@
 #include <KLocalizedString>
 
 #include "password-prompt.h"
+#include "common/wallet-interface.h"
 
 SaslAuthOp::SaslAuthOp(const Tp::AccountPtr &account,
         const Tp::ConnectionPtr &connection,
-        const Tp::ChannelPtr &channel,
-        KWallet::Wallet *wallet)
+        const Tp::ChannelPtr &channel)
     : Tp::PendingOperation(channel),
       m_account(account),
       m_connection(connection),
       m_channel(channel),
       m_saslIface(channel->interface<Tp::Client::ChannelInterfaceSASLAuthenticationInterface>()),
-      m_wallet(wallet),
       m_canTryAgain(false)
 {
     connect(m_saslIface->requestAllProperties(),
@@ -115,50 +114,30 @@ void SaslAuthOp::onSASLStatusChanged(uint status, const QString &reason,
 
 void SaslAuthOp::promptUser(bool isFirstRun)
 {
+    QString password;
+
     kDebug() << "Trying to load from wallet";
-    if (m_wallet->hasFolder("telepathy-kde") && isFirstRun) {
-        m_wallet->setFolder("telepathy-kde");
-
-        QString password;
-        kDebug() << "Wallet contains telepathy folder";
-
-        if (m_wallet->hasEntry(m_account->uniqueIdentifier())) {
-            kDebug() << "Wallet contains saved password";
-
-            int ret = m_wallet->readPassword(m_account->uniqueIdentifier(), password);
-            if (ret == 0) {
-                kDebug() << "Using saved password";
-                m_saslIface->StartMechanismWithData(QLatin1String("X-TELEPATHY-PASSWORD"),
-                        password.toUtf8());
-                return;
-            } else {
-                kDebug() << "Error reading saved password";
-            }
+    KTelepathy::WalletInterface wallet(0);
+    if (wallet.hasPassword(m_account) && isFirstRun) {
+        password = wallet.password(m_account);
+    } else {
+        PasswordPrompt dialog(m_account);
+        if (dialog.exec() == QDialog::Rejected) {
+            kDebug() << "Authentication cancelled";
+            m_saslIface->AbortSASL(Tp::SASLAbortReasonUserAbort, "User cancelled auth");
+            m_channel->requestClose();
+            setFinished();
+            return;
         }
-    }
-
-    PasswordPrompt dialog(m_account);
-    if (dialog.exec() == QDialog::Rejected) {
-        kDebug() << "Authentication cancelled";
-        m_saslIface->AbortSASL(Tp::SASLAbortReasonUserAbort, "User cancelled auth");
-        m_channel->requestClose();
-        setFinished();
-        return;
-    }
-
-    kDebug() << "Starting authentication...";
-    m_saslIface->StartMechanismWithData(QLatin1String("X-TELEPATHY-PASSWORD"),
-            dialog.password().toUtf8());
-
-    // save password in kwallet...
-    if (dialog.savePassword()) {
-        kDebug() << "Saving password in wallet";
-        if (!m_wallet->hasFolder("telepathy-kde")) {
-            m_wallet->createFolder("telepathy-kde");
+        password = dialog.password();
+        // save password in kwallet if necessary...
+        if (dialog.savePassword()) {
+            kDebug() << "Saving password in wallet";
+            wallet.setPassword(m_account, dialog.password());
         }
-        m_wallet->setFolder("telepathy-kde");
-        m_wallet->writePassword(m_account->uniqueIdentifier(), dialog.password());
     }
+
+    m_saslIface->StartMechanismWithData(QLatin1String("X-TELEPATHY-PASSWORD"), password.toUtf8());
 }
 
 #include "sasl-auth-op.moc"
diff --git a/sasl-auth-op.h b/sasl-auth-op.h
index 68399f4..c85178d 100644
--- a/sasl-auth-op.h
+++ b/sasl-auth-op.h
@@ -27,8 +27,6 @@
 #include <TelepathyQt4/PendingOperation>
 #include <TelepathyQt4/Types>
 
-#include <KWallet/Wallet>
-
 class SaslAuthOp : public Tp::PendingOperation
 {
     Q_OBJECT
@@ -36,8 +34,7 @@ class SaslAuthOp : public Tp::PendingOperation
 public:
     SaslAuthOp(const Tp::AccountPtr &account,
             const Tp::ConnectionPtr &connection,
-            const Tp::ChannelPtr &channel,
-            KWallet::Wallet *wallet);
+            const Tp::ChannelPtr &channel);
     ~SaslAuthOp();
 
 Q_SIGNALS:
@@ -54,7 +51,6 @@ private:
     Tp::ConnectionPtr m_connection;
     Tp::ChannelPtr m_channel;
     Tp::Client::ChannelInterfaceSASLAuthenticationInterface *m_saslIface;
-    KWallet::Wallet *m_wallet;
     bool m_canTryAgain;
 };
 
diff --git a/sasl-handler.cpp b/sasl-handler.cpp
index 4026b78..45a3b10 100644
--- a/sasl-handler.cpp
+++ b/sasl-handler.cpp
@@ -34,8 +34,6 @@
 SaslHandler::SaslHandler(const Tp::ChannelClassSpecList &channelFilter)
     : Tp::AbstractClientHandler(channelFilter)
 {
-    m_wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(),
-            0, KWallet::Wallet::Asynchronous);
 }
 
 SaslHandler::~SaslHandler()
@@ -63,7 +61,7 @@ void SaslHandler::handleChannels(const Tp::MethodInvocationContextPtr<> &context
 
     KTelepathy::TelepathyHandlerApplication::newJob();
     SaslAuthOp *auth = new SaslAuthOp(
-            account, connection, channels.first(), m_wallet);
+            account, connection, channels.first());
     connect(auth,
             SIGNAL(ready(Tp::PendingOperation*)),
             SLOT(onAuthReady(Tp::PendingOperation*)));
diff --git a/sasl-handler.h b/sasl-handler.h
index 7ef499f..3f4bb25 100644
--- a/sasl-handler.h
+++ b/sasl-handler.h
@@ -25,8 +25,6 @@
 
 #include <TelepathyQt4/AbstractClientHandler>
 
-#include <KWallet/Wallet>
-
 namespace Tp
 {
     class PendingOperation;
@@ -57,7 +55,6 @@ private Q_SLOTS:
     void onAuthFinished(Tp::PendingOperation *op);
 
 private:
-    KWallet::Wallet *m_wallet;
     QHash<Tp::PendingOperation *, Tp::MethodInvocationContextPtr<> > mAuthContexts;
 };
 

-- 
ktp-auth-handler packaging



More information about the pkg-kde-commits mailing list