1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

make twitter compile

This commit is contained in:
Leo Franchi
2011-12-23 11:13:30 -06:00
parent 2d66daec41
commit aaf147a39a
4 changed files with 22 additions and 9 deletions

View File

@@ -87,7 +87,7 @@ TwitterSipPlugin::isValid() const
} }
SipPlugin::ConnectionState Tomahawk::Accounts::Account::ConnectionState
TwitterSipPlugin::connectionState() const TwitterSipPlugin::connectionState() const
{ {
return m_state; return m_state;
@@ -121,7 +121,7 @@ TwitterSipPlugin::connectPlugin()
m_account->authenticate(); m_account->authenticate();
} }
m_state = Connecting; m_state = Tomahawk::Accounts::Account::Connecting;
emit stateChanged( m_state ); emit stateChanged( m_state );
} }
@@ -174,7 +174,7 @@ TwitterSipPlugin::accountAuthenticated( const QWeakPointer< TomahawkOAuthTwitter
connect( m_directMessageNew.data(), SIGNAL( parsedDirectMessage(const QTweetDMStatus &)), SLOT( directMessagePosted(const QTweetDMStatus &) ) ); connect( m_directMessageNew.data(), SIGNAL( parsedDirectMessage(const QTweetDMStatus &)), SLOT( directMessagePosted(const QTweetDMStatus &) ) );
connect( m_directMessageNew.data(), SIGNAL( error(QTweetNetBase::ErrorCode, const QString &) ), SLOT( directMessagePostError(QTweetNetBase::ErrorCode, const QString &) ) ); connect( m_directMessageNew.data(), SIGNAL( error(QTweetNetBase::ErrorCode, const QString &) ), SLOT( directMessagePostError(QTweetNetBase::ErrorCode, const QString &) ) );
connect( m_directMessageDestroy.data(), SIGNAL( parsedDirectMessage(const QTweetDMStatus &) ), SLOT( directMessageDestroyed(const QTweetDMStatus &) ) ); connect( m_directMessageDestroy.data(), SIGNAL( parsedDirectMessage(const QTweetDMStatus &) ), SLOT( directMessageDestroyed(const QTweetDMStatus &) ) );
m_state = Connected; m_state = Tomahawk::Accounts::Account::Connected;
emit stateChanged( m_state ); emit stateChanged( m_state );
QStringList peerList = m_cachedPeers.keys(); QStringList peerList = m_cachedPeers.keys();
qStableSort( peerList.begin(), peerList.end() ); qStableSort( peerList.begin(), peerList.end() );
@@ -578,7 +578,7 @@ TwitterSipPlugin::registerOffer( const QString &screenName, const QVariantHash &
syncConfig(); syncConfig();
} }
if ( m_state == Connected && _peerData.contains( "host" ) && _peerData.contains( "port" ) && _peerData.contains( "pkey" ) ) if ( m_state == Tomahawk::Accounts::Account::Connected && _peerData.contains( "host" ) && _peerData.contains( "port" ) && _peerData.contains( "pkey" ) )
QMetaObject::invokeMethod( this, "makeConnection", Q_ARG( QString, screenName ), Q_ARG( QVariantHash, _peerData ) ); QMetaObject::invokeMethod( this, "makeConnection", Q_ARG( QString, screenName ), Q_ARG( QVariantHash, _peerData ) );
} }
@@ -698,7 +698,7 @@ void
TwitterSipPlugin::configurationChanged() TwitterSipPlugin::configurationChanged()
{ {
tDebug() << Q_FUNC_INFO; tDebug() << Q_FUNC_INFO;
if ( m_state != Disconnected ) if ( m_state != Tomahawk::Accounts::Account::Disconnected )
m_account->deauthenticate(); m_account->deauthenticate();
connectPlugin(); connectPlugin();
} }

View File

@@ -50,6 +50,9 @@ public:
virtual bool isValid() const; virtual bool isValid() const;
virtual Tomahawk::Accounts::Account::ConnectionState connectionState() const; virtual Tomahawk::Accounts::Account::ConnectionState connectionState() const;
signals:
void stateChanged( Tomahawk::Accounts::Account::ConnectionState );
public slots: public slots:
virtual void connectPlugin(); virtual void connectPlugin();
void disconnectPlugin(); void disconnectPlugin();

View File

@@ -79,12 +79,20 @@ TwitterAccount::configDialogAuthedSignalSlot( bool authed )
} }
Account::ConnectionState
TwitterAccount::connectionState() const
{
return m_twitterSipPlugin.data()->connectionState();
}
SipPlugin* SipPlugin*
TwitterAccount::sipPlugin() TwitterAccount::sipPlugin()
{ {
if ( m_twitterSipPlugin.isNull() ) if ( m_twitterSipPlugin.isNull() )
{ {
m_twitterSipPlugin = QWeakPointer< TwitterSipPlugin >( new TwitterSipPlugin( this ) ); m_twitterSipPlugin = QWeakPointer< TwitterSipPlugin >( new TwitterSipPlugin( this ) );
connect( m_twitterSipPlugin.data(), SIGNAL( stateChanged( Tomahawk::Accounts::Account::ConnectionState ) ), this, SIGNAL( connectionStateChanged( Tomahawk::Accounts::Account::ConnectionState ) ) );
return m_twitterSipPlugin.data(); return m_twitterSipPlugin.data();
} }
return m_twitterSipPlugin.data(); return m_twitterSipPlugin.data();
@@ -96,7 +104,7 @@ TwitterAccount::authenticate()
{ {
tDebug() << Q_FUNC_INFO << "credentials: " << credentials().keys(); tDebug() << Q_FUNC_INFO << "credentials: " << credentials().keys();
if ( credentials[ "oauthtoken" ].toString().isEmpty() || credentials()[ "oauthtokensecret" ].toString().isEmpty() ) if ( credentials()[ "oauthtoken" ].toString().isEmpty() || credentials()[ "oauthtokensecret" ].toString().isEmpty() )
{ {
qDebug() << "TwitterSipPlugin has empty Twitter credentials; not connecting"; qDebug() << "TwitterSipPlugin has empty Twitter credentials; not connecting";
return; return;
@@ -137,8 +145,8 @@ TwitterAccount::refreshTwitterAuth()
if( m_twitterAuth.isNull() ) if( m_twitterAuth.isNull() )
return false; return false;
m_twitterAuth.data()->setOAuthToken( m_credentials[ "oauthtoken" ].toString().toLatin1() ); m_twitterAuth.data()->setOAuthToken( credentials()[ "oauthtoken" ].toString().toLatin1() );
m_twitterAuth.data()->setOAuthTokenSecret( m_credentials[ "oauthtokensecret" ].toString().toLatin1() ); m_twitterAuth.data()->setOAuthTokenSecret( credentials()[ "oauthtokensecret" ].toString().toLatin1() );
return true; return true;
} }
@@ -172,4 +180,4 @@ TwitterAccount::icon() const {
} }
Q_EXPORT_PLUGIN2( Tomahawk::Accounts::AccountFactory, Tomahawk::Accounts::TwitterAccountFactory ) Q_EXPORT_PLUGIN2( Tomahawk::Accounts::AccountFactory, Tomahawk::Accounts::TwitterAccountFactory )

View File

@@ -64,6 +64,8 @@ public:
void deauthenticate(); void deauthenticate();
bool isAuthenticated() const { return m_isAuthenticated; } bool isAuthenticated() const { return m_isAuthenticated; }
ConnectionState connectionState() const;
Tomahawk::InfoSystem::InfoPlugin* infoPlugin() { return 0; } Tomahawk::InfoSystem::InfoPlugin* infoPlugin() { return 0; }
SipPlugin* sipPlugin(); SipPlugin* sipPlugin();