1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-02-25 12:23:36 +01:00

sipjreen: Add authError signal

This commit is contained in:
Dominik Schmidt 2011-04-18 10:21:04 +02:00
parent 35d51a2cd2
commit 01980ab6d1
3 changed files with 34 additions and 0 deletions

View File

@ -109,6 +109,8 @@ JabberPlugin::connectPlugin( bool startup )
QObject::connect( p, SIGNAL( connected() ), SLOT( onConnected() ) );
QObject::connect( p, SIGNAL( disconnected() ), SLOT( onDisconnected() ) );
QObject::connect( p, SIGNAL( authError( int, QString ) ), SLOT( onAuthError( int, QString ) ) );
return true;
}
@ -156,6 +158,33 @@ JabberPlugin::onDisconnected()
emit disconnected();
}
void
JabberPlugin::onAuthError( int code, const QString& msg )
{
switch( code )
{
case Jreen::Client::AuthorizationError:
emit error( SipPlugin::AuthError, msg );
break;
case Jreen::Client::HostUnknown:
case Jreen::Client::ItemNotFound:
case Jreen::Client::RemoteStreamError:
case Jreen::Client::RemoteConnectionFailed:
case Jreen::Client::InternalServerError:
case Jreen::Client::SystemShutdown:
case Jreen::Client::Conflict:
case Jreen::Client::Unknown:
emit error( SipPlugin::ConnectionError, msg );
break;
default:
qDebug() << "Not all Client::DisconnectReasons checked";
Q_ASSERT(false);
break;
}
}
void
JabberPlugin::sendMsg(const QString& to, const QString& msg)
{

View File

@ -57,6 +57,7 @@ private slots:
void showAddFriendDialog();
void onConnected();
void onDisconnected();
void onAuthError(int code, const QString &msg);
private:
Jabber_p* p;

View File

@ -283,6 +283,10 @@ Jabber_p::onDisconnect( Jreen::Client::DisconnectReason reason )
}
qDebug() << "Disconnected from server:" << error;
if( reason != Jreen::Client::User )
{
emit authError( reason, error );
}
if(reconnect)
QTimer::singleShot(reconnectInSeconds*1000, m_client, SLOT(connectToServer()));