Beispiel #1
0
void VCardManagerPrivate::_q_received(const Jreen::Presence &presence)
{
	if (presence.error())
		return;
	if (VCardUpdate::Ptr update = presence.payload<VCardUpdate>())
		emit q_ptr->vCardUpdateDetected(presence.from(), update);
}
Beispiel #2
0
void
XmppSipPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr& item, const Jreen::Presence& presence )
{
    Q_UNUSED(item);
    if ( m_state != Account::Connected )
        return;

    Jreen::JID jid = presence.from();
    QString fulljid( jid.full() );

    tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "New presence:" << fulljid << presence.subtype();

    if ( jid == m_client->jid() )
        return;

    if ( presence.error() )
    {
        //qDebug() << Q_FUNC_INFO << fulljid << "Running tomahawk: no" << "presence error";
        return;
    }

    // cache name
    if( !item.isNull() && item->name() != jid.bare() && m_jidsNames.value( jid.bare() ) != item->name() )
    {
        tLog( LOGVERBOSE ) << Q_FUNC_INFO << "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() );
            }
        }
    }