Add a setting for the timeout stack style:
"Stack" is the default behaviour, it will search 20 messages up and 5 seconds back in time to stack the timeout. "Stack sparingly" will try to do the same, but only if the user has not typed a message inbetween the this and the last timeout. Fixes #1157
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "singletons/Emotes.hpp"
|
||||
#include "singletons/Logging.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
|
||||
#include <QJsonArray>
|
||||
@@ -102,6 +103,9 @@ void Channel::addOrReplaceTimeout(MessagePtr message)
|
||||
|
||||
QTime minimumTime = QTime::currentTime().addSecs(-5);
|
||||
|
||||
auto timeoutStackStyle = static_cast<TimeoutStackStyle>(
|
||||
getSettings()->timeoutStackStyle.getValue());
|
||||
|
||||
for (int i = snapshotLength - 1; i >= end; --i)
|
||||
{
|
||||
auto &s = snapshot[i];
|
||||
@@ -117,6 +121,16 @@ void Channel::addOrReplaceTimeout(MessagePtr message)
|
||||
break;
|
||||
}
|
||||
|
||||
if (timeoutStackStyle == TimeoutStackStyle::DontStackBeyondUserMessage)
|
||||
{
|
||||
if (s->loginName == message->timeoutUser &&
|
||||
s->flags.hasNone({MessageFlag::Disabled, MessageFlag::Timeout,
|
||||
MessageFlag::Untimeout}))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (s->flags.has(MessageFlag::Timeout) &&
|
||||
s->timeoutUser == message->timeoutUser) //
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user