Make cleanChannelName a NOOP for IRC (#4154)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Mm2PL 2022-11-16 17:54:59 +01:00 committed by GitHub
parent 991cf6364d
commit 32d077c43b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 9 deletions

View file

@ -83,6 +83,7 @@
- Minor: Add settings tooltips. (#3437) - Minor: Add settings tooltips. (#3437)
- Minor: Add setting to limit message input length. (#3418) - Minor: Add setting to limit message input length. (#3418)
- Minor: Improved look of tabs when using a layout other than top. (#3925, #4152) - 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: 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: Connection to Twitch PubSub now recovers more reliably. (#3643, #3716)
- Bugfix: Fixed `Smooth scrolling on new messages` setting sometimes hiding messages. (#4028) - Bugfix: Fixed `Smooth scrolling on new messages` setting sometimes hiding messages. (#4028)

View file

@ -373,10 +373,8 @@ std::shared_ptr<Channel> AbstractIrcServer::getCustomChannel(
QString AbstractIrcServer::cleanChannelName(const QString &dirtyChannelName) QString AbstractIrcServer::cleanChannelName(const QString &dirtyChannelName)
{ {
if (dirtyChannelName.startsWith('#')) // This function is a Noop only for IRC, for Twitch it removes a leading '#' and lowercases the name
return dirtyChannelName.mid(1); return dirtyChannelName;
else
return dirtyChannelName;
} }
void AbstractIrcServer::addFakeMessage(const QString &data) void AbstractIrcServer::addFakeMessage(const QString &data)

View file

@ -219,8 +219,7 @@ void IrcServer::readConnectionMessageReceived(Communi::IrcMessage *message)
case Communi::IrcMessage::Join: { case Communi::IrcMessage::Join: {
auto x = static_cast<Communi::IrcJoinMessage *>(message); auto x = static_cast<Communi::IrcJoinMessage *>(message);
if (auto it = if (auto it = this->channels.find(x->channel());
this->channels.find(this->cleanChannelName(x->channel()));
it != this->channels.end()) it != this->channels.end())
{ {
if (auto shared = it->lock()) if (auto shared = it->lock())
@ -243,8 +242,7 @@ void IrcServer::readConnectionMessageReceived(Communi::IrcMessage *message)
case Communi::IrcMessage::Part: { case Communi::IrcMessage::Part: {
auto x = static_cast<Communi::IrcPartMessage *>(message); auto x = static_cast<Communi::IrcPartMessage *>(message);
if (auto it = if (auto it = this->channels.find(x->channel());
this->channels.find(this->cleanChannelName(x->channel()));
it != this->channels.end()) it != this->channels.end())
{ {
if (auto shared = it->lock()) if (auto shared = it->lock())

View file

@ -207,7 +207,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
outerBox->addRow("Server:", view); 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()); auto tab = notebook->addPage(obj.getElement());
tab->setCustomTitle("Irc (Beta)"); tab->setCustomTitle("Irc (Beta)");