diff --git a/src/libtomahawk/network/controlconnection.cpp b/src/libtomahawk/network/controlconnection.cpp index 906f774d0..016bf7d56 100644 --- a/src/libtomahawk/network/controlconnection.cpp +++ b/src/libtomahawk/network/controlconnection.cpp @@ -41,7 +41,7 @@ ControlConnection::ControlConnection( Servent* parent, const QHostAddress &ha ) { qDebug() << "CTOR controlconnection"; setId("ControlConnection()"); - + // auto delete when connection closes: connect( this, SIGNAL( finished() ), SLOT( deleteLater() ) ); @@ -60,13 +60,13 @@ ControlConnection::ControlConnection( Servent* parent, const QString &ha ) { qDebug() << "CTOR controlconnection"; setId("ControlConnection()"); - + // auto delete when connection closes: connect( this, SIGNAL( finished() ), SLOT( deleteLater() ) ); - + this->setMsgProcessorModeIn( MsgProcessor::UNCOMPRESS_ALL | MsgProcessor::PARSE_JSON ); this->setMsgProcessorModeOut( MsgProcessor::COMPRESS_IF_LARGE ); - + if ( !ha.isEmpty() ) { QHostAddress qha( ha ); @@ -134,6 +134,8 @@ ControlConnection::setup() else friendlyName = name(); + 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->setControlConnection( this ); diff --git a/src/libtomahawk/network/servent.cpp b/src/libtomahawk/network/servent.cpp index 3933529b5..b1067dd36 100644 --- a/src/libtomahawk/network/servent.cpp +++ b/src/libtomahawk/network/servent.cpp @@ -818,11 +818,11 @@ Servent::isIPWhitelisted( QHostAddress ip ) static QList whitelist; if( whitelist.isEmpty() ) { - whitelist << range( QHostAddress( "10.0.0.0" ), 8 ) - << range( QHostAddress( "172.16.0.0" ), 12 ) - << range( QHostAddress( "192.168.0.0" ), 16 ) - << range( QHostAddress( "169.254.0.0" ), 16 ) - << range( QHostAddress( "127.0.0.0" ), 24 ); + whitelist << range( QHostAddress( "10.0.0.0" ), 8 ) + << range( QHostAddress( "172.16.0.0" ), 12 ) + << range( QHostAddress( "192.168.0.0" ), 16 ) + << range( QHostAddress( "169.254.0.0" ), 16 ) + << range( QHostAddress( "127.0.0.0" ), 24 ); // tDebug( LOGVERBOSE ) << "Loaded whitelist IP range:" << whitelist; } diff --git a/src/libtomahawk/sip/SipHandler.cpp b/src/libtomahawk/sip/SipHandler.cpp index c28485928..d954154c2 100644 --- a/src/libtomahawk/sip/SipHandler.cpp +++ b/src/libtomahawk/sip/SipHandler.cpp @@ -478,14 +478,7 @@ SipHandler::onPeerOnline( const QString& jid ) ControlConnection* conn = new ControlConnection( Servent::instance(), QString() ); const QString& nodeid = Database::instance()->dbid(); - - //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->setName( jid.left( jid.indexOf( "/" ) ) ); conn->setId( nodeid ); Servent::instance()->registerOffer( key, conn ); diff --git a/src/libtomahawk/source.cpp b/src/libtomahawk/source.cpp index e7ed0674a..fe2534e4b 100644 --- a/src/libtomahawk/source.cpp +++ b/src/libtomahawk/source.cpp @@ -200,7 +200,7 @@ Source::setOnline() emit online(); // 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 ) ), SLOT( dbLoaded( unsigned int, const QString& ) ) ); Database::instance()->enqueue( QSharedPointer(cmd) ); diff --git a/src/libtomahawk/sourcelist.cpp b/src/libtomahawk/sourcelist.cpp index ffc9b72a4..e6324bd59 100644 --- a/src/libtomahawk/sourcelist.cpp +++ b/src/libtomahawk/sourcelist.cpp @@ -96,6 +96,7 @@ SourceList::setSources( const QList& sources ) tLog() << Q_FUNC_INFO << "- Total sources now:" << m_sources.size(); } + emit ready(); } @@ -200,7 +201,10 @@ SourceList::get( const QString& username, const QString& friendlyName ) add( source ); } else + { source = m_sources.value( username ); + source->setFriendlyName( friendlyName ); + } return source; } diff --git a/src/sip/jabber/jabber.cpp b/src/sip/jabber/jabber.cpp index 2a4b42454..770a554fd 100644 --- a/src/sip/jabber/jabber.cpp +++ b/src/sip/jabber/jabber.cpp @@ -94,7 +94,6 @@ JabberPlugin::JabberPlugin( const QString& pluginId ) connect( m_ui->jabberUsername, SIGNAL( textChanged( QString ) ), SLOT( onCheckJidExists( QString ) ) ); #endif - // setup JID object Jreen::JID jid = Jreen::JID( accountName() );