From ca0db97d09e5b60b7b43765cd906d772a143e5b5 Mon Sep 17 00:00:00 2001 From: fourtf Date: Sun, 22 Sep 2019 17:12:09 +0200 Subject: [PATCH] ammend 2.1.5 added setting for experimental irc support --- src/providers/irc/IrcServer.cpp | 41 +++++++++++---------- src/singletons/Settings.hpp | 1 + src/widgets/dialogs/SelectChannelDialog.cpp | 15 +++++--- src/widgets/settingspages/GeneralPage.cpp | 4 +- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/src/providers/irc/IrcServer.cpp b/src/providers/irc/IrcServer.cpp index e9a655a97..58400b82a 100644 --- a/src/providers/irc/IrcServer.cpp +++ b/src/providers/irc/IrcServer.cpp @@ -66,29 +66,30 @@ void IrcServer::initializeConnection(IrcConnection *connection, connection->setRealName(this->data_->real.isEmpty() ? this->data_->user : this->data_->nick); -#if 0 - switch (this->data_->authType) + if (getSettings()->enableExperimentalIrc) { - case IrcAuthType::Sasl: - connection->setSaslMechanism("PLAIN"); - [[fallthrough]]; - case IrcAuthType::Pass: - this->data_->getPassword( - this, [conn = new QObjectRef(connection) /* can't copy */, - this](const QString &password) mutable { - if (*conn) - { - (*conn)->setPassword(password); - this->open(Both); - } + switch (this->data_->authType) + { + case IrcAuthType::Sasl: + connection->setSaslMechanism("PLAIN"); + [[fallthrough]]; + case IrcAuthType::Pass: + this->data_->getPassword( + this, [conn = new QObjectRef(connection) /* can't copy */, + this](const QString &password) mutable { + if (*conn) + { + (*conn)->setPassword(password); + this->open(Both); + } - delete conn; - }); - break; - default: - this->open(Both); + delete conn; + }); + break; + default: + this->open(Both); + } } -#endif QObject::connect( connection, &Communi::IrcConnection::socketError, this, diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index 76d645c35..79b3430ea 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -203,6 +203,7 @@ public: #ifdef Q_OS_LINUX BoolSetting useKeyring = {"/misc/useKeyring", true}; #endif + BoolSetting enableExperimentalIrc = {"/misc/experimentalIrc", false}; IntSetting startUpNotification = {"/misc/startUpNotification", 0}; QStringSetting currentVersion = {"/misc/currentVersion", ""}; diff --git a/src/widgets/dialogs/SelectChannelDialog.cpp b/src/widgets/dialogs/SelectChannelDialog.cpp index 0dff949cf..d6470c489 100644 --- a/src/widgets/dialogs/SelectChannelDialog.cpp +++ b/src/widgets/dialogs/SelectChannelDialog.cpp @@ -190,8 +190,12 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent) auto tab = notebook->addPage(obj.getElement()); tab->setCustomTitle("Irc (Beta)"); - tab->setEnable(false); - tab->setVisible(false); + + if (!getSettings()->enableExperimentalIrc) + { + tab->setEnable(false); + tab->setVisible(false); + } } layout->setStretchFactor(notebook.getElement(), 1); @@ -220,9 +224,10 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent) // restore ui state // fourtf: enable when releasing irc -#if 0 - this->ui_.notebook->selectIndex(getSettings()->lastSelectChannelTab); -#endif + if (getSettings()->enableExperimentalIrc) + { + this->ui_.notebook->selectIndex(getSettings()->lastSelectChannelTab); + } this->ui_.irc.servers->getTableView()->selectRow( getSettings()->lastSelectIrcConn); diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 101883851..2a3f5a603 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -497,7 +497,9 @@ void GeneralPage::initLayout(SettingsLayout &layout) layout.addCheckbox("Load message history on connect", s.loadTwitchMessageHistoryOnConnect); - layout.addCheckbox("Show unhandled irc messages", + layout.addCheckbox("Enable experimental IRC support (requires restart)", + s.enableExperimentalIrc); + layout.addCheckbox("Show unhandled IRC messages", s.showUnhandledIrcMessages); layout.addTitle("Cache");