1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-22 16:59:58 +01:00

sipjreen: remove unneeded m_connected state - m_client knows better about it

This commit is contained in:
Dominik Schmidt 2011-05-03 17:12:54 +02:00
parent 117bff483d
commit 6239f90cf0
2 changed files with 11 additions and 12 deletions

View File

@ -46,7 +46,6 @@
JabberPlugin::JabberPlugin()
: m_menu( 0 )
, m_addFriendAction( 0 )
, m_connected(false)
{
qDebug() << Q_FUNC_INFO;
@ -166,13 +165,19 @@ JabberPlugin::connectPlugin( bool startup )
if ( startup && !TomahawkSettings::instance()->jabberAutoConnect() )
return false;
qDebug() << "Connecting to the XMPP server..." << m_connected;
if(m_client->isConnected())
{
qDebug() << Q_FUNC_INFO << "Already connected to server, not connecting again...";
return true; //FIXME: should i return false here?!
}
qDebug() << "Connecting to the XMPP server...";
qDebug() << m_client->jid().full();
//m_client->setServer( m_client->jid().domain() );
qDebug() << m_client->server() << m_client->port();
//FIXME: we're badly workarounding some missing reconnection api here, to be fixed soon
QTimer::singleShot(1000, m_client, SLOT( connectToServer() ) );
//m_client->connectToServer();
return true;
}
@ -180,9 +185,9 @@ JabberPlugin::connectPlugin( bool startup )
void
JabberPlugin::disconnectPlugin()
{
qDebug() << Q_FUNC_INFO << m_connected;
qDebug() << Q_FUNC_INFO;
if(!m_connected)
if(!m_client->isConnected())
return;
foreach(const Jreen::JID &peer, m_peers.keys())
@ -240,8 +245,6 @@ JabberPlugin::onConnect()
//connect( m_room, SIGNAL( messageReceived( Jreen::Message, bool ) ), this, SLOT( onNewMessage( Jreen::Message ) ) );
//connect( m_room, SIGNAL( presenceReceived( Jreen::Presence, const Jreen::MUCRoom::Participant* ) ), this, SLOT( onNewPresence( Jreen::Presence ) ) );
m_connected = true;
addMenuHelper();
}
@ -329,8 +332,6 @@ JabberPlugin::onDisconnect( Jreen::Client::DisconnectReason reason )
if(reconnect)
QTimer::singleShot(reconnectInSeconds*1000, this, SLOT(connectPlugin()));
m_connected = false;
}
void

View File

@ -100,8 +100,6 @@ private:
bool presenceMeansOnline( Jreen::Presence::Type p );
void handlePeerStatus( const Jreen::JID &jid, Jreen::Presence::Type presenceType );
bool m_connected;
QMenu* m_menu;
QAction* m_addFriendAction;