diff --git a/core/backends/lan/lanpairinghandler.cpp b/core/backends/lan/lanpairinghandler.cpp index 97bf0b981..fbe5ebda4 100644 --- a/core/backends/lan/lanpairinghandler.cpp +++ b/core/backends/lan/lanpairinghandler.cpp @@ -36,21 +36,10 @@ LanPairingHandler::LanPairingHandler(DeviceLink* deviceLink) connect(&m_pairingTimeout, &QTimer::timeout, this, &LanPairingHandler::pairingTimeout); } -void LanPairingHandler::createPairPackage(NetworkPackage& np) -{ - np.set("link", deviceLink()->name()); - np.set("pair", true); -} - void LanPairingHandler::packageReceived(const NetworkPackage& np) { qDebug() << "Pairing package received!" << np.serialize(); - if (np.get("link", deviceLink()->name()).compare(deviceLink()->name()) != 0) { - // If this package is not received by my type of link - return; - } - m_pairingTimeout.stop(); bool wantsPair = np.get("pair"); @@ -103,7 +92,7 @@ bool LanPairingHandler::requestPairing() } NetworkPackage np(PACKAGE_TYPE_PAIR); - createPairPackage(np); + np.set("pair", true); bool success; success = deviceLink()->sendPackage(np); if (success) { @@ -118,7 +107,7 @@ bool LanPairingHandler::acceptPairing() qDebug() << "User accepts pairing"; m_pairingTimeout.stop(); // Just in case it is started NetworkPackage np(PACKAGE_TYPE_PAIR); - createPairPackage(np); + np.set("pair", true); bool success = deviceLink()->sendPackage(np); if (success) { setInternalPairStatus(Paired); @@ -131,7 +120,6 @@ void LanPairingHandler::rejectPairing() qDebug() << "User rejects pairing"; NetworkPackage np(PACKAGE_TYPE_PAIR); np.set("pair", false); - np.set("link", deviceLink()->name()); deviceLink()->sendPackage(np); setInternalPairStatus(NotPaired); } @@ -139,7 +127,6 @@ void LanPairingHandler::rejectPairing() void LanPairingHandler::unpair() { NetworkPackage np(PACKAGE_TYPE_PAIR); np.set("pair", false); - np.set("link", deviceLink()->name()); deviceLink()->sendPackage(np); setInternalPairStatus(NotPaired); } @@ -148,7 +135,6 @@ void LanPairingHandler::pairingTimeout() { NetworkPackage np(PACKAGE_TYPE_PAIR); np.set("pair", false); - np.set("name", deviceLink()->name()); deviceLink()->sendPackage(np); setInternalPairStatus(NotPaired); //Will emit the change as well Q_EMIT pairingError(i18n("Timed out")); diff --git a/core/backends/lan/lanpairinghandler.h b/core/backends/lan/lanpairinghandler.h index a6bde2570..fd9d692ec 100644 --- a/core/backends/lan/lanpairinghandler.h +++ b/core/backends/lan/lanpairinghandler.h @@ -41,7 +41,6 @@ public: LanPairingHandler(DeviceLink* deviceLink); virtual ~LanPairingHandler() { } - virtual void createPairPackage(NetworkPackage& np) Q_DECL_OVERRIDE; virtual void packageReceived(const NetworkPackage& np) Q_DECL_OVERRIDE; virtual bool requestPairing() Q_DECL_OVERRIDE; virtual bool acceptPairing() Q_DECL_OVERRIDE; diff --git a/core/backends/pairinghandler.h b/core/backends/pairinghandler.h index 712b7ffd5..95c91f6a1 100644 --- a/core/backends/pairinghandler.h +++ b/core/backends/pairinghandler.h @@ -48,7 +48,6 @@ public: DeviceLink* deviceLink() const; void setDeviceLink(DeviceLink* dl); - virtual void createPairPackage(NetworkPackage& np) = 0; virtual void packageReceived(const NetworkPackage& np) = 0; virtual void unpair() = 0;