[SCM] ktp-filetransfer-handler packaging branch, master, updated. debian/15.12.1-2-226-g825cd93

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:12:23 UTC 2016


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

The following commit has been merged in the master branch:
commit 675035c6c994c600611b7926cf3f778ea70d93aa
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date:   Tue Jul 10 23:01:48 2012 +0200

    Do not assert that channels.size() == 1
    
    If 2 channels are received almost at the same time, they might be
    received by the handler in just one call.
---
 src/filetransfer-handler.cpp | 75 ++++++++++++++++++++++----------------------
 1 file changed, 37 insertions(+), 38 deletions(-)

diff --git a/src/filetransfer-handler.cpp b/src/filetransfer-handler.cpp
index 7ef0918..c79a22a 100644
--- a/src/filetransfer-handler.cpp
+++ b/src/filetransfer-handler.cpp
@@ -63,56 +63,55 @@ void FileTransferHandler::handleChannels(const Tp::MethodInvocationContextPtr<>
     Q_UNUSED(userActionTime);
     Q_UNUSED(handlerInfo);
 
-    Q_ASSERT(channels.size() == 1);
-
-    if (KTp::TelepathyHandlerApplication::newJob() >= 0) {
-        context->setFinished();
-    } else {
-        context->setFinishedWithError(QLatin1String("org.freedesktop.Telepathy.KTp.FileTransferHandler.Exiting"),
-                                      i18n("File transfer handler is exiting. Cannot start job"));
-        return;
-    }
+    Q_FOREACH(const Tp::ChannelPtr &channel, channels) {
+        if (KTp::TelepathyHandlerApplication::newJob() < 0) {
+            context->setFinishedWithError(QLatin1String("org.freedesktop.Telepathy.KTp.FileTransferHandler.Exiting"),
+                                          i18n("File transfer handler is exiting. Cannot start job"));
+        }
+
+        KJob* job = NULL;
 
-    KJob* job = NULL;
+        if (!channel->isRequested()) {
+            Tp::IncomingFileTransferChannelPtr incomingFileTransferChannel = Tp::IncomingFileTransferChannelPtr::dynamicCast(channel);
+            Q_ASSERT(incomingFileTransferChannel);
 
-    if (!channels.first()->isRequested()) {
-        Tp::IncomingFileTransferChannelPtr incomingFileTransferChannel = Tp::IncomingFileTransferChannelPtr::dynamicCast(channels.first());
-        Q_ASSERT(incomingFileTransferChannel);
+            kDebug() << incomingFileTransferChannel->immutableProperties();
 
-        kDebug() << incomingFileTransferChannel->immutableProperties();
+            KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
+            KConfigGroup filetransferConfig = config->group(QLatin1String("File Transfers"));
 
-        KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
-        KConfigGroup filetransferConfig = config->group(QLatin1String("File Transfers"));
+            QString downloadDirectory = filetransferConfig.readPathEntry(QLatin1String("downloadDirectory"),
+                    QDir::homePath() + QLatin1String("/") + i18nc("This is the download directory in user's home", "Downloads"));
+            kDebug() << "Download directory:" << downloadDirectory;
+            // TODO Check if directory exists
 
-        QString downloadDirectory = filetransferConfig.readPathEntry(QLatin1String("downloadDirectory"),
-                QDir::homePath() + QLatin1String("/") + i18nc("This is the download directory in user's home", "Downloads"));
-        kDebug() << "Download directory:" << downloadDirectory;
-        // TODO Check if directory exists
+            job = new HandleIncomingFileTransferChannelJob(incomingFileTransferChannel, downloadDirectory, this);
+        } else {
+            Tp::OutgoingFileTransferChannelPtr outgoingFileTransferChannel = Tp::OutgoingFileTransferChannelPtr::dynamicCast(channel);
+            Q_ASSERT(outgoingFileTransferChannel);
 
-        job = new HandleIncomingFileTransferChannelJob(incomingFileTransferChannel, downloadDirectory, this);
-    } else {
-        Tp::OutgoingFileTransferChannelPtr outgoingFileTransferChannel = Tp::OutgoingFileTransferChannelPtr::dynamicCast(channels.first());
-        Q_ASSERT(outgoingFileTransferChannel);
+            kDebug() << outgoingFileTransferChannel->immutableProperties();
 
-        kDebug() << outgoingFileTransferChannel->immutableProperties();
+            if (outgoingFileTransferChannel->uri().isEmpty()) {
+                context->setFinishedWithError(TP_QT_ERROR_INCONSISTENT,
+                                            i18n("Cannot handle outgoing file transfer without URI"));
+            }
 
-        if (outgoingFileTransferChannel->uri().isEmpty()) {
-            context->setFinishedWithError(TP_QT_ERROR_INCONSISTENT,
-                                          i18n("Cannot handle outgoing file transfer without URI"));
+            job = new HandleOutgoingFileTransferChannelJob(outgoingFileTransferChannel, this);
         }
 
-        job = new HandleOutgoingFileTransferChannelJob(outgoingFileTransferChannel, this);
+        if (job) {
+            connect(job,
+                    SIGNAL(infoMessage(KJob*, QString, QString)),
+                    SLOT(onInfoMessage(KJob*, QString, QString)));
+            connect(job,
+                    SIGNAL(result(KJob*)),
+                    SLOT(handleResult(KJob*)));
+            job->start();
+        }
     }
 
-    if (job) {
-        connect(job,
-                SIGNAL(infoMessage(KJob*, QString, QString)),
-                SLOT(onInfoMessage(KJob*, QString, QString)));
-        connect(job,
-                SIGNAL(result(KJob*)),
-                SLOT(handleResult(KJob*)));
-        job->start();
-    }
+    context->setFinished();
 }
 
 void FileTransferHandler::onInfoMessage(KJob* job, const QString &plain, const QString &rich)

-- 
ktp-filetransfer-handler packaging



More information about the pkg-kde-commits mailing list