1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-09 07:36:48 +02:00

Fix problem with identifying same account with Twitter

This commit is contained in:
Jeff Mitchell
2012-06-22 18:05:14 -04:00
parent e2cc678daa
commit e3cb3a1c10

View File

@@ -122,24 +122,23 @@ ACLRegistry::isAuthorizedUser( const QString& dbid, const QString &username, ACL
QMetaObject::invokeMethod( this, "isAuthorizedUser", Qt::QueuedConnection, Q_ARG( const QString&, dbid ), Q_ARG( const QString &, username ), Q_ARG( ACLRegistry::ACL, globalType ), Q_ARG( bool, skipEmission ) ); QMetaObject::invokeMethod( this, "isAuthorizedUser", Qt::QueuedConnection, Q_ARG( const QString&, dbid ), Q_ARG( const QString &, username ), Q_ARG( ACLRegistry::ACL, globalType ), Q_ARG( bool, skipEmission ) );
return ACLRegistry::NotFound; return ACLRegistry::NotFound;
} }
tLog() << Q_FUNC_INFO << "in right thread";
//FIXME: Remove when things are working
// emit aclResult( dbid, username, ACLRegistry::Stream );
// return ACLRegistry::NotFound;
#ifndef ENABLE_HEADLESS #ifndef ENABLE_HEADLESS
if ( Tomahawk::Accounts::AccountManager::instance() ) if ( Tomahawk::Accounts::AccountManager::instance() )
{ {
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Checking account friendly names against" << username;
Tomahawk::Accounts::AccountManager* accountManager = Tomahawk::Accounts::AccountManager::instance(); Tomahawk::Accounts::AccountManager* accountManager = Tomahawk::Accounts::AccountManager::instance();
QList< Tomahawk::Accounts::Account* > accounts = accountManager->accounts(); QList< Tomahawk::Accounts::Account* > accounts = accountManager->accounts();
foreach( Tomahawk::Accounts::Account* account, accounts ) foreach( Tomahawk::Accounts::Account* account, accounts )
{ {
QVariantHash credentials = account->credentials(); if ( !( account->types() & Tomahawk::Accounts::SipType ) )
if ( credentials.contains( "username" ) && credentials[ "username" ].toString() == username ) continue;
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Checking against account friendly name" << account->accountFriendlyName();
if ( account->accountFriendlyName() == username )
{ {
if ( !skipEmission ) if ( !skipEmission )
emit aclResult( dbid, username, ACLRegistry::Stream ); emit aclResult( dbid, username, ACLRegistry::Stream );
return ACLRegistry::Stream; return ACLRegistry::Stream;
} }
} }
} }