aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/options
diff options
context:
space:
mode:
authorGravatar IceN9ne2018-11-16 20:42:46 -0500
committerGravatar IceN9ne2018-11-22 11:31:25 -0500
commit665fc15dde8665e3fdec83b038000952296e63e0 (patch)
tree7b04168288d9eeeea3fa0846e75d7c05122b098a /src/modules/options
parentTravis: use sftp instead of scp to upload .dmg (diff)
downloadKVIrc-665fc15dde8665e3fdec83b038000952296e63e0.tar.gz
KVIrc-665fc15dde8665e3fdec83b038000952296e63e0.tar.bz2
KVIrc-665fc15dde8665e3fdec83b038000952296e63e0.zip
SASL: Add support for EXTERNAL method. Closes #2258
Diffstat (limited to 'src/modules/options')
-rw-r--r--src/modules/options/OptionsWidget_servers.cpp32
-rw-r--r--src/modules/options/OptionsWidget_servers.h1
2 files changed, 25 insertions, 8 deletions
diff --git a/src/modules/options/OptionsWidget_servers.cpp b/src/modules/options/OptionsWidget_servers.cpp
index af11bb343..9b1fd86a7 100644
--- a/src/modules/options/OptionsWidget_servers.cpp
+++ b/src/modules/options/OptionsWidget_servers.cpp
@@ -55,6 +55,7 @@
#include "KviPointerHashTable.h"
#include "KviTalToolTip.h"
#include "KviIrcNetwork.h"
+#include "KviSASL.h"
#include <QLineEdit>
#include <QCursor>
@@ -901,19 +902,33 @@ IrcServerDetailsWidget::IrcServerDetailsWidget(QWidget * par, KviIrcServer * s)
m_pEnableSASLCheck->setChecked(s->enabledSASL());
- l = new QLabel(__tr2qs_ctx("SASL nickname:", "options"), pSASLGroup);
+ l = new QLabel(__tr2qs_ctx("SASL method:", "options"), pSASLGroup);
pSASLLayout->addWidget(l, 1, 0);
+ m_pSaslMethodComboBox = new QComboBox(pSASLGroup);
+ m_pSaslMethodComboBox->setDuplicatesEnabled(false);
+ for(auto&& method : KviSASL::supportedMethods())
+ m_pSaslMethodComboBox->addItem(method);
+ KviTalToolTip::add(m_pSaslMethodComboBox, __tr2qs_ctx("Select which SASL method you want to use to authenticate with.<br><br>"
+ "EXTERNAL will fallback to PLAIN if a non-SSL connection is used or no .pem file is loaded.", "options"));
+ pSASLLayout->addWidget(m_pSaslMethodComboBox, 1, 1);
+
+ int index = m_pSaslMethodComboBox->findText(s->saslMethod());
+ if(index != -1)
+ m_pSaslMethodComboBox->setCurrentIndex(index);
+
+ l = new QLabel(__tr2qs_ctx("SASL nickname:", "options"), pSASLGroup);
+ pSASLLayout->addWidget(l, 2, 0);
m_pSaslNickEditor = new QLineEdit(pSASLGroup);
m_pSaslNickEditor->setText(s->saslNick());
- KviTalToolTip::add(m_pSaslNickEditor, __tr2qs_ctx("If you want to enable SASL authentication, insert your nickname here.", "options"));
- pSASLLayout->addWidget(m_pSaslNickEditor, 1, 1);
+ KviTalToolTip::add(m_pSaslNickEditor, __tr2qs_ctx("If you want to enable SASL authentication, insert your nickname here. (Not required for EXTERNAL)", "options"));
+ pSASLLayout->addWidget(m_pSaslNickEditor, 2, 1);
l = new QLabel(__tr2qs_ctx("SASL password:", "options"), pSASLGroup);
- pSASLLayout->addWidget(l, 2, 0);
- m_pSaslPassEditor = new KviPasswordLineEdit(pSASLGroup); // <---- ?????
+ pSASLLayout->addWidget(l, 3, 0);
+ m_pSaslPassEditor = new KviPasswordLineEdit(pSASLGroup);
m_pSaslPassEditor->setText(s->saslPass());
- KviTalToolTip::add(m_pSaslPassEditor, __tr2qs_ctx("If you want to enable SASL authentication, insert your password here.", "options"));
- pSASLLayout->addWidget(m_pSaslPassEditor, 2, 1);
+ KviTalToolTip::add(m_pSaslPassEditor, __tr2qs_ctx("If you want to enable SASL authentication, insert your password here. (Not required for EXTERNAL)", "options"));
+ pSASLLayout->addWidget(m_pSaslPassEditor, 3, 1);
pSASLGroup->setEnabled(s->enabledCAP());
connect(m_pEnableCAPCheck, SIGNAL(toggled(bool)), pSASLGroup, SLOT(setEnabled(bool)));
@@ -1115,10 +1130,11 @@ void IrcServerDetailsWidget::fillData(KviIrcServer * s)
if(m_pEnableSTARTTLSCheck)
s->setEnabledSTARTTLS(m_pEnableSTARTTLSCheck->isChecked());
+ s->setSaslMethod(m_pSaslMethodComboBox->currentText());
s->setSaslNick(m_pSaslNickEditor->text());
s->setSaslPass(m_pSaslPassEditor->text());
if(m_pEnableSASLCheck)
- s->setEnabledSASL(m_pEnableSASLCheck->isChecked() && !m_pSaslNickEditor->text().isEmpty() && !m_pSaslPassEditor->text().isEmpty());
+ s->setEnabledSASL(m_pEnableSASLCheck->isChecked() && ((!m_pSaslNickEditor->text().isEmpty() && !m_pSaslPassEditor->text().isEmpty()) || (m_pSaslMethodComboBox->currentText() == QStringLiteral("EXTERNAL"))));
if(m_pIdEditor)
s->setId(m_pIdEditor->text());
if(s->id().isEmpty())
diff --git a/src/modules/options/OptionsWidget_servers.h b/src/modules/options/OptionsWidget_servers.h
index 5d69bb00f..483a01777 100644
--- a/src/modules/options/OptionsWidget_servers.h
+++ b/src/modules/options/OptionsWidget_servers.h
@@ -154,6 +154,7 @@ protected:
QLineEdit * m_pPortEditor;
QStringList m_lstChannels;
KviChannelListSelector * m_pChannelListSelector;
+ QComboBox * m_pSaslMethodComboBox;
QComboBox * m_pProxyEditor;
protected slots: