mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-08 23:26:40 +02:00
Show nicknames from roster instead of xmpp ids
This commit is contained in:
@@ -725,6 +725,24 @@ XmppSipPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr& item, const Jre
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cache name
|
||||||
|
if( !item.isNull() && item->name() != jid.bare() && m_jidsNames.value( jid.bare() ) != item->name() )
|
||||||
|
{
|
||||||
|
tLog() << "cache name" << item->name() << "for" << jid.bare() << item << presence.subtype();
|
||||||
|
m_jidsNames.insert( jid.bare(), item->name() );
|
||||||
|
|
||||||
|
// find peers for the jid and update their friendlyName
|
||||||
|
foreach ( const Jreen::JID& peer, m_peers.keys() )
|
||||||
|
{
|
||||||
|
if ( peer.bare() == jid.bare() )
|
||||||
|
{
|
||||||
|
Tomahawk::peerinfo_ptr peerInfo = PeerInfo::get( this, peer.full() );
|
||||||
|
if( !peerInfo.isNull() )
|
||||||
|
peerInfo->setFriendlyName( item->name() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ignore anyone not Running tomahawk:
|
// ignore anyone not Running tomahawk:
|
||||||
Jreen::Capabilities::Ptr caps = presence.payload<Jreen::Capabilities>();
|
Jreen::Capabilities::Ptr caps = presence.payload<Jreen::Capabilities>();
|
||||||
if ( caps )
|
if ( caps )
|
||||||
@@ -976,6 +994,7 @@ XmppSipPlugin::handlePeerStatus( const Jreen::JID& jid, Jreen::Presence::Type pr
|
|||||||
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->setContactId( jid.bare() );
|
||||||
peerInfo->setStatus( PeerInfo::Online );
|
peerInfo->setStatus( PeerInfo::Online );
|
||||||
|
peerInfo->setFriendlyName( m_jidsNames.value( jid.bare() ) );
|
||||||
|
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
if ( !m_avatarManager->avatar( jid.bare() ).isNull() )
|
if ( !m_avatarManager->avatar( jid.bare() ).isNull() )
|
||||||
|
@@ -142,6 +142,7 @@ private:
|
|||||||
Jreen::MUCRoom* m_room;
|
Jreen::MUCRoom* m_room;
|
||||||
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< QString, QString > m_jidsNames;
|
||||||
|
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
QHash< Jreen::JID, QMessageBox* > m_subscriptionConfirmBoxes;
|
QHash< Jreen::JID, QMessageBox* > m_subscriptionConfirmBoxes;
|
||||||
|
@@ -130,6 +130,15 @@ Source::nodeId() const
|
|||||||
QString
|
QString
|
||||||
Source::friendlyName() const
|
Source::friendlyName() const
|
||||||
{
|
{
|
||||||
|
QPixmap result;
|
||||||
|
foreach( const peerinfo_ptr& peerInfo, peerInfos() )
|
||||||
|
{
|
||||||
|
if( !peerInfo.isNull() && !peerInfo->friendlyName().isEmpty() )
|
||||||
|
{
|
||||||
|
return peerInfo->friendlyName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( m_friendlyname.isEmpty() )
|
if ( m_friendlyname.isEmpty() )
|
||||||
return dbFriendlyName();
|
return dbFriendlyName();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user