mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
parent
dd0d6a0f88
commit
115031b7ac
|
@ -150,6 +150,20 @@ void Channel::addOrReplaceTimeout(messages::MessagePtr message)
|
||||||
// WindowManager::getInstance().repaintVisibleChatWidgets(this);
|
// WindowManager::getInstance().repaintVisibleChatWidgets(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Channel::disableAllMessages()
|
||||||
|
{
|
||||||
|
LimitedQueueSnapshot<MessagePtr> snapshot = this->getMessageSnapshot();
|
||||||
|
int snapshotLength = snapshot.getLength();
|
||||||
|
for (int i = 0; i < snapshotLength; i++) {
|
||||||
|
auto &s = snapshot[i];
|
||||||
|
if (s->flags & Message::System || s->flags & Message::Timeout) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
s->flags.EnableFlag(Message::Disabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Channel::addMessagesAtStart(std::vector<messages::MessagePtr> &_messages)
|
void Channel::addMessagesAtStart(std::vector<messages::MessagePtr> &_messages)
|
||||||
{
|
{
|
||||||
std::vector<messages::MessagePtr> addedMessages = this->messages.pushFront(_messages);
|
std::vector<messages::MessagePtr> addedMessages = this->messages.pushFront(_messages);
|
||||||
|
|
|
@ -51,6 +51,7 @@ public:
|
||||||
void addMessage(messages::MessagePtr message);
|
void addMessage(messages::MessagePtr message);
|
||||||
void addMessagesAtStart(std::vector<messages::MessagePtr> &messages);
|
void addMessagesAtStart(std::vector<messages::MessagePtr> &messages);
|
||||||
void addOrReplaceTimeout(messages::MessagePtr message);
|
void addOrReplaceTimeout(messages::MessagePtr message);
|
||||||
|
void disableAllMessages();
|
||||||
void replaceMessage(messages::MessagePtr message, messages::MessagePtr replacement);
|
void replaceMessage(messages::MessagePtr message, messages::MessagePtr replacement);
|
||||||
virtual void addRecentChatter(const std::shared_ptr<messages::Message> &message);
|
virtual void addRecentChatter(const std::shared_ptr<messages::Message> &message);
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,7 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message)
|
||||||
|
|
||||||
// check if the chat has been cleared by a moderator
|
// check if the chat has been cleared by a moderator
|
||||||
if (message->parameters().length() == 1) {
|
if (message->parameters().length() == 1) {
|
||||||
|
chan->disableAllMessages();
|
||||||
chan->addMessage(Message::createSystemMessage("Chat has been cleared by a moderator."));
|
chan->addMessage(Message::createSystemMessage("Chat has been cleared by a moderator."));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue