From 32d077c43b5b263da9d6f45668d259eb6212cb2f Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Wed, 16 Nov 2022 17:54:59 +0100 Subject: [PATCH] Make cleanChannelName a NOOP for IRC (#4154) Co-authored-by: pajlada --- CHANGELOG.md | 1 + src/providers/irc/AbstractIrcServer.cpp | 6 ++---- src/providers/irc/IrcServer.cpp | 6 ++---- src/widgets/dialogs/SelectChannelDialog.cpp | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9dadb2c7..4174e7ad4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,6 +83,7 @@ - Minor: Add settings tooltips. (#3437) - Minor: Add setting to limit message input length. (#3418) - Minor: Improved look of tabs when using a layout other than top. (#3925, #4152) +- Bugfix: Fixed channels with two leading `#`s not being usable on IRC (#4154) - Bugfix: Fixed `Add new account` dialog causing main chatterino window to be non movable. (#4121) - Bugfix: Connection to Twitch PubSub now recovers more reliably. (#3643, #3716) - Bugfix: Fixed `Smooth scrolling on new messages` setting sometimes hiding messages. (#4028) diff --git a/src/providers/irc/AbstractIrcServer.cpp b/src/providers/irc/AbstractIrcServer.cpp index 91f4decee..24c663fbd 100644 --- a/src/providers/irc/AbstractIrcServer.cpp +++ b/src/providers/irc/AbstractIrcServer.cpp @@ -373,10 +373,8 @@ std::shared_ptr AbstractIrcServer::getCustomChannel( QString AbstractIrcServer::cleanChannelName(const QString &dirtyChannelName) { - if (dirtyChannelName.startsWith('#')) - return dirtyChannelName.mid(1); - else - return dirtyChannelName; + // This function is a Noop only for IRC, for Twitch it removes a leading '#' and lowercases the name + return dirtyChannelName; } void AbstractIrcServer::addFakeMessage(const QString &data) diff --git a/src/providers/irc/IrcServer.cpp b/src/providers/irc/IrcServer.cpp index a6fc8efde..e148e5b09 100644 --- a/src/providers/irc/IrcServer.cpp +++ b/src/providers/irc/IrcServer.cpp @@ -219,8 +219,7 @@ void IrcServer::readConnectionMessageReceived(Communi::IrcMessage *message) case Communi::IrcMessage::Join: { auto x = static_cast(message); - if (auto it = - this->channels.find(this->cleanChannelName(x->channel())); + if (auto it = this->channels.find(x->channel()); it != this->channels.end()) { if (auto shared = it->lock()) @@ -243,8 +242,7 @@ void IrcServer::readConnectionMessageReceived(Communi::IrcMessage *message) case Communi::IrcMessage::Part: { auto x = static_cast(message); - if (auto it = - this->channels.find(this->cleanChannelName(x->channel())); + if (auto it = this->channels.find(x->channel()); it != this->channels.end()) { if (auto shared = it->lock()) diff --git a/src/widgets/dialogs/SelectChannelDialog.cpp b/src/widgets/dialogs/SelectChannelDialog.cpp index 93fb66fe8..c83ea83e0 100644 --- a/src/widgets/dialogs/SelectChannelDialog.cpp +++ b/src/widgets/dialogs/SelectChannelDialog.cpp @@ -207,7 +207,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent) outerBox->addRow("Server:", view); } - outerBox->addRow("Channel:", this->ui_.irc.channel = new QLineEdit); + outerBox->addRow("Channel: #", this->ui_.irc.channel = new QLineEdit); auto tab = notebook->addPage(obj.getElement()); tab->setCustomTitle("Irc (Beta)");