From 79a55d8ec0fb364659a6a0db819c7da516b604d2 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Wed, 18 Sep 2013 18:35:50 +0200 Subject: [PATCH] Fixed landevice link not setting the payload to the proper package Wrong variable name --- kded/backends/lan/landevicelink.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/kded/backends/lan/landevicelink.cpp b/kded/backends/lan/landevicelink.cpp index ac764d806..1b159c24b 100644 --- a/kded/backends/lan/landevicelink.cpp +++ b/kded/backends/lan/landevicelink.cpp @@ -89,29 +89,31 @@ void LanDeviceLink::dataReceived() if (package.length() < 3) continue; - NetworkPackage np(QString::null); - NetworkPackage::unserialize(package, &np); - if (np.type() == PACKAGE_TYPE_ENCRYPTED) { - - if (mPrivateKey.isNull()) { - //TODO: Emit the problem? - return; - } + NetworkPackage unserialized(QString::null); + NetworkPackage::unserialize(package, &unserialized); + if (unserialized.isEncrypted()) { + //mPrivateKey should always be set when device link is added to device, no null-checking done here NetworkPackage decrypted(QString::null); - np.decrypt(mPrivateKey, &decrypted); + unserialized.decrypt(mPrivateKey, &decrypted); - if (np.hasPayloadTransferInfo()) { - DownloadJob* job = new DownloadJob(mSocket->peerAddress(), np.payloadTransferInfo()); + if (decrypted.hasPayloadTransferInfo()) { + qDebug() << "HasPayloadTransferInfo"; + DownloadJob* job = new DownloadJob(mSocket->peerAddress(), decrypted.payloadTransferInfo()); job->start(); - np.setPayload(job->getPayload()); + decrypted.setPayload(job->getPayload()); } Q_EMIT receivedPackage(decrypted); } else { - Q_EMIT receivedPackage(np); + if (unserialized.hasPayloadTransferInfo()) { + //Lets ignore unencrypted payloads + } + + + Q_EMIT receivedPackage(unserialized); }