mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
We now handle irc NOTICE messages
This commit is contained in:
parent
6d56148ed2
commit
d905e88671
|
@ -242,6 +242,8 @@ void IrcManager::messageReceived(Communi::IrcMessage *message)
|
|||
this->handleUserNoticeMessage(message);
|
||||
} else if (command == "MODE") {
|
||||
this->handleModeMessage(message);
|
||||
} else if (command == "NOTICE") {
|
||||
this->handleNoticeMessage(static_cast<Communi::IrcNoticeMessage *>(message));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -417,6 +419,27 @@ void IrcManager::removeIgnoredUser(QString const &username)
|
|||
}
|
||||
}
|
||||
|
||||
void IrcManager::handleNoticeMessage(Communi::IrcNoticeMessage *message)
|
||||
{
|
||||
auto rawChannelName = message->target();
|
||||
|
||||
assert(rawChannelName.length() >= 2);
|
||||
|
||||
auto trimmedChannelName = rawChannelName.mid(1);
|
||||
|
||||
auto c = this->channelManager.getTwitchChannel(trimmedChannelName);
|
||||
|
||||
if (!c) {
|
||||
debug::Log("[IrcManager:handleNoticeMessage] Channel {} not found in channel manager",
|
||||
trimmedChannelName);
|
||||
return;
|
||||
}
|
||||
|
||||
std::shared_ptr<Message> msg(Message::createSystemMessage(message->content()));
|
||||
|
||||
c->addMessage(msg);
|
||||
}
|
||||
|
||||
void IrcManager::onConnected()
|
||||
{
|
||||
std::shared_ptr<Message> msg(Message::createSystemMessage("connected to chat"));
|
||||
|
|
|
@ -85,6 +85,7 @@ private:
|
|||
void handleWhisperMessage(Communi::IrcMessage *message);
|
||||
void handleUserNoticeMessage(Communi::IrcMessage *message);
|
||||
void handleModeMessage(Communi::IrcMessage *message);
|
||||
void handleNoticeMessage(Communi::IrcNoticeMessage *message);
|
||||
|
||||
void onConnected();
|
||||
void onDisconnected();
|
||||
|
|
Loading…
Reference in a new issue