1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-04 21:27:58 +02:00

* Support posting to all TwitterInfoPlugins.

This commit is contained in:
Christian Muehlhaeuser
2012-06-12 05:11:47 +02:00
parent 13c22e0c72
commit 9c1f200905

View File

@@ -76,15 +76,15 @@ TwitterInfoPlugin::~TwitterInfoPlugin()
bool bool
TwitterInfoPlugin::refreshTwitterAuth() TwitterInfoPlugin::refreshTwitterAuth()
{ {
tDebug() << Q_FUNC_INFO << " begin" << this; tDebug() << Q_FUNC_INFO << "begin" << this;
if( !m_twitterAuth.isNull() ) if ( !m_twitterAuth.isNull() )
delete m_twitterAuth.data(); delete m_twitterAuth.data();
Q_ASSERT( TomahawkUtils::nam() != 0 ); Q_ASSERT( TomahawkUtils::nam() != 0 );
tDebug() << Q_FUNC_INFO << " with nam " << TomahawkUtils::nam() << this; tDebug() << Q_FUNC_INFO << "with nam" << TomahawkUtils::nam() << this;
m_twitterAuth = QWeakPointer< TomahawkOAuthTwitter >( new TomahawkOAuthTwitter( TomahawkUtils::nam(), this ) ); m_twitterAuth = QWeakPointer< TomahawkOAuthTwitter >( new TomahawkOAuthTwitter( TomahawkUtils::nam(), this ) );
if( m_twitterAuth.isNull() ) if ( m_twitterAuth.isNull() )
return false; return false;
m_twitterAuth.data()->setOAuthToken( m_account->credentials()[ "oauthtoken" ].toString().toLatin1() ); m_twitterAuth.data()->setOAuthToken( m_account->credentials()[ "oauthtoken" ].toString().toLatin1() );
@@ -138,7 +138,8 @@ TwitterInfoPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData )
return; return;
} }
if ( !map[ "accountlist" ].toStringList().contains( m_account->accountId() ) ) const QStringList accountList = map[ "accountlist" ].toStringList();
if ( !accountList.contains( "all" ) && !accountList.contains( m_account->accountId() ) )
{ {
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Our account not in the list, not tweeting out"; tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Our account not in the list, not tweeting out";
return; return;
@@ -168,7 +169,7 @@ TwitterInfoPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData )
QTweetStatusUpdate *statUpdate = new QTweetStatusUpdate( m_twitterAuth.data(), this ); QTweetStatusUpdate *statUpdate = new QTweetStatusUpdate( m_twitterAuth.data(), this );
connect( statUpdate, SIGNAL( postedStatus(const QTweetStatus &) ), SLOT( postLovedStatusUpdateReply(const QTweetStatus &) ) ); connect( statUpdate, SIGNAL( postedStatus(const QTweetStatus &) ), SLOT( postLovedStatusUpdateReply(const QTweetStatus &) ) );
connect( statUpdate, SIGNAL( error(QTweetNetBase::ErrorCode, const QString&) ), SLOT( postLovedStatusUpdateError(QTweetNetBase::ErrorCode, const QString &) ) ); connect( statUpdate, SIGNAL( error(QTweetNetBase::ErrorCode, const QString&) ), SLOT( postLovedStatusUpdateError(QTweetNetBase::ErrorCode, const QString &) ) );
tDebug() << Q_FUNC_INFO << "Posting message: " << msg; tDebug() << Q_FUNC_INFO << "Posting message:" << msg;
statUpdate->post( msg ); statUpdate->post( msg );
} }