mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-19 20:11:59 +03:00
split messages from the same author after 10 mins
This commit is contained in:
@@ -1210,4 +1210,8 @@ void ChatMessageHeader::AddContent(Gtk::Widget *widget, bool prepend) {
|
||||
m_content_box->add(*widget);
|
||||
if (prepend)
|
||||
m_content_box->reorder_child(*widget, 1);
|
||||
if (auto *x = dynamic_cast<ChatMessageItemContainer *>(widget)) {
|
||||
if (x->ID > NewestID)
|
||||
NewestID = x->ID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +109,7 @@ class ChatMessageHeader : public Gtk::ListBoxRow {
|
||||
public:
|
||||
Snowflake UserID;
|
||||
Snowflake ChannelID;
|
||||
Snowflake NewestID = 0;
|
||||
|
||||
ChatMessageHeader(const Message *data);
|
||||
void AddContent(Gtk::Widget *widget, bool prepend);
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "chatinputindicator.hpp"
|
||||
#include "chatinput.hpp"
|
||||
|
||||
constexpr static uint64_t SnowflakeSplitDifference = 600;
|
||||
|
||||
ChatWindow::ChatWindow() {
|
||||
Abaddon::Get().GetDiscordClient().signal_message_send_fail().connect(sigc::mem_fun(*this, &ChatWindow::OnMessageSendFail));
|
||||
|
||||
@@ -238,7 +240,7 @@ void ChatWindow::ProcessNewMessage(Snowflake id, bool prepend) {
|
||||
last_row = dynamic_cast<ChatMessageHeader *>(m_list->get_row_at_index(m_num_rows - 1));
|
||||
|
||||
if (last_row != nullptr)
|
||||
if (last_row->UserID == data->Author.ID)
|
||||
if (last_row->UserID == data->Author.ID && (prepend || (id - last_row->NewestID < SnowflakeSplitDifference * Snowflake::SecondsInterval)))
|
||||
should_attach = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user