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