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

* Always set current name as friendlyname.

This commit is contained in:
Christian Muehlhaeuser
2011-11-21 06:45:32 +01:00
parent de48898d34
commit 3a500a6303
6 changed files with 17 additions and 19 deletions

View File

@@ -41,7 +41,7 @@ ControlConnection::ControlConnection( Servent* parent, const QHostAddress &ha )
{ {
qDebug() << "CTOR controlconnection"; qDebug() << "CTOR controlconnection";
setId("ControlConnection()"); setId("ControlConnection()");
// auto delete when connection closes: // auto delete when connection closes:
connect( this, SIGNAL( finished() ), SLOT( deleteLater() ) ); connect( this, SIGNAL( finished() ), SLOT( deleteLater() ) );
@@ -60,13 +60,13 @@ ControlConnection::ControlConnection( Servent* parent, const QString &ha )
{ {
qDebug() << "CTOR controlconnection"; qDebug() << "CTOR controlconnection";
setId("ControlConnection()"); setId("ControlConnection()");
// auto delete when connection closes: // auto delete when connection closes:
connect( this, SIGNAL( finished() ), SLOT( deleteLater() ) ); connect( this, SIGNAL( finished() ), SLOT( deleteLater() ) );
this->setMsgProcessorModeIn( MsgProcessor::UNCOMPRESS_ALL | MsgProcessor::PARSE_JSON ); this->setMsgProcessorModeIn( MsgProcessor::UNCOMPRESS_ALL | MsgProcessor::PARSE_JSON );
this->setMsgProcessorModeOut( MsgProcessor::COMPRESS_IF_LARGE ); this->setMsgProcessorModeOut( MsgProcessor::COMPRESS_IF_LARGE );
if ( !ha.isEmpty() ) if ( !ha.isEmpty() )
{ {
QHostAddress qha( ha ); QHostAddress qha( ha );
@@ -134,6 +134,8 @@ ControlConnection::setup()
else else
friendlyName = name(); friendlyName = name();
tDebug() << "Detected name:" << name() << friendlyName << m_sock->peerAddress();
// setup source and remote collection for this peer // setup source and remote collection for this peer
m_source = SourceList::instance()->get( id(), friendlyName ); m_source = SourceList::instance()->get( id(), friendlyName );
m_source->setControlConnection( this ); m_source->setControlConnection( this );

View File

@@ -818,11 +818,11 @@ Servent::isIPWhitelisted( QHostAddress ip )
static QList<range> whitelist; static QList<range> whitelist;
if( whitelist.isEmpty() ) if( whitelist.isEmpty() )
{ {
whitelist << range( QHostAddress( "10.0.0.0" ), 8 ) whitelist << range( QHostAddress( "10.0.0.0" ), 8 )
<< range( QHostAddress( "172.16.0.0" ), 12 ) << range( QHostAddress( "172.16.0.0" ), 12 )
<< range( QHostAddress( "192.168.0.0" ), 16 ) << range( QHostAddress( "192.168.0.0" ), 16 )
<< range( QHostAddress( "169.254.0.0" ), 16 ) << range( QHostAddress( "169.254.0.0" ), 16 )
<< range( QHostAddress( "127.0.0.0" ), 24 ); << range( QHostAddress( "127.0.0.0" ), 24 );
// tDebug( LOGVERBOSE ) << "Loaded whitelist IP range:" << whitelist; // tDebug( LOGVERBOSE ) << "Loaded whitelist IP range:" << whitelist;
} }

View File

@@ -478,14 +478,7 @@ SipHandler::onPeerOnline( const QString& jid )
ControlConnection* conn = new ControlConnection( Servent::instance(), QString() ); ControlConnection* conn = new ControlConnection( Servent::instance(), QString() );
const QString& nodeid = Database::instance()->dbid(); const QString& nodeid = Database::instance()->dbid();
conn->setName( jid.left( jid.indexOf( "/" ) ) );
//TODO: this is a terrible assumption, help me clean this up, mighty muesli!
if ( jid.contains( "@conference.") )
conn->setName( jid );
else
conn->setName( jid.left( jid.indexOf( "/" ) ) );
tDebug() << "Set name on connection:" << conn->name();
conn->setId( nodeid ); conn->setId( nodeid );
Servent::instance()->registerOffer( key, conn ); Servent::instance()->registerOffer( key, conn );

View File

@@ -200,7 +200,7 @@ Source::setOnline()
emit online(); emit online();
// ensure username is in the database // ensure username is in the database
DatabaseCommand_addSource* cmd = new DatabaseCommand_addSource( m_username, m_friendlyname ); DatabaseCommand_addSource* cmd = new DatabaseCommand_addSource( m_username, friendlyName() );
connect( cmd, SIGNAL( done( unsigned int, QString ) ), connect( cmd, SIGNAL( done( unsigned int, QString ) ),
SLOT( dbLoaded( unsigned int, const QString& ) ) ); SLOT( dbLoaded( unsigned int, const QString& ) ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) ); Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );

View File

@@ -96,6 +96,7 @@ SourceList::setSources( const QList<Tomahawk::source_ptr>& sources )
tLog() << Q_FUNC_INFO << "- Total sources now:" << m_sources.size(); tLog() << Q_FUNC_INFO << "- Total sources now:" << m_sources.size();
} }
emit ready(); emit ready();
} }
@@ -200,7 +201,10 @@ SourceList::get( const QString& username, const QString& friendlyName )
add( source ); add( source );
} }
else else
{
source = m_sources.value( username ); source = m_sources.value( username );
source->setFriendlyName( friendlyName );
}
return source; return source;
} }

View File

@@ -94,7 +94,6 @@ JabberPlugin::JabberPlugin( const QString& pluginId )
connect( m_ui->jabberUsername, SIGNAL( textChanged( QString ) ), SLOT( onCheckJidExists( QString ) ) ); connect( m_ui->jabberUsername, SIGNAL( textChanged( QString ) ), SLOT( onCheckJidExists( QString ) ) );
#endif #endif
// setup JID object // setup JID object
Jreen::JID jid = Jreen::JID( accountName() ); Jreen::JID jid = Jreen::JID( accountName() );