mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 22:26:32 +02:00
Make lastfm/xmpp info plugins more robust
This commit is contained in:
@@ -54,8 +54,6 @@ LastFmAccountFactory::icon() const
|
|||||||
LastFmAccount::LastFmAccount( const QString& accountId )
|
LastFmAccount::LastFmAccount( const QString& accountId )
|
||||||
: CustomAtticaAccount( accountId )
|
: CustomAtticaAccount( accountId )
|
||||||
{
|
{
|
||||||
m_infoPlugin = QWeakPointer< LastFmPlugin >( new LastFmPlugin( this ) );
|
|
||||||
|
|
||||||
setAccountFriendlyName( "Last.Fm" );
|
setAccountFriendlyName( "Last.Fm" );
|
||||||
m_icon.load( RESPATH "images/lastfm-icon.png" );
|
m_icon.load( RESPATH "images/lastfm-icon.png" );
|
||||||
|
|
||||||
@@ -84,7 +82,8 @@ LastFmAccount::LastFmAccount( const QString& accountId )
|
|||||||
LastFmAccount::~LastFmAccount()
|
LastFmAccount::~LastFmAccount()
|
||||||
{
|
{
|
||||||
if ( m_infoPlugin )
|
if ( m_infoPlugin )
|
||||||
m_infoPlugin.data()->deleteLater();
|
Tomahawk::InfoSystem::InfoSystem::instance()->removeInfoPlugin( infoPlugin() );
|
||||||
|
|
||||||
delete m_resolver.data();
|
delete m_resolver.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,9 +166,10 @@ LastFmAccount::icon() const
|
|||||||
InfoPluginPtr
|
InfoPluginPtr
|
||||||
LastFmAccount::infoPlugin()
|
LastFmAccount::infoPlugin()
|
||||||
{
|
{
|
||||||
if ( m_infoPlugin )
|
if ( m_infoPlugin.isNull() )
|
||||||
return InfoPluginPtr( m_infoPlugin.data() );
|
m_infoPlugin = QWeakPointer< LastFmPlugin >( new LastFmPlugin( this ) );
|
||||||
return InfoPluginPtr();
|
|
||||||
|
return InfoPluginPtr( m_infoPlugin.data() );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@@ -105,11 +105,8 @@ Tomahawk::InfoSystem::InfoPluginPtr
|
|||||||
TwitterAccount::infoPlugin()
|
TwitterAccount::infoPlugin()
|
||||||
{
|
{
|
||||||
if ( m_twitterInfoPlugin.isNull() )
|
if ( m_twitterInfoPlugin.isNull() )
|
||||||
{
|
|
||||||
m_twitterInfoPlugin = QWeakPointer< Tomahawk::InfoSystem::TwitterInfoPlugin >( new Tomahawk::InfoSystem::TwitterInfoPlugin( this ) );
|
m_twitterInfoPlugin = QWeakPointer< Tomahawk::InfoSystem::TwitterInfoPlugin >( new Tomahawk::InfoSystem::TwitterInfoPlugin( this ) );
|
||||||
|
|
||||||
return Tomahawk::InfoSystem::InfoPluginPtr( m_twitterInfoPlugin.data() );
|
|
||||||
}
|
|
||||||
return Tomahawk::InfoSystem::InfoPluginPtr( m_twitterInfoPlugin.data() );
|
return Tomahawk::InfoSystem::InfoPluginPtr( m_twitterInfoPlugin.data() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -176,6 +176,9 @@ XmppSipPlugin::~XmppSipPlugin()
|
|||||||
InfoSystem::InfoPluginPtr
|
InfoSystem::InfoPluginPtr
|
||||||
XmppSipPlugin::infoPlugin()
|
XmppSipPlugin::infoPlugin()
|
||||||
{
|
{
|
||||||
|
if ( m_infoPlugin.isNull() )
|
||||||
|
m_infoPlugin = QWeakPointer< Tomahawk::InfoSystem::XmppInfoPlugin >( new Tomahawk::InfoSystem::XmppInfoPlugin( this ) );
|
||||||
|
|
||||||
return InfoSystem::InfoPluginPtr( m_infoPlugin.data() );
|
return InfoSystem::InfoPluginPtr( m_infoPlugin.data() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,11 +273,8 @@ XmppSipPlugin::onConnect()
|
|||||||
m_roster->load();
|
m_roster->load();
|
||||||
|
|
||||||
// load XmppInfoPlugin
|
// load XmppInfoPlugin
|
||||||
if( !m_infoPlugin )
|
if( infoPlugin() )
|
||||||
{
|
|
||||||
m_infoPlugin = QWeakPointer< Tomahawk::InfoSystem::XmppInfoPlugin >( new Tomahawk::InfoSystem::XmppInfoPlugin( this ) );
|
|
||||||
InfoSystem::InfoSystem::instance()->addInfoPlugin( infoPlugin() );
|
InfoSystem::InfoSystem::instance()->addInfoPlugin( infoPlugin() );
|
||||||
}
|
|
||||||
|
|
||||||
//FIXME: this implementation is totally broken atm, so it's disabled to avoid harm :P
|
//FIXME: this implementation is totally broken atm, so it's disabled to avoid harm :P
|
||||||
// join MUC with bare jid as nickname
|
// join MUC with bare jid as nickname
|
||||||
@@ -338,6 +338,9 @@ XmppSipPlugin::onDisconnect( Jreen::Client::DisconnectReason reason )
|
|||||||
{
|
{
|
||||||
handlePeerStatus(peer, Jreen::Presence::Unavailable);
|
handlePeerStatus(peer, Jreen::Presence::Unavailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !m_infoPlugin.isNull() )
|
||||||
|
Tomahawk::InfoSystem::InfoSystem::instance()->removeInfoPlugin( infoPlugin() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user