diff options
Diffstat (limited to 'components')
-rw-r--r-- | components/chatwindow.cpp | 6 | ||||
-rw-r--r-- | components/chatwindow.hpp | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/components/chatwindow.cpp b/components/chatwindow.cpp index 23631dd..539d6b6 100644 --- a/components/chatwindow.cpp +++ b/components/chatwindow.cpp @@ -116,6 +116,12 @@ void ChatWindow::AddNewMessage(Snowflake id) { m_new_message_dispatch.emit(); } +void ChatWindow::ClearMessages() { + std::scoped_lock<std::mutex> guard(m_update_mutex); + m_message_set_queue.push(std::unordered_set<const MessageData *>()); + m_message_set_dispatch.emit(); +} + void ChatWindow::ScrollToBottom() { auto x = m_scroll->get_vadjustment(); x->set_value(x->get_upper()); diff --git a/components/chatwindow.hpp b/components/chatwindow.hpp index fb2abec..d8de505 100644 --- a/components/chatwindow.hpp +++ b/components/chatwindow.hpp @@ -16,6 +16,7 @@ public: Snowflake GetActiveChannel() const; void SetMessages(std::unordered_set<const MessageData *> msgs); void AddNewMessage(Snowflake id); + void ClearMessages(); protected: void ScrollToBottom(); |