Merge pull request #979 from hemirt/whispers

do not disable whispers on clears and timeouts
This commit is contained in:
pajlada 2019-04-16 15:06:42 +02:00 committed by GitHub
commit 97faec15e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 7 deletions

View file

@ -154,8 +154,9 @@ void Channel::addOrReplaceTimeout(MessagePtr message)
for (int i = 0; i < snapshotLength; i++) for (int i = 0; i < snapshotLength; i++)
{ {
auto &s = snapshot[i]; auto &s = snapshot[i];
if (s->flags.hasNone({MessageFlag::Timeout, MessageFlag::Untimeout}) && if (s->loginName == message->timeoutUser &&
s->loginName == message->timeoutUser) s->flags.hasNone({MessageFlag::Timeout, MessageFlag::Untimeout,
MessageFlag::Whisper}))
{ {
// FOURTF: disabled for now // FOURTF: disabled for now
// PAJLADA: Shitty solution described in Message.hpp // PAJLADA: Shitty solution described in Message.hpp
@ -179,7 +180,8 @@ void Channel::disableAllMessages()
for (int i = 0; i < snapshotLength; i++) for (int i = 0; i < snapshotLength; i++)
{ {
auto &message = snapshot[i]; auto &message = snapshot[i];
if (message->flags.hasAny({MessageFlag::System, MessageFlag::Timeout})) if (message->flags.hasAny({MessageFlag::System, MessageFlag::Timeout,
MessageFlag::Whisper}))
{ {
continue; continue;
} }

View file

@ -15,7 +15,7 @@ namespace chatterino {
struct Message; struct Message;
using MessagePtr = std::shared_ptr<const Message>; using MessagePtr = std::shared_ptr<const Message>;
enum class MessageFlag : uint16_t; enum class MessageFlag : uint32_t;
using MessageFlags = FlagsEnum<MessageFlag>; using MessageFlags = FlagsEnum<MessageFlag>;
class Channel : public std::enable_shared_from_this<Channel> class Channel : public std::enable_shared_from_this<Channel>

View file

@ -208,6 +208,7 @@ QString CommandController::execCommand(const QString &textNoEmoji,
} }
b->flags.set(MessageFlag::DoNotTriggerNotification); b->flags.set(MessageFlag::DoNotTriggerNotification);
b->flags.set(MessageFlag::Whisper);
auto messagexD = b.release(); auto messagexD = b.release();
app->twitch.server->whispersChannel->addMessage(messagexD); app->twitch.server->whispersChannel->addMessage(messagexD);

View file

@ -12,7 +12,7 @@
namespace chatterino { namespace chatterino {
class MessageElement; class MessageElement;
enum class MessageFlag : uint16_t { enum class MessageFlag : uint32_t {
None = 0, None = 0,
System = (1 << 0), System = (1 << 0),
Timeout = (1 << 1), Timeout = (1 << 1),
@ -30,6 +30,7 @@ enum class MessageFlag : uint16_t {
DoNotLog = (1 << 13), DoNotLog = (1 << 13),
AutoMod = (1 << 14), AutoMod = (1 << 14),
RecentMessage = (1 << 15), RecentMessage = (1 << 15),
Whisper = (1 << 16)
}; };
using MessageFlags = FlagsEnum<MessageFlag>; using MessageFlags = FlagsEnum<MessageFlag>;

View file

@ -14,7 +14,7 @@ class QPainter;
namespace chatterino { namespace chatterino {
enum class MessageFlag : uint16_t; enum class MessageFlag : uint32_t;
using MessageFlags = FlagsEnum<MessageFlag>; using MessageFlags = FlagsEnum<MessageFlag>;
struct Margin { struct Margin {

View file

@ -321,6 +321,7 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message)
if (!builder.isIgnored()) if (!builder.isIgnored())
{ {
builder->flags.set(MessageFlag::Whisper);
MessagePtr _message = builder.build(); MessagePtr _message = builder.build();
app->twitch.server->lastUserThatWhisperedMe.set(builder.userName); app->twitch.server->lastUserThatWhisperedMe.set(builder.userName);

View file

@ -25,7 +25,7 @@ using ChannelPtr = std::shared_ptr<Channel>;
struct Message; struct Message;
using MessagePtr = std::shared_ptr<const Message>; using MessagePtr = std::shared_ptr<const Message>;
enum class MessageFlag : uint16_t; enum class MessageFlag : uint32_t;
using MessageFlags = FlagsEnum<MessageFlag>; using MessageFlags = FlagsEnum<MessageFlag>;
class MessageLayout; class MessageLayout;