mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Added a "CleanChannelName" virtual method to AbstractIrcServer
the TwitchServer implementation makes the channelName full lowercase Fixes #293
This commit is contained in:
parent
8e7d89dd40
commit
dca11406b9
|
@ -95,8 +95,10 @@ void AbstractIrcServer::writeConnectionMessageReceived(Communi::IrcMessage *mess
|
|||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<Channel> AbstractIrcServer::addChannel(const QString &channelName)
|
||||
std::shared_ptr<Channel> AbstractIrcServer::addChannel(const QString &dirtyChannelName)
|
||||
{
|
||||
auto channelName = this->CleanChannelName(dirtyChannelName);
|
||||
|
||||
// try get channel
|
||||
ChannelPtr chan = this->getChannel(channelName);
|
||||
if (chan != Channel::getEmpty()) {
|
||||
|
@ -137,8 +139,10 @@ std::shared_ptr<Channel> AbstractIrcServer::addChannel(const QString &channelNam
|
|||
return chan;
|
||||
}
|
||||
|
||||
std::shared_ptr<Channel> AbstractIrcServer::getChannel(const QString &channelName)
|
||||
std::shared_ptr<Channel> AbstractIrcServer::getChannel(const QString &dirtyChannelName)
|
||||
{
|
||||
auto channelName = this->CleanChannelName(dirtyChannelName);
|
||||
|
||||
std::lock_guard<std::mutex> lock(this->channelMutex);
|
||||
|
||||
// try get special channel
|
||||
|
@ -210,6 +214,11 @@ std::shared_ptr<Channel> AbstractIrcServer::getCustomChannel(const QString &chan
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
QString AbstractIrcServer::CleanChannelName(const QString &dirtyChannelName)
|
||||
{
|
||||
return dirtyChannelName;
|
||||
}
|
||||
|
||||
void AbstractIrcServer::addFakeMessage(const QString &data)
|
||||
{
|
||||
auto fakeMessage = Communi::IrcMessage::fromData(data.toUtf8(), this->readConnection.get());
|
||||
|
|
|
@ -22,8 +22,8 @@ public:
|
|||
void sendMessage(const QString &channelName, const QString &message);
|
||||
|
||||
// channels
|
||||
std::shared_ptr<Channel> addChannel(const QString &channelName);
|
||||
std::shared_ptr<Channel> getChannel(const QString &channelName);
|
||||
std::shared_ptr<Channel> addChannel(const QString &dirtyChannelName);
|
||||
std::shared_ptr<Channel> getChannel(const QString &dirtyChannelName);
|
||||
|
||||
// signals
|
||||
pajlada::Signals::NoArgSignal connected;
|
||||
|
@ -51,6 +51,8 @@ protected:
|
|||
|
||||
virtual std::shared_ptr<Channel> getCustomChannel(const QString &channelName);
|
||||
|
||||
virtual QString CleanChannelName(const QString &dirtyChannelName);
|
||||
|
||||
QMap<QString, std::weak_ptr<Channel>> channels;
|
||||
std::mutex channelMutex;
|
||||
|
||||
|
|
|
@ -168,6 +168,11 @@ void TwitchServer::forEachChannelAndSpecialChannels(std::function<void(ChannelPt
|
|||
func(this->mentionsChannel);
|
||||
}
|
||||
|
||||
QString TwitchServer::CleanChannelName(const QString &dirtyChannelName)
|
||||
{
|
||||
return dirtyChannelName.toLower();
|
||||
}
|
||||
|
||||
} // namespace twitch
|
||||
} // namespace providers
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -33,6 +33,8 @@ protected:
|
|||
virtual void writeConnectionMessageReceived(Communi::IrcMessage *message) override;
|
||||
|
||||
virtual std::shared_ptr<Channel> getCustomChannel(const QString &channelname) override;
|
||||
|
||||
QString CleanChannelName(const QString &dirtyChannelName) override;
|
||||
};
|
||||
|
||||
} // namespace twitch
|
||||
|
|
Loading…
Reference in a new issue