1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00

Fix up xmpp info plugin. This plugin respects private listening

settings, since unlike mpris and fdo it isn't designed to display
locally
This commit is contained in:
Jeff Mitchell
2012-04-09 12:19:25 -04:00
parent b6cd43d25f
commit bb0e24f074

View File

@@ -99,13 +99,27 @@ Tomahawk::InfoSystem::XmppInfoPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushDa
void void
Tomahawk::InfoSystem::XmppInfoPlugin::audioStarted( const Tomahawk::InfoSystem::PushInfoPair &pushInfoPair ) Tomahawk::InfoSystem::XmppInfoPlugin::audioStarted( const Tomahawk::InfoSystem::PushInfoPair &pushInfoPair )
{ {
if ( !pushInfoPair.second.canConvert< Tomahawk::InfoSystem::InfoStringHash >() ) if ( !pushInfoPair.second.canConvert< QVariantMap >() )
{
tDebug() << Q_FUNC_INFO << "Failed to convert data to a QVariantMap";
return;
}
QVariantMap map = pushInfoPair.second.toMap();
if ( map.contains( "private" ) && map[ "private" ] == TomahawkSettings::FullyPrivate )
{
Jreen::Tune::Ptr tune( new Jreen::Tune() );
m_pubSubManager->publishItems( QList<Jreen::Payload::Ptr>() << tune, Jreen::JID() );
return;
}
if ( !map.contains( "trackinfo" ) || !map[ "trackinfo" ].canConvert< Tomahawk::InfoSystem::InfoStringHash >() )
{ {
tDebug() << Q_FUNC_INFO << "did not find an infostringhash"; tDebug() << Q_FUNC_INFO << "did not find an infostringhash";
return; return;
} }
Tomahawk::InfoSystem::InfoStringHash info = pushInfoPair.second.value< Tomahawk::InfoSystem::InfoStringHash >(); Tomahawk::InfoSystem::InfoStringHash info = map[ "trackinfo" ].value< Tomahawk::InfoSystem::InfoStringHash >();
tDebug() << Q_FUNC_INFO << m_sipPlugin->m_client->jid().full() << info; tDebug() << Q_FUNC_INFO << m_sipPlugin->m_client->jid().full() << info;
Jreen::Tune::Ptr tune( new Jreen::Tune() ); Jreen::Tune::Ptr tune( new Jreen::Tune() );