Fixes the previous "Disabled message" behaviour

Fixes #295
This commit is contained in:
Rasmus Karlsson 2018-03-31 11:32:29 +02:00
parent 2d15716b5f
commit d3212b0a59
3 changed files with 7 additions and 4 deletions

View file

@ -152,7 +152,7 @@ void MessageLayout::paint(QPainter &painter, int y, int messageIndex, Selection
// painter.drawPixmap(0, y, this->container.width, this->container.getHeight(), *pixmap); // painter.drawPixmap(0, y, this->container.width, this->container.getHeight(), *pixmap);
// draw disabled // draw disabled
if (this->message->flags & Message::Disabled) { if (this->message->flags.HasFlag(Message::Disabled)) {
painter.fillRect(0, y, pixmap->width(), pixmap->height(), themeManager.messages.disabled); painter.fillRect(0, y, pixmap->width(), pixmap->height(), themeManager.messages.disabled);
} }

View file

@ -12,6 +12,7 @@
namespace chatterino { namespace chatterino {
namespace messages { namespace messages {
struct Message { struct Message {
enum MessageFlags : uint16_t { enum MessageFlags : uint16_t {
None = 0, None = 0,
@ -53,6 +54,7 @@ public:
const QString &reason, bool multipleTimes); const QString &reason, bool multipleTimes);
}; };
typedef std::shared_ptr<Message> MessagePtr; using MessagePtr = std::shared_ptr<Message>;
} // namespace messages } // namespace messages
} // namespace chatterino } // namespace chatterino

View file

@ -119,8 +119,9 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message)
// disable the messages from the user // disable the messages from the user
for (int i = 0; i < snapshotLength; i++) { for (int i = 0; i < snapshotLength; i++) {
if (!(snapshot[i]->flags & Message::Timeout) && snapshot[i]->loginName == username) { auto &s = snapshot[i];
snapshot[i]->flags &= Message::Disabled; if (!(s->flags & Message::Timeout) && s->loginName == username) {
s->flags.EnableFlag(Message::Disabled);
} }
} }