From 87bfbefebab8bf25cfcbfd0b4935d8e6822f4508 Mon Sep 17 00:00:00 2001
From: Fabio Bas
Date: Sat, 13 Feb 2010 11:21:16 +0000
Subject: server config: changed "supportsSTARTTLS" to "enabledSTARTTLS" and
enabled by default; this option is now meaningful only as a way to force
STARTTLS disabled on a server that supports it; server config: added
"enabledSASL", "SaslNick", "SaslPass" options main config: added global
"enable SASL" option sparser: handle CAP LS, REQ, ACK, NAK, END
ircconnection: added SASL support (only PLAIN method is supported by now)
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3958 17fca916-40b9-46aa-a4ea-0a15b648b75c
---
src/modules/options/optw_connection.cpp | 6 +++-
src/modules/options/optw_servers.cpp | 49 +++++++++++++++++++++++++--------
src/modules/options/optw_servers.h | 5 +++-
3 files changed, 46 insertions(+), 14 deletions(-)
(limited to 'src/modules/options')
diff --git a/src/modules/options/optw_connection.cpp b/src/modules/options/optw_connection.cpp
index 41779fabf..8b09172cc 100644
--- a/src/modules/options/optw_connection.cpp
+++ b/src/modules/options/optw_connection.cpp
@@ -86,7 +86,11 @@ KviConnectionOptionsWidget::KviConnectionOptionsWidget(QWidget * parent)
connect(b,SIGNAL(toggled(bool)),u,SLOT(setEnabled(bool)));
mergeTip(u,__tr2qs_ctx("
Minimum value: 0 sec
Maximum value: 86400 sec","options"));
- addRowSpacer(0,2,4,2);
+ b = addBoolSelector(this,__tr2qs_ctx("Use the SASL authentication protocol if available","options"),&(KVI_OPTION_BOOL(KviOption_boolUseSaslIfAvailable)),true);
+ mergeTip(b,__tr2qs_ctx("When available and enabled of the specific server, KVIrc will try to authenticate the user using the SASL procotol","options"));
+ addWidgetToLayout(b,0,2,0,2);
+
+ addRowSpacer(0,3,4,3);
}
KviConnectionOptionsWidget::~KviConnectionOptionsWidget()
diff --git a/src/modules/options/optw_servers.cpp b/src/modules/options/optw_servers.cpp
index 3f2fdebac..c1c49ff26 100644
--- a/src/modules/options/optw_servers.cpp
+++ b/src/modules/options/optw_servers.cpp
@@ -585,8 +585,6 @@ KviServerDetailsWidget::KviServerDetailsWidget(QWidget * par,KviServer * s)
KviTalToolTip::add(m_pPortEditor,__tr2qs_ctx("This is the default port that this server will be contacted on.
Usually 6667 is OK.","options"));
connect(m_pPortEditor,SIGNAL(textChanged(const QString &)),this,SLOT(portEditorTextChanged(const QString &)));
-
-
l = new QLabel(__tr2qs_ctx("IP address:","options"),tab);
gl->addWidget(l,1,0);
m_pIpEditor = new KviIpEditor(tab,KviIpEditor::IPv4);
@@ -644,14 +642,14 @@ KviServerDetailsWidget::KviServerDetailsWidget(QWidget * par,KviServer * s)
#endif
m_pUseSSLCheck->setChecked(s->useSSL());
- m_pSupportsSTARTTLSCheck = new QCheckBox(__tr2qs_ctx("Supports STARTTLS protocol","options"),tab);
- gl->addWidget(m_pSupportsSTARTTLSCheck,5,0,1,2);
- KviTalToolTip::add(m_pSupportsSTARTTLSCheck,__tr2qs_ctx("This check marks the server as dynamically supporting the Transport Layer Security " \
- "protocol. If you enable the proper global option in the Connection/SSL tab, the TLS protocol will be used for this server.","options"));
+ m_pEnableSTARTTLSCheck = new QCheckBox(__tr2qs_ctx("Enable STARTTLS protocol","options"),tab);
+ gl->addWidget(m_pEnableSTARTTLSCheck,5,0,1,2);
+ KviTalToolTip::add(m_pEnableSTARTTLSCheck,__tr2qs_ctx("This check enables the use of the Transport Layer Security " \
+ "protocol. If you enable the proper global option in the Connection/SSL tab, the TLS protocol will be used for this server if available.","options"));
#ifndef COMPILE_SSL_SUPPORT
- m_pSupportsSTARTTLSCheck->setEnabled(false);
+ m_pEnableSTARTTLSCheck->setEnabled(false);
#endif
- m_pSupportsSTARTTLSCheck->setChecked(s->supportsSTARTTLS());
+ m_pEnableSTARTTLSCheck->setChecked(s->enabledSTARTTLS());
m_pUseAutoConnect = new QCheckBox(__tr2qs_ctx("Connect to this server at startup","options"),tab);
m_pUseAutoConnect->setChecked(s->autoConnect());
@@ -772,11 +770,30 @@ KviServerDetailsWidget::KviServerDetailsWidget(QWidget * par,KviServer * s)
if(m_pProxyEditor->count() > (s->proxy()+2))
m_pProxyEditor->setCurrentIndex(s->proxy()+2);
+ m_pEnableSASLCheck = new QCheckBox(__tr2qs_ctx("Enable SASL authentication","options"),tab);
+ gl->addWidget(m_pEnableSASLCheck,12,0,1,2);
+ KviTalToolTip::add(m_pEnableSASLCheck,__tr2qs_ctx("This check enables the use of the SASL authentication procotol" \
+ "If you enable the proper global option in the Connection/SSL tab and fill the Sasl Nickname and Sasl Password fields in this page, the SASL protocol will be used for this server if available.","options"));
+ m_pEnableSASLCheck->setChecked(s->enabledSASL());
+
+ l = new QLabel(__tr2qs_ctx("Sasl Nickname:","options"),tab);
+ gl->addWidget(l,13,0);
+ m_pSaslNickEditor = new QLineEdit(tab);
+ m_pSaslNickEditor->setText(s->saslNick());
+ KviTalToolTip::add(m_pSaslNickEditor,__tr2qs_ctx("If you want to enable SASL authentication, insert your nickname here.","options"));
+ gl->addWidget(m_pSaslNickEditor,13,1);
+
+ l = new QLabel(__tr2qs_ctx("Sasl Password:","options"),tab);
+ gl->addWidget(l,14,0);
+ m_pSaslPassEditor = new KviPasswordLineEdit(tab);
+ m_pSaslPassEditor->setText(s->saslPass());
+ KviTalToolTip::add(m_pSaslPassEditor,__tr2qs_ctx("If you want to enable SASL authentication, insert your password here.","options"));
+ gl->addWidget(m_pSaslPassEditor,14,1);
l = new QLabel("",tab);
- gl->addWidget(l,12,0,1,2);
+ gl->addWidget(l,15,0,1,2);
- gl->setRowStretch(12,1);
+ gl->setRowStretch(15,1);
tw->addTab(tab,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_SOCKETWARNING)),__tr2qs_ctx("Connection","options"));
@@ -925,8 +942,16 @@ void KviServerDetailsWidget::fillData(KviServer * s)
s->setCacheIp(m_pCacheIpCheck->isChecked());
if(m_pUseSSLCheck)
s->setUseSSL(m_pUseSSLCheck->isChecked());
- if(m_pSupportsSTARTTLSCheck)
- s->setSupportsSTARTTLS(m_pSupportsSTARTTLSCheck->isChecked());
+ if(m_pEnableSTARTTLSCheck)
+ s->setEnabledSTARTTLS(m_pEnableSTARTTLSCheck->isChecked());
+
+ s->setSaslNick(m_pSaslNickEditor->text());
+ s->setSaslPass(m_pSaslPassEditor->text());
+ s->setEnabledSASL( m_pEnableSASLCheck->isChecked() &&
+ !m_pSaslNickEditor->text().isEmpty() &&
+ !m_pSaslPassEditor->text().isEmpty()
+ );
+
if(m_pIdEditor)
s->setId(m_pIdEditor->text());
if(s->id().isEmpty())s->generateUniqueId();
diff --git a/src/modules/options/optw_servers.h b/src/modules/options/optw_servers.h
index 9ba0046d4..5b14e8f22 100644
--- a/src/modules/options/optw_servers.h
+++ b/src/modules/options/optw_servers.h
@@ -115,7 +115,9 @@ protected:
KviScriptEditor * m_pOnLoginEditor;
QLineEdit * m_pUserEditor;
KviPasswordLineEdit * m_pPassEditor;
+ KviPasswordLineEdit * m_pSaslPassEditor;
QLineEdit * m_pNickEditor;
+ QLineEdit * m_pSaslNickEditor;
QLineEdit * m_pRealEditor;
QLineEdit * m_pDescEditor;
QLineEdit * m_pIdEditor;
@@ -125,7 +127,8 @@ protected:
KviIpEditor * m_pIpEditor;
QCheckBox * m_pCacheIpCheck;
QCheckBox * m_pUseSSLCheck;
- QCheckBox * m_pSupportsSTARTTLSCheck;
+ QCheckBox * m_pEnableSTARTTLSCheck;
+ QCheckBox * m_pEnableSASLCheck;
QCheckBox * m_pUseDefaultInitUMode;
QCheckBox * m_pIMode;
QCheckBox * m_pWMode;
--
cgit v1.3.1-10-gc9f91