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