1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-05 00:22:31 +02:00

Update twitter connect caching

This commit is contained in:
Jeff Mitchell 2011-04-05 20:58:47 -04:00
parent 73d88dcf7b
commit 1ef9b7c241

View File

@ -266,7 +266,13 @@ TwitterPlugin::connectTimerFired()
{
QHash< QString, QVariant > peerData = m_cachedPeers[screenName].toHash();
if ( QDateTime::currentDateTimeUtc().toMSecsSinceEpoch() - peerData["lastseen"].toLongLong() > 1209600000 ) // 2 weeks
if ( Servent::instance()->connectedToSession( peerData["node"] ) )
{
peerData["lastseen"] = QDateTime::currentMSecsSinceEpoch();
m_cachedPeers[screenName] = peerData;
}
if ( QDateTime::currentMSecsSinceEpoch() - peerData["lastseen"].toLongLong() > 1209600000 ) // 2 weeks
{
qDebug() << "Aging peer " << screenName << " out of cache";
m_cachedPeers.remove( screenName );
@ -578,7 +584,7 @@ TwitterPlugin::registerOffer( const QString &screenName, const QHash< QString, Q
if ( peersChanged )
{
_peerData["lastseen"] = QString::number( QDateTime::currentDateTimeUtc().toMSecsSinceEpoch() );
_peerData["lastseen"] = QString::number( QDateTime::currentMSecsSinceEpoch() );
m_cachedPeers[screenName] = QVariant::fromValue< QHash< QString, QVariant > >( _peerData );
TomahawkSettings::instance()->setTwitterCachedPeers( m_cachedPeers );
}