mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-23 09:19:41 +01:00
Get rid of double-additions of info plugins. Still not sure why it doesn't seem to delete itself.
This commit is contained in:
parent
25fba84b32
commit
4eaff7a45f
@ -50,7 +50,7 @@ TwitterAccount::TwitterAccount( const QString &accountId )
|
||||
, m_isAuthenticated( false )
|
||||
{
|
||||
setAccountServiceName( "Twitter" );
|
||||
setTypes( AccountTypes( InfoType | SipType ) );
|
||||
setTypes( AccountTypes( StatusPushType | SipType ) );
|
||||
|
||||
qDebug() << "Got cached peers:" << configuration() << configuration()[ "cachedpeers" ];
|
||||
|
||||
@ -120,12 +120,13 @@ TwitterAccount::authenticate()
|
||||
|
||||
if ( credentials()[ "oauthtoken" ].toString().isEmpty() || credentials()[ "oauthtokensecret" ].toString().isEmpty() )
|
||||
{
|
||||
qDebug() << "TwitterSipPlugin has empty Twitter credentials; not connecting";
|
||||
tDebug() << Q_FUNC_INFO << "TwitterSipPlugin has empty Twitter credentials; not connecting";
|
||||
return;
|
||||
}
|
||||
|
||||
if ( refreshTwitterAuth() )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << "Verifying credentials";
|
||||
QTweetAccountVerifyCredentials *credVerifier = new QTweetAccountVerifyCredentials( m_twitterAuth.data(), this );
|
||||
connect( credVerifier, SIGNAL( parsedUser( const QTweetUser & ) ), SLOT( connectAuthVerifyReply( const QTweetUser & ) ) );
|
||||
credVerifier->verify();
|
||||
@ -136,6 +137,8 @@ TwitterAccount::authenticate()
|
||||
void
|
||||
TwitterAccount::deauthenticate()
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
|
||||
if ( m_twitterSipPlugin )
|
||||
sipPlugin()->disconnectPlugin();
|
||||
|
||||
|
@ -68,18 +68,19 @@ TwitterInfoPlugin::init()
|
||||
|
||||
TwitterInfoPlugin::~TwitterInfoPlugin()
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TwitterInfoPlugin::refreshTwitterAuth()
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << " begin";
|
||||
tDebug() << Q_FUNC_INFO << " begin" << this;
|
||||
if( !m_twitterAuth.isNull() )
|
||||
delete m_twitterAuth.data();
|
||||
|
||||
Q_ASSERT( TomahawkUtils::nam() != 0 );
|
||||
tDebug() << Q_FUNC_INFO << " with nam " << TomahawkUtils::nam();
|
||||
tDebug() << Q_FUNC_INFO << " with nam " << TomahawkUtils::nam() << this;
|
||||
m_twitterAuth = QWeakPointer< TomahawkOAuthTwitter >( new TomahawkOAuthTwitter( TomahawkUtils::nam(), this ) );
|
||||
|
||||
if( m_twitterAuth.isNull() )
|
||||
@ -97,13 +98,13 @@ TwitterInfoPlugin::connectAuthVerifyReply( const QTweetUser &user )
|
||||
{
|
||||
if ( user.id() == 0 )
|
||||
{
|
||||
tDebug() << "TwitterInfoPlugin could not authenticate to Twitter";
|
||||
tDebug() << "TwitterInfoPlugin could not authenticate to Twitter" << this;
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
tDebug() << "TwitterInfoPlugin successfully authenticated to Twitter";
|
||||
tDebug() << "TwitterInfoPlugin successfully authenticated to Twitter" << this;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -107,6 +107,13 @@ void
|
||||
InfoSystemWorker::addInfoPlugin( InfoPlugin* plugin )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << plugin;
|
||||
foreach ( InfoPluginPtr ptr, m_plugins )
|
||||
{
|
||||
if ( ptr.data() == plugin )
|
||||
tDebug() << Q_FUNC_INFO << "This plugin is already added to the infosystem.";
|
||||
return;
|
||||
}
|
||||
|
||||
InfoPluginPtr weakptr( plugin );
|
||||
m_plugins.append( weakptr );
|
||||
registerInfoTypes( weakptr, weakptr.data()->supportedGetTypes(), weakptr.data()->supportedPushTypes() );
|
||||
|
Loading…
x
Reference in New Issue
Block a user