feat: dynamically track mutability of messages (#6367)
This commit is contained in:
@@ -107,6 +107,7 @@ QJsonObject Message::toJson() const
|
||||
{"count"_L1, static_cast<qint64>(this->count)},
|
||||
{"serverReceivedTime"_L1,
|
||||
this->serverReceivedTime.toString(Qt::ISODate)},
|
||||
{"frozen"_L1, this->frozen},
|
||||
};
|
||||
|
||||
QJsonArray badges;
|
||||
|
||||
@@ -86,6 +86,16 @@ struct Message {
|
||||
};
|
||||
ReplyStatus isReplyable() const;
|
||||
uint32_t count = 1;
|
||||
|
||||
/// Can this message be modified?
|
||||
///
|
||||
/// Our rendering and layout code expects messages to be mostly immutable.
|
||||
/// Thus, when this flag is set, this message may not be modified.
|
||||
/// Only flags and this member can be modified safely (from the GUI thread).
|
||||
/// This is only used for plugins right now. This value is only ever set to
|
||||
/// true.
|
||||
mutable bool frozen = false;
|
||||
|
||||
std::vector<std::unique_ptr<MessageElement>> elements;
|
||||
|
||||
ScrollbarHighlight getScrollBarHighlight() const;
|
||||
@@ -93,6 +103,11 @@ struct Message {
|
||||
std::shared_ptr<ChannelPointReward> reward = nullptr;
|
||||
|
||||
QJsonObject toJson() const;
|
||||
|
||||
void freeze() const
|
||||
{
|
||||
this->frozen = true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user