mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-22 16:59:58 +01:00
Add Tomahawk version reported by SipPlugin to the diagnostics dialog.
This commit is contained in:
parent
4401fe15ac
commit
2862b01691
@ -101,6 +101,8 @@ void DiagnosticsDialog::updateLogView()
|
||||
case SipPlugin::Disconnected:
|
||||
stateString = "Disconnected";
|
||||
break;
|
||||
case SipPlugin::Disconnecting:
|
||||
stateString = "Disconnecting";
|
||||
}
|
||||
log.append(
|
||||
QString(" %2 (%1): %3 (%4)\n")
|
||||
@ -122,27 +124,31 @@ void DiagnosticsDialog::updateLogView()
|
||||
}
|
||||
}
|
||||
|
||||
QString versionString = SipHandler::instance()->versionString( peerId );
|
||||
SipInfo sipInfo = SipHandler::instance()->sipInfo( peerId );
|
||||
if( !sipInfo.isValid() )
|
||||
log.append(
|
||||
QString(" %1: %2 (%3)\n")
|
||||
QString(" %1: %2 (%3) %4\n")
|
||||
.arg( peerId )
|
||||
.arg( "sipinfo invalid" )
|
||||
.arg( connected ? "connected" : "not connected")
|
||||
.arg( versionString )
|
||||
);
|
||||
else if( sipInfo.isVisible() )
|
||||
log.append(
|
||||
QString(" %1: %2:%3 (%4)\n")
|
||||
QString(" %1: %2:%3 (%4) %5\n")
|
||||
.arg( peerId )
|
||||
.arg( sipInfo.host().hostName() )
|
||||
.arg( sipInfo.port() )
|
||||
.arg( connected ? "connected" : "not connected")
|
||||
.arg( versionString )
|
||||
);
|
||||
else
|
||||
log.append(
|
||||
QString(" %1: visible: false (%2)\n")
|
||||
QString(" %1: visible: false (%2) %3\n")
|
||||
.arg( peerId )
|
||||
.arg( connected ? "connected" : "not connected")
|
||||
.arg( versionString )
|
||||
);
|
||||
}
|
||||
log.append("\n");
|
||||
|
@ -94,6 +94,12 @@ SipHandler::sipInfo(const QString& peerId) const
|
||||
return m_peersSipInfos.value( peerId );
|
||||
}
|
||||
|
||||
const QString
|
||||
SipHandler::versionString(const QString& peerId) const
|
||||
{
|
||||
return m_peersSoftwareVersions.value( peerId );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SipHandler::onSettingsChanged()
|
||||
@ -203,6 +209,7 @@ SipHandler::hookUpPlugin( SipPlugin* sip )
|
||||
QObject::connect( sip, SIGNAL( peerOffline( QString ) ), SLOT( onPeerOffline( QString ) ) );
|
||||
QObject::connect( sip, SIGNAL( msgReceived( QString, QString ) ), SLOT( onMessage( QString, QString ) ) );
|
||||
QObject::connect( sip, SIGNAL( sipInfoReceived( QString, SipInfo ) ), SLOT( onSipInfo( QString, SipInfo ) ) );
|
||||
QObject::connect( sip, SIGNAL( softwareVersionReceived( QString, QString ) ), SLOT( onSoftwareVersion( QString, QString ) ) );
|
||||
|
||||
QObject::connect( sip, SIGNAL( error( int, QString ) ), SLOT( onError( int, QString ) ) );
|
||||
QObject::connect( sip, SIGNAL( stateChanged( SipPlugin::ConnectionState ) ), SLOT( onStateChanged( SipPlugin::ConnectionState ) ) );
|
||||
@ -528,6 +535,11 @@ SipHandler::onSipInfo( const QString& peerId, const SipInfo& info )
|
||||
m_peersSipInfos.insert( peerId, info );
|
||||
}
|
||||
|
||||
void SipHandler::onSoftwareVersion(const QString& peerId, const QString& versionString)
|
||||
{
|
||||
m_peersSoftwareVersions.insert( peerId, versionString );
|
||||
}
|
||||
|
||||
void
|
||||
SipHandler::onMessage( const QString& from, const QString& msg )
|
||||
{
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
const QPixmap avatar( const QString& name ) const;
|
||||
//TODO: implement a proper SipInfo class and maybe attach it to the source
|
||||
const SipInfo sipInfo( const QString& peerId ) const;
|
||||
const QString versionString( const QString& peerId ) const;
|
||||
|
||||
public slots:
|
||||
void checkSettings();
|
||||
@ -88,6 +89,7 @@ signals:
|
||||
|
||||
private slots:
|
||||
void onSipInfo( const QString& peerId, const SipInfo& info );
|
||||
void onSoftwareVersion( const QString& peerId, const QString& versionString );
|
||||
void onMessage( const QString&, const QString& );
|
||||
void onPeerOffline( const QString& );
|
||||
void onPeerOnline( const QString& );
|
||||
@ -124,6 +126,7 @@ private:
|
||||
//TODO: move this to source
|
||||
QHash<QString, SipInfo> m_peersSipInfos;
|
||||
QHash<QString, QPixmap> m_usernameAvatars;
|
||||
QHash<QString, QString> m_peersSoftwareVersions;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -99,6 +99,7 @@ signals:
|
||||
void peerOffline( const QString& );
|
||||
void msgReceived( const QString& from, const QString& msg );
|
||||
void sipInfoReceived( const QString& peerId, const SipInfo& info );
|
||||
void softwareVersionReceived( const QString& peerId, const QString& versionString );
|
||||
|
||||
// new data for own source
|
||||
void avatarReceived ( const QPixmap& avatar );
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <jreen/vcard.h>
|
||||
#include <jreen/directconnection.h>
|
||||
#include <jreen/tcpconnection.h>
|
||||
#include <jreen/softwareversion.h>
|
||||
|
||||
#include <qjson/parser.h>
|
||||
#include <qjson/serializer.h>
|
||||
@ -637,13 +638,15 @@ void JabberPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr &item, const
|
||||
|
||||
// ignore anyone not Running tomahawk:
|
||||
Jreen::Capabilities::Ptr caps = presence.findExtension<Jreen::Capabilities>();
|
||||
/* Disabled this, because it's somewhat ugly and we should rely on nothing but the features
|
||||
if ( caps && ( caps->node() == TOMAHAWK_CAP_NODE_NAME ) )
|
||||
{
|
||||
// must be a jreen resource, implementation in gloox was broken
|
||||
qDebug() << Q_FUNC_INFO << fulljid << "Running tomahawk: yes" << "caps " << caps->node();
|
||||
handlePeerStatus( jid, presence.subtype() );
|
||||
}
|
||||
else if( caps )
|
||||
} else
|
||||
*/
|
||||
if( caps )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << fulljid << "Running tomahawk: maybe" << "caps " << caps->node()
|
||||
<< "requesting disco..";
|
||||
@ -651,10 +654,10 @@ void JabberPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr &item, const
|
||||
// request disco features
|
||||
QString node = caps->node() + '#' + caps->ver();
|
||||
|
||||
Jreen::IQ iq( Jreen::IQ::Get, jid );
|
||||
iq.addExtension( new Jreen::Disco::Info( node ) );
|
||||
Jreen::IQ featuresIq( Jreen::IQ::Get, jid );
|
||||
featuresIq.addExtension( new Jreen::Disco::Info( node ) );
|
||||
|
||||
m_client->send( iq, this, SLOT( onNewIq( Jreen::IQ, int ) ), RequestDisco );
|
||||
m_client->send( featuresIq, this, SLOT( onNewIq( Jreen::IQ, int ) ), RequestDisco );
|
||||
}
|
||||
else if( !caps )
|
||||
{
|
||||
@ -792,6 +795,16 @@ void JabberPlugin::onNewIq(const Jreen::IQ& iq, int context)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(context == RequestVersion)
|
||||
{
|
||||
Jreen::SoftwareVersion* softwareVersion = iq.findExtension<Jreen::SoftwareVersion>().data();
|
||||
if( softwareVersion )
|
||||
{
|
||||
QString versionString = QString("%1 %2 %3").arg( softwareVersion->name(), softwareVersion->os(), softwareVersion->version() );
|
||||
qDebug() << Q_FUNC_INFO << "Received software version for " << iq.from().full() << ":" << versionString;
|
||||
emit softwareVersionReceived( iq.from().full(), versionString );
|
||||
}
|
||||
}
|
||||
else if(context == RequestedDisco)
|
||||
{
|
||||
qDebug() << "Sent IQ(Set), what should be happening here?";
|
||||
@ -893,6 +906,11 @@ void JabberPlugin::handlePeerStatus(const Jreen::JID& jid, Jreen::Presence::Type
|
||||
if(!m_avatarManager->avatar(jid.bare()).isNull())
|
||||
onNewAvatar( jid.bare() );
|
||||
|
||||
// request software version
|
||||
Jreen::IQ versionIq( Jreen::IQ::Get, jid );
|
||||
versionIq.addExtension( new Jreen::SoftwareVersion() );
|
||||
m_client->send( versionIq, this, SLOT( onNewIq( Jreen::IQ, int ) ), RequestVersion );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ private:
|
||||
Jreen::SimpleRoster *m_roster;
|
||||
QHash<Jreen::JID, Jreen::Presence::Type> m_peers;
|
||||
QHash<Jreen::JID, QMessageBox*> m_subscriptionConfirmBoxes;
|
||||
enum IqContext { NoContext, RequestDisco, RequestedDisco, SipMessageSent, RequestedVCard };
|
||||
enum IqContext { NoContext, RequestDisco, RequestedDisco, SipMessageSent, RequestedVCard, RequestVersion, RequestedVersion };
|
||||
QStringList m_legacy_peers;
|
||||
AvatarManager *m_avatarManager;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user