mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-23 17:29:42 +01:00
xmpp: Add checkbox for enforcing secure connections
This commit is contained in:
parent
4960e68208
commit
bc76ce550c
@ -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);
|
||||
|
@ -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 );
|
||||
|
@ -303,6 +303,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="xmppEnforceSecureCheckbox">
|
||||
<property name="text">
|
||||
<string>Enforce secure connection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user