mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-05 00:22:31 +02:00
Do some explicit string emptiness checking in Twitter
This commit is contained in:
parent
f8619d4aa5
commit
a52ecfb5b8
@ -265,6 +265,13 @@ TwitterPlugin::connectTimerFired()
|
||||
foreach( QString screenName, peerlist )
|
||||
{
|
||||
QHash< QString, QVariant > peerData = m_cachedPeers[screenName].toHash();
|
||||
|
||||
if ( QDateTime::currentDateTimeUtc().toMSecsSinceEpoch() - peerData["lastseen"].toLongLong() > 1209600000 ) // 2 weeks
|
||||
{
|
||||
qDebug() << "Aging peer " << screenName << " out of cache";
|
||||
m_cachedPeers.remove( screenName );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !peerData.contains( "host" ) || !peerData.contains( "port" ) || !peerData.contains( "pkey" ) )
|
||||
{
|
||||
@ -568,6 +575,7 @@ TwitterPlugin::registerOffer( const QString &screenName, const QHash< QString, Q
|
||||
|
||||
if ( peersChanged )
|
||||
{
|
||||
_peerData["lastseen"] = QString::number( QDateTime::currentDateTimeUtc().toMSecsSinceEpoch() );
|
||||
m_cachedPeers[screenName] = QVariant::fromValue< QHash< QString, QVariant > >( _peerData );
|
||||
TomahawkSettings::instance()->setTwitterCachedPeers( m_cachedPeers );
|
||||
}
|
||||
@ -595,7 +603,8 @@ void
|
||||
TwitterPlugin::makeConnection( const QString &screenName, const QHash< QString, QVariant > &peerData )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if ( !peerData.contains( "host" ) || !peerData.contains( "port" ) || !peerData.contains( "pkey" ) || !peerData.contains( "node" ) )
|
||||
if ( !peerData.contains( "host" ) || !peerData.contains( "port" ) || !peerData.contains( "pkey" ) || !peerData.contains( "node" ) ||
|
||||
peerData["host"].toString().isEmpty() || peerData["port"].toString().isEmpty() || peerData["pkey"].toString().isEmpty() || peerData["node"].toString().isEmpty() )
|
||||
{
|
||||
qDebug() << "TwitterPlugin could not find host and/or port and/or pkey and/or node for peer " << screenName;
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user