diff --git a/src/accounts/xmpp/sip/xmppsip.cpp b/src/accounts/xmpp/sip/xmppsip.cpp index 6ff55b7c7..56981e75e 100644 --- a/src/accounts/xmpp/sip/xmppsip.cpp +++ b/src/accounts/xmpp/sip/xmppsip.cpp @@ -198,10 +198,16 @@ XmppSipPlugin::connectPlugin() if( m_client->isConnected() ) { qDebug() << Q_FUNC_INFO << "Already connected to server, not connecting again..."; - return; //FIXME: should i return false here?! + return; } - qDebug() << "Connecting to the Xmpp server..." << m_client->jid().full(); + if( m_account->configuration().contains("enforcesecure") && m_account->configuration().value("enforcesecure").toBool() ) + { + tLog() << Q_FUNC_INFO << "Enforcing secure connection..."; + m_client->setFeatureConfig(Jreen::Client::Encryption, Jreen::Client::Force); + } + + tDebug() << "Connecting to the Xmpp server..." << m_client->jid().full(); //FIXME: we're badly workarounding some missing reconnection api here, to be fixed soon QTimer::singleShot( 1000, m_client, SLOT( connectToServer() ) ); @@ -313,6 +319,10 @@ XmppSipPlugin::onDisconnect( Jreen::Client::DisconnectReason reason ) case Jreen::Client::SystemShutdown: case Jreen::Client::Conflict: case Jreen::Client::Unknown: + case Jreen::Client::NoCompressionSupport: + case Jreen::Client::NoEncryptionSupport: + case Jreen::Client::NoAuthorizationSupport: + case Jreen::Client::NoSupportedFeature: emit error( Account::ConnectionError, errorMessage( reason ) ); break; @@ -377,6 +387,22 @@ XmppSipPlugin::errorMessage( Jreen::Client::DisconnectReason reason ) return tr("Unknown"); break; + case Jreen::Client::NoCompressionSupport: + return tr("No Compression Support"); + break; + + case Jreen::Client::NoEncryptionSupport: + return tr("No Encryption Support"); + break; + + case Jreen::Client::NoAuthorizationSupport: + return tr("No Authorization Support"); + break; + + case Jreen::Client::NoSupportedFeature: + return tr("No Supported Feature"); + break; + default: qDebug() << "Not all Client::DisconnectReasons checked"; Q_ASSERT(false); diff --git a/src/accounts/xmpp/xmppconfigwidget.cpp b/src/accounts/xmpp/xmppconfigwidget.cpp index bc7c138da..c03fe2287 100644 --- a/src/accounts/xmpp/xmppconfigwidget.cpp +++ b/src/accounts/xmpp/xmppconfigwidget.cpp @@ -44,6 +44,7 @@ XmppConfigWidget::XmppConfigWidget( XmppAccount* account, QWidget *parent ) : m_ui->xmppServer->setText( account->configuration().contains( "server" ) ? account->configuration()[ "server" ].toString() : QString() ); m_ui->xmppPort->setValue( account->configuration().contains( "port" ) ? account->configuration()[ "port" ].toInt() : 5222 ); m_ui->xmppPublishTracksCheckbox->setChecked( account->configuration().contains( "publishtracks" ) ? account->configuration()[ "publishtracks" ].toBool() : true); + m_ui->xmppEnforceSecureCheckbox->setChecked( account->configuration().contains( "enforcesecure" ) ? account->configuration()[ "enforcesecure" ].toBool() : false); m_ui->jidExistsLabel->hide(); connect( m_ui->xmppUsername, SIGNAL( textChanged( QString ) ), SLOT( onCheckJidExists( QString ) ) ); @@ -65,7 +66,8 @@ XmppConfigWidget::saveConfig() QVariantHash configuration = m_account->configuration(); configuration[ "server" ] = m_ui->xmppServer->text().trimmed(); configuration[ "port" ] = m_ui->xmppPort->text().trimmed(); - configuration[ "publishtracks"] = m_ui->xmppPublishTracksCheckbox->checkState() == Qt::Checked; + configuration[ "publishtracks"] = m_ui->xmppPublishTracksCheckbox->isChecked(); + configuration[ "enforcesecure"] = m_ui->xmppEnforceSecureCheckbox->isChecked(); m_account->setAccountFriendlyName( m_ui->xmppUsername->text() ); m_account->setCredentials( credentials ); diff --git a/src/accounts/xmpp/xmppconfigwidget.ui b/src/accounts/xmpp/xmppconfigwidget.ui index 07a585604..bc083aa44 100644 --- a/src/accounts/xmpp/xmppconfigwidget.ui +++ b/src/accounts/xmpp/xmppconfigwidget.ui @@ -303,6 +303,13 @@ + + + + Enforce secure connection + + +