mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-09 15:47:38 +02:00
Some code cleanup, and allow for finding yourself in tweets if the node
is different (interim step until, eventually, hopefully allowing multiple accesses)
This commit is contained in:
@@ -150,13 +150,18 @@ TwitterPlugin::checkTimerFired()
|
|||||||
|
|
||||||
if ( m_cachedFriendsSinceId == 0 )
|
if ( m_cachedFriendsSinceId == 0 )
|
||||||
m_cachedFriendsSinceId = TomahawkSettings::instance()->twitterCachedFriendsSinceId();
|
m_cachedFriendsSinceId = TomahawkSettings::instance()->twitterCachedFriendsSinceId();
|
||||||
qDebug() << "TwitterPlugin using friend timeline id of " << m_cachedFriendsSinceId;
|
|
||||||
|
qDebug() << "TwitterPlugin looking at friends timeline since id " << m_cachedFriendsSinceId;
|
||||||
|
|
||||||
if ( !m_friendsTimeline.isNull() )
|
if ( !m_friendsTimeline.isNull() )
|
||||||
m_friendsTimeline.data()->fetch( m_cachedFriendsSinceId, 0, 800 );
|
m_friendsTimeline.data()->fetch( m_cachedFriendsSinceId, 0, 800 );
|
||||||
|
|
||||||
|
|
||||||
if ( m_cachedMentionsSinceId == 0 )
|
if ( m_cachedMentionsSinceId == 0 )
|
||||||
m_cachedMentionsSinceId = TomahawkSettings::instance()->twitterCachedMentionsSinceId();
|
m_cachedMentionsSinceId = TomahawkSettings::instance()->twitterCachedMentionsSinceId();
|
||||||
qDebug() << "TwitterPlugin using mentions timeline id of " << m_cachedMentionsSinceId;
|
|
||||||
|
qDebug() << "TwitterPlugin looking at mentions timeline since id " << m_cachedMentionsSinceId;
|
||||||
|
|
||||||
if ( !m_mentions.isNull() )
|
if ( !m_mentions.isNull() )
|
||||||
m_mentions.data()->fetch( m_cachedMentionsSinceId, 0, 800 );
|
m_mentions.data()->fetch( m_cachedMentionsSinceId, 0, 800 );
|
||||||
}
|
}
|
||||||
@@ -208,8 +213,7 @@ TwitterPlugin::friendsTimelineStatuses( const QList< QTweetStatus > &statuses )
|
|||||||
{
|
{
|
||||||
if ( status.id() > m_cachedFriendsSinceId )
|
if ( status.id() > m_cachedFriendsSinceId )
|
||||||
m_cachedFriendsSinceId = status.id();
|
m_cachedFriendsSinceId = status.id();
|
||||||
if ( status.user().screenName() == myScreenName )
|
|
||||||
continue;
|
|
||||||
if ( regex.exactMatch( status.text() ) )
|
if ( regex.exactMatch( status.text() ) )
|
||||||
{
|
{
|
||||||
qDebug() << "TwitterPlugin found an exact tweet from friend " << status.user().screenName();
|
qDebug() << "TwitterPlugin found an exact tweet from friend " << status.user().screenName();
|
||||||
@@ -237,6 +241,9 @@ TwitterPlugin::friendsTimelineStatuses( const QList< QTweetStatus > &statuses )
|
|||||||
else
|
else
|
||||||
qDebug() << "TwitterPlugin parsed node " << node << " out of the tweet";
|
qDebug() << "TwitterPlugin parsed node " << node << " out of the tweet";
|
||||||
|
|
||||||
|
if ( status.user().screenName() == myScreenName && node == Database::instance()->dbid() )
|
||||||
|
continue;
|
||||||
|
|
||||||
QHash< QString, QVariant > peerData;
|
QHash< QString, QVariant > peerData;
|
||||||
if( m_cachedPeers.contains( status.user().screenName() ) )
|
if( m_cachedPeers.contains( status.user().screenName() ) )
|
||||||
{
|
{
|
||||||
@@ -278,8 +285,7 @@ TwitterPlugin::mentionsStatuses( const QList< QTweetStatus > &statuses )
|
|||||||
{
|
{
|
||||||
if ( status.id() > m_cachedMentionsSinceId )
|
if ( status.id() > m_cachedMentionsSinceId )
|
||||||
m_cachedMentionsSinceId = status.id();
|
m_cachedMentionsSinceId = status.id();
|
||||||
if ( status.user().screenName() == myScreenName )
|
|
||||||
continue;
|
|
||||||
if ( regex.exactMatch( status.text() ) )
|
if ( regex.exactMatch( status.text() ) )
|
||||||
{
|
{
|
||||||
qDebug() << "TwitterPlugin found an exact matching mention from user " << status.user().screenName();
|
qDebug() << "TwitterPlugin found an exact matching mention from user " << status.user().screenName();
|
||||||
@@ -307,6 +313,9 @@ TwitterPlugin::mentionsStatuses( const QList< QTweetStatus > &statuses )
|
|||||||
else
|
else
|
||||||
qDebug() << "TwitterPlugin parsed node " << node << " out of the tweet";
|
qDebug() << "TwitterPlugin parsed node " << node << " out of the tweet";
|
||||||
|
|
||||||
|
if ( status.user().screenName() == myScreenName && node == Database::instance()->dbid() )
|
||||||
|
continue;
|
||||||
|
|
||||||
QHash< QString, QVariant > peerData;
|
QHash< QString, QVariant > peerData;
|
||||||
if( m_cachedPeers.contains( status.user().screenName() ) )
|
if( m_cachedPeers.contains( status.user().screenName() ) )
|
||||||
{
|
{
|
||||||
@@ -339,7 +348,9 @@ TwitterPlugin::pollDirectMessages()
|
|||||||
|
|
||||||
if ( m_cachedDirectMessagesSinceId == 0 )
|
if ( m_cachedDirectMessagesSinceId == 0 )
|
||||||
m_cachedDirectMessagesSinceId = TomahawkSettings::instance()->twitterCachedDirectMessagesSinceId();
|
m_cachedDirectMessagesSinceId = TomahawkSettings::instance()->twitterCachedDirectMessagesSinceId();
|
||||||
qDebug() << "TwitterPlugin using direct messages id of " << m_cachedDirectMessagesSinceId;
|
|
||||||
|
qDebug() << "TwitterPlugin looking for direct messages since id " << m_cachedDirectMessagesSinceId;
|
||||||
|
|
||||||
if ( !m_directMessages.isNull() )
|
if ( !m_directMessages.isNull() )
|
||||||
m_directMessages.data()->fetch( m_cachedDirectMessagesSinceId, 0, 800 );
|
m_directMessages.data()->fetch( m_cachedDirectMessagesSinceId, 0, 800 );
|
||||||
}
|
}
|
||||||
@@ -405,13 +416,15 @@ void
|
|||||||
TwitterPlugin::registerOffer( const QString &screenName, const QHash< QString, QVariant > &peerData )
|
TwitterPlugin::registerOffer( const QString &screenName, const QHash< QString, QVariant > &peerData )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
QString friendlyName = QString( '@' + screenName );
|
|
||||||
bool peersChanged = false;
|
|
||||||
QHash< QString, QVariant > _peerData( peerData );
|
|
||||||
|
|
||||||
|
bool peersChanged = false;
|
||||||
bool needToSend = false;
|
bool needToSend = false;
|
||||||
bool needToAddToCache = false;
|
bool needToAddToCache = false;
|
||||||
|
|
||||||
|
QString friendlyName = QString( '@' + screenName );
|
||||||
|
|
||||||
|
QHash< QString, QVariant > _peerData( peerData );
|
||||||
|
|
||||||
if ( _peerData.contains( "dirty" ) )
|
if ( _peerData.contains( "dirty" ) )
|
||||||
{
|
{
|
||||||
peersChanged = true;
|
peersChanged = true;
|
||||||
|
Reference in New Issue
Block a user