mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-10 16:14:40 +02:00
Add contactId to PeerInfo and use it as connection name/dbfriendlyname
This commit is contained in:
@@ -973,6 +973,7 @@ XmppSipPlugin::handlePeerStatus( const Jreen::JID& jid, Jreen::Presence::Type pr
|
|||||||
m_peers[ jid ] = presenceType;
|
m_peers[ jid ] = presenceType;
|
||||||
|
|
||||||
Tomahawk::peerinfo_ptr peerInfo = PeerInfo::get( this, fulljid, PeerInfo::AutoCreate );
|
Tomahawk::peerinfo_ptr peerInfo = PeerInfo::get( this, fulljid, PeerInfo::AutoCreate );
|
||||||
|
peerInfo->setContactId( jid.bare() );
|
||||||
peerInfo->setStatus( PeerInfo::Online );
|
peerInfo->setStatus( PeerInfo::Online );
|
||||||
|
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
|
@@ -334,7 +334,7 @@ Servent::registerPeer( const Tomahawk::peerinfo_ptr& peerInfo )
|
|||||||
ControlConnection* conn = new ControlConnection( this );
|
ControlConnection* conn = new ControlConnection( this );
|
||||||
|
|
||||||
const QString& nodeid = Database::instance()->impl()->dbid();
|
const QString& nodeid = Database::instance()->impl()->dbid();
|
||||||
conn->setName( peerId.left( peerId.indexOf( "/" ) ) );
|
conn->setName( peerInfo->contactId() );
|
||||||
conn->setId( nodeid );
|
conn->setId( nodeid );
|
||||||
conn->addPeerInfo( peerInfo );
|
conn->addPeerInfo( peerInfo );
|
||||||
|
|
||||||
@@ -759,7 +759,7 @@ Servent::connectToPeer( const peerinfo_ptr& peerInfo )
|
|||||||
conn->setFirstMessage( m );
|
conn->setFirstMessage( m );
|
||||||
|
|
||||||
if ( peerInfo->id().length() )
|
if ( peerInfo->id().length() )
|
||||||
conn->setName( peerInfo->id() );
|
conn->setName( peerInfo->contactId() );
|
||||||
if ( sipInfo.nodeId().length() )
|
if ( sipInfo.nodeId().length() )
|
||||||
conn->setId( sipInfo.nodeId() );
|
conn->setId( sipInfo.nodeId() );
|
||||||
|
|
||||||
|
@@ -201,6 +201,20 @@ PeerInfo::debugName() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PeerInfo::setContactId ( const QString& contactId )
|
||||||
|
{
|
||||||
|
m_contactId = contactId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const QString
|
||||||
|
PeerInfo::contactId() const
|
||||||
|
{
|
||||||
|
return m_contactId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PeerInfo::setStatus( PeerInfo::Status status )
|
PeerInfo::setStatus( PeerInfo::Status status )
|
||||||
|
@@ -86,7 +86,13 @@ public:
|
|||||||
void setType( Tomahawk::PeerInfo::Type type );
|
void setType( Tomahawk::PeerInfo::Type type );
|
||||||
PeerInfo::Type type() const;
|
PeerInfo::Type type() const;
|
||||||
|
|
||||||
// actual data
|
/* actual data */
|
||||||
|
|
||||||
|
// while peerId references a certain peer, contact id references the contact
|
||||||
|
// e.g. a peerId might be a full jid with resource while contact id is the bare jid
|
||||||
|
void setContactId( const QString& contactId );
|
||||||
|
const QString contactId() const;
|
||||||
|
|
||||||
void setStatus( Status status );
|
void setStatus( Status status );
|
||||||
Status status() const;
|
Status status() const;
|
||||||
|
|
||||||
@@ -122,6 +128,7 @@ private:
|
|||||||
PeerInfo::Type m_type;
|
PeerInfo::Type m_type;
|
||||||
|
|
||||||
QString m_id;
|
QString m_id;
|
||||||
|
QString m_contactId;
|
||||||
Status m_status;
|
Status m_status;
|
||||||
SipInfo m_sipInfo;
|
SipInfo m_sipInfo;
|
||||||
QString m_friendlyName;
|
QString m_friendlyName;
|
||||||
|
Reference in New Issue
Block a user