mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 00:09:47 +01:00
Show nicknames from roster instead of xmpp ids
This commit is contained in:
parent
e2ef8e5774
commit
6b7e0e8180
@ -725,6 +725,24 @@ XmppSipPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr& item, const Jre
|
||||
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:
|
||||
Jreen::Capabilities::Ptr caps = presence.payload<Jreen::Capabilities>();
|
||||
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 );
|
||||
peerInfo->setContactId( jid.bare() );
|
||||
peerInfo->setStatus( PeerInfo::Online );
|
||||
peerInfo->setFriendlyName( m_jidsNames.value( jid.bare() ) );
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
if ( !m_avatarManager->avatar( jid.bare() ).isNull() )
|
||||
|
@ -142,6 +142,7 @@ private:
|
||||
Jreen::MUCRoom* m_room;
|
||||
Jreen::SimpleRoster* m_roster;
|
||||
QHash< Jreen::JID, Jreen::Presence::Type > m_peers;
|
||||
QHash< QString, QString > m_jidsNames;
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
QHash< Jreen::JID, QMessageBox* > m_subscriptionConfirmBoxes;
|
||||
|
@ -130,6 +130,15 @@ Source::nodeId() const
|
||||
QString
|
||||
Source::friendlyName() const
|
||||
{
|
||||
QPixmap result;
|
||||
foreach( const peerinfo_ptr& peerInfo, peerInfos() )
|
||||
{
|
||||
if( !peerInfo.isNull() && !peerInfo->friendlyName().isEmpty() )
|
||||
{
|
||||
return peerInfo->friendlyName();
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_friendlyname.isEmpty() )
|
||||
return dbFriendlyName();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user