[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:08:22 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=a25ffff

The following commit has been merged in the master branch:
commit a25ffffb98d90fd6744ab627477f4ceb0f7053d9
Author: Marcin Ziemiński <zieminn at gmail.com>
Date:   Wed Aug 6 16:58:36 2014 +0200

    Enqueue messages whene there is ongoing private key generation for related account.
    
    Signed-off-by: Marcin Ziemiński <zieminn at gmail.com>
---
 otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp | 21 ++++++++++++++++++---
 otr-proxy/KTpProxy/otr-proxy-channel-adaptee.h   |  2 ++
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp b/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp
index 3bc09a9..2a2807e 100644
--- a/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp
+++ b/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.cpp
@@ -99,6 +99,7 @@ OtrProxyChannel::Adaptee::Adaptee(OtrProxyChannel *pc,
     isConnected(false),
     otrSes(this, context, ps->managerOTR()),
     ps(ps),
+    isGenerating(false),
     aboutToInit(false)
 {
     kDebug() << "Created OTR session for context: "
@@ -166,6 +167,9 @@ void OtrProxyChannel::Adaptee::connectProxy(
             SIGNAL(pendingMessageRemoved(const Tp::ReceivedMessage&)),
             SLOT(onPendingMessageRemoved(const Tp::ReceivedMessage&)));
 
+    connect(ps, SIGNAL(keyGenerationStarted(const QString&)), SLOT(onKeyGenerationStarted(const QString&)));
+    connect(ps, SIGNAL(keyGenerationFinished(const QString&, bool)), SLOT(onKeyGenerationFinished(const QString&, bool)));
+
     for(const Tp::ReceivedMessage &m: chan->messageQueue()) {
         onMessageReceived(m);
     }
@@ -290,6 +294,8 @@ void OtrProxyChannel::Adaptee::initialize(const Tp::Service::ChannelProxyInterfa
     if(otrSes.localFingerprint().isEmpty() && ps->getPolicy() != OTRL_POLICY_NEVER) {
         aboutToInit = true;
         acquirePrivateKey();
+    } else if(isGenerating) {
+        aboutToInit = true;
     } else {
         sendOTRmessage(otrSes.startSession());
     }
@@ -337,6 +343,9 @@ void OtrProxyChannel::Adaptee::onMessageReceived(const Tp::ReceivedMessage &rece
         enqueuedMessages << receivedMessage;
         acquirePrivateKey();
         return;
+    } else if(isGenerating) {
+        enqueuedMessages << receivedMessage;
+        return;
     }
 
     kDebug() << "Received message with id: " << id;
@@ -402,20 +411,26 @@ void OtrProxyChannel::Adaptee::onTrustLevelChanged(TrustLevel trustLevel)
 
 void OtrProxyChannel::Adaptee::acquirePrivateKey()
 {
-    connect(ps, SIGNAL(keyGenerationFinished(const QString&, bool)), SLOT(onKeyGenerationFinished(const QString&, bool)));
     if(!ps->createNewPrivateKey(otrSes.context().accountId, otrSes.context().accountName)) {
         kDebug() << "Probably ongoing key generation for another session";
     }
 }
 
+void OtrProxyChannel::Adaptee::onKeyGenerationStarted(const QString &accountId)
+{
+    if(accountId != otrSes.context().accountId) {
+        return;
+    }
+    isGenerating = true;
+}
+
 void OtrProxyChannel::Adaptee::onKeyGenerationFinished(const QString &accountId, bool error)
 {
     if(accountId != otrSes.context().accountId) {
         return;
     }
     kDebug() << "Finished key generation for: " << accountId;
-    disconnect(ps, SIGNAL(keyGenerationFinished(const QString&, bool)),
-            this, SLOT(onKeyGenerationFinished(const QString&, bool)));
+    isGenerating = false;
 
     if(error) {
         kWarning() << "Could not generate private key for " << accountId;
diff --git a/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.h b/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.h
index 7d1f712..a2949f3 100644
--- a/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.h
+++ b/otr-proxy/KTpProxy/otr-proxy-channel-adaptee.h
@@ -83,6 +83,7 @@ class OtrProxyChannel::Adaptee : public QObject
         void onPendingSendFinished(Tp::PendingOperation *pendingSend);
 
         void onTrustLevelChanged(TrustLevel trustLevel);
+        void onKeyGenerationStarted(const QString &accountId);
         void onKeyGenerationFinished(const QString &accountId, bool error);
 
         void onChannelClosed();
@@ -106,6 +107,7 @@ class OtrProxyChannel::Adaptee : public QObject
 
         QMap<uint, Tp::ReceivedMessage> messages; // queue
         QList<Tp::ReceivedMessage> enqueuedMessages; // when there is now private key generated
+        bool isGenerating; // is a new private key for this account being generated
         bool aboutToInit; // user wanted to start the OTR session but no private key was available
 };
 

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list