mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 14:46:33 +02:00
* Prevent source-retrieval from accidentally creating new sources.
This commit is contained in:
@@ -251,7 +251,7 @@ Source::setOffline()
|
||||
void
|
||||
Source::setOnline()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << friendlyName();
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << friendlyName();
|
||||
if ( m_online )
|
||||
return;
|
||||
|
||||
|
@@ -185,7 +185,7 @@ SourceList::get( int id ) const
|
||||
|
||||
|
||||
source_ptr
|
||||
SourceList::get( const QString& username, const QString& friendlyName )
|
||||
SourceList::get( const QString& username, const QString& friendlyName, bool autoCreate )
|
||||
{
|
||||
QMutexLocker lock( &m_mut );
|
||||
|
||||
@@ -197,10 +197,14 @@ SourceList::get( const QString& username, const QString& friendlyName )
|
||||
|
||||
if ( !m_sources.contains( username ) )
|
||||
{
|
||||
if ( autoCreate )
|
||||
{
|
||||
Q_ASSERT( !friendlyName.isEmpty() );
|
||||
source = source_ptr( new Source( -1, username ) );
|
||||
source->setFriendlyName( friendlyName );
|
||||
add( source );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
source = m_sources.value( username );
|
||||
|
@@ -51,7 +51,7 @@ public:
|
||||
QList<Tomahawk::source_ptr> sources( bool onlyOnline = false ) const;
|
||||
unsigned int count() const;
|
||||
|
||||
Tomahawk::source_ptr get( const QString& username, const QString& friendlyName = QString() );
|
||||
Tomahawk::source_ptr get( const QString& username, const QString& friendlyName = QString(), bool autoCreate = false );
|
||||
Tomahawk::source_ptr get( int id ) const;
|
||||
|
||||
signals:
|
||||
|
@@ -129,7 +129,7 @@ ControlConnection::setup()
|
||||
tDebug() << "Detected name:" << name() << friendlyName << m_sock->peerAddress();
|
||||
|
||||
// setup source and remote collection for this peer
|
||||
m_source = SourceList::instance()->get( id(), friendlyName );
|
||||
m_source = SourceList::instance()->get( id(), friendlyName, true );
|
||||
m_source->setControlConnection( this );
|
||||
|
||||
// delay setting up collection/etc until source is synced.
|
||||
|
Reference in New Issue
Block a user