diff --git a/src/tomahawk/DiagnosticsDialog.cpp b/src/tomahawk/DiagnosticsDialog.cpp index 71505bd5c..ead2446a3 100644 --- a/src/tomahawk/DiagnosticsDialog.cpp +++ b/src/tomahawk/DiagnosticsDialog.cpp @@ -166,19 +166,41 @@ DiagnosticsDialog::accountLog( Tomahawk::Accounts::Account* account ) .arg( stateString ) ); - foreach( const Tomahawk::peerinfo_ptr& peerInfo, account->sipPlugin()->peersOnline() ) + QMap< QString, QList< Tomahawk::peerinfo_ptr > > nodes; + foreach ( const Tomahawk::peerinfo_ptr& peerInfo, account->sipPlugin()->peersOnline() ) { - accountInfo.append( QString( " %1: " ).arg( peerInfo->id() ) ); - foreach ( SipInfo info, peerInfo->sipInfos() ) + if ( !nodes.contains( peerInfo->nodeId() ) ) { - if ( info.isValid() ) - accountInfo.append( QString( "[%1]:%2; " ).arg( info.host() ).arg( info.port() ) ); - else - accountInfo.append( "SipInfo invalid; " ); + nodes[peerInfo->nodeId()] = QList< Tomahawk::peerinfo_ptr >(); } - if ( ( ( peerInfo->sipInfos().length() == 1 ) && ( !peerInfo->sipInfos().first().isVisible() ) ) || ( peerInfo->sipInfos().isEmpty() ) ) + nodes[peerInfo->nodeId()].append( peerInfo); + } + foreach ( const QString& nodeid, nodes.keys() ) + { + accountInfo.append( QString( " " ) ); + QStringList peerIds; + foreach ( const Tomahawk::peerinfo_ptr& peerInfo, nodes.value( nodeid ) ) + { + peerIds << peerInfo->id(); + } + accountInfo.append( peerIds.join( QChar( ',' ) ) ); + accountInfo.append( QString( ": %1 @ ").arg( nodeid ) ); + QStringList sipInfos; + foreach ( const Tomahawk::peerinfo_ptr& peerInfo, nodes.value( nodeid ) ) + { + foreach ( SipInfo info, peerInfo->sipInfos() ) + { + if ( info.isValid() ) + sipInfos << QString( "[%1]:%2" ).arg( info.host() ).arg( info.port() ) ; + else + sipInfos << QString( "SipInfo invalid" ); + } + } + sipInfos.removeDuplicates(); + accountInfo.append( sipInfos.join( QChar( ';' ) ) ); + if ( ( ( nodes.value( nodeid ).first()->sipInfos().length() == 1 ) && ( !nodes.value( nodeid ).first()->sipInfos().first().isVisible() ) ) || ( nodes.value( nodeid ).first()->sipInfos().isEmpty() ) ) accountInfo.append( "(outbound connections only) "); - accountInfo.append( QString( " (%1)\n" ).arg( peerInfo->versionString() ) ); + accountInfo.append( QString( " (%1)\n" ).arg( nodes.value( nodeid ).first()->versionString() ) ); } accountInfo.append( "\n" );