1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 21:57:41 +02:00

Keep track of offered dbid to a peer and check offer key to make sure it matches

This commit is contained in:
Jeff Mitchell
2011-04-05 20:50:53 -04:00
parent a52ecfb5b8
commit 73d88dcf7b

View File

@@ -536,11 +536,14 @@ TwitterPlugin::registerOffer( const QString &screenName, const QHash< QString, Q
_peerData.remove( "resend" ); _peerData.remove( "resend" );
} }
if ( !_peerData.contains( "okey" ) ) if ( !_peerData.contains( "okey" ) ||
!_peerData.contains( "onod" ) ||
( _peerData.contains( "onod" ) && _peerData["onod"] != Database::instance()->dbid() ) )
{ {
QString okey = QUuid::createUuid().toString().split( '-' ).last(); QString okey = QUuid::createUuid().toString().split( '-' ).last();
okey.chop( 1 ); okey.chop( 1 );
_peerData["okey"] = QVariant::fromValue< QString >( okey ); _peerData["okey"] = QVariant::fromValue< QString >( okey );
_peerData["onod"] = QVariant::fromValue< QString >( Database::instance()->dbid() );
peersChanged = true; peersChanged = true;
needToAddToCache = true; needToAddToCache = true;
needToSend = true; needToSend = true;