1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 21:57:41 +02:00

sipjreen: improve staying-online

This commit is contained in:
Dominik Schmidt
2011-05-04 14:36:05 +02:00
parent 607ebf1c24
commit d8023b285f

View File

@@ -294,9 +294,6 @@ JabberPlugin::onDisconnect( Jreen::Client::DisconnectReason reason )
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
QString errorMessage; QString errorMessage;
bool reconnect = false;
int reconnectInSeconds = 0;
switch( reason ) switch( reason )
{ {
case Jreen::Client::User: case Jreen::Client::User:
@@ -313,19 +310,15 @@ JabberPlugin::onDisconnect( Jreen::Client::DisconnectReason reason )
break; break;
case Jreen::Client::RemoteStreamError: case Jreen::Client::RemoteStreamError:
errorMessage = "Remote Stream Error"; errorMessage = "Remote Stream Error";
reconnect = true;
break; break;
case Jreen::Client::RemoteConnectionFailed: case Jreen::Client::RemoteConnectionFailed:
errorMessage = "Remote Connection failed"; errorMessage = "Remote Connection failed";
break; break;
case Jreen::Client::InternalServerError: case Jreen::Client::InternalServerError:
errorMessage = "Internal Server Error"; errorMessage = "Internal Server Error";
reconnect = true;
break; break;
case Jreen::Client::SystemShutdown: case Jreen::Client::SystemShutdown:
errorMessage = "System shutdown"; errorMessage = "System shutdown";
reconnect = true;
reconnectInSeconds = 60;
break; break;
case Jreen::Client::Conflict: case Jreen::Client::Conflict:
errorMessage = "Conflict"; errorMessage = "Conflict";
@@ -341,6 +334,7 @@ JabberPlugin::onDisconnect( Jreen::Client::DisconnectReason reason )
break; break;
} }
bool reconnect = false;
switch( reason ) switch( reason )
{ {
case Jreen::Client::User: case Jreen::Client::User:
@@ -359,6 +353,7 @@ JabberPlugin::onDisconnect( Jreen::Client::DisconnectReason reason )
case Jreen::Client::Conflict: case Jreen::Client::Conflict:
case Jreen::Client::Unknown: case Jreen::Client::Unknown:
emit error( SipPlugin::ConnectionError, errorMessage ); emit error( SipPlugin::ConnectionError, errorMessage );
reconnect = true;
break; break;
default: default:
@@ -372,7 +367,7 @@ JabberPlugin::onDisconnect( Jreen::Client::DisconnectReason reason )
removeMenuHelper(); removeMenuHelper();
if(reconnect) if(reconnect)
QTimer::singleShot(reconnectInSeconds*1000, this, SLOT(connectPlugin())); QTimer::singleShot(15*1000, this, SLOT(connectPlugin()));
} }
void void