mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
parent
be66338fe2
commit
fdea4f32f0
|
@ -31,7 +31,7 @@ MessagePtr Message::createSystemMessage(const QString &text)
|
|||
|
||||
message->addElement(new TimestampElement(QTime::currentTime()));
|
||||
message->addElement(new TextElement(text, MessageElement::Text, MessageColor::System));
|
||||
message->flags |= MessageFlags::System;
|
||||
message->flags.EnableFlag(MessageFlags::System);
|
||||
message->searchText = text;
|
||||
|
||||
return message;
|
||||
|
@ -72,7 +72,8 @@ MessagePtr Message::createTimeoutMessage(const QString &username, const QString
|
|||
}
|
||||
|
||||
MessagePtr message = Message::createSystemMessage(text);
|
||||
message->flags |= MessageFlags::System;
|
||||
message->flags.EnableFlag(MessageFlags::System);
|
||||
message->flags.EnableFlag(MessageFlags::Timeout);
|
||||
message->timeoutUser = username;
|
||||
return message;
|
||||
}
|
||||
|
|
|
@ -104,10 +104,11 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message)
|
|||
int snapshotLength = snapshot.getLength();
|
||||
|
||||
for (int i = std::max(0, snapshotLength - 20); i < snapshotLength; i++) {
|
||||
if (snapshot[i]->flags & Message::Timeout && snapshot[i]->loginName == username) {
|
||||
auto &s = snapshot[i];
|
||||
if (s->flags.HasFlag(Message::Timeout) && s->timeoutUser == username) {
|
||||
MessagePtr replacement(
|
||||
Message::createTimeoutMessage(username, durationInSeconds, reason, true));
|
||||
chan->replaceMessage(snapshot[i], replacement);
|
||||
chan->replaceMessage(s, replacement);
|
||||
addMessage = false;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue