summaryrefslogtreecommitdiff
path: root/src/components/chatlist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/chatlist.cpp')
-rw-r--r--src/components/chatlist.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/components/chatlist.cpp b/src/components/chatlist.cpp
index ba18c0a..4dde8a3 100644
--- a/src/components/chatlist.cpp
+++ b/src/components/chatlist.cpp
@@ -67,8 +67,22 @@ void ChatList::ProcessNewMessage(const Message &data, bool prepend) {
if (last_row != nullptr) {
const uint64_t diff = std::max(data.ID, last_row->NewestID) - std::min(data.ID, last_row->NewestID);
- if (last_row->UserID == data.Author.ID && (prepend || (diff < SnowflakeSplitDifference * Snowflake::SecondsInterval)))
+ if (last_row->UserID == data.Author.ID && (prepend || (diff < SnowflakeSplitDifference * Snowflake::SecondsInterval))) {
should_attach = true;
+ }
+ // Separate webhooks if the usernames or avatar URLs are different
+ if (data.IsWebhook() && last_row->UserID == data.Author.ID) {
+ const auto last_message = discord.GetMessage(last_row->NewestID);
+ if (last_message.has_value() && last_message->IsWebhook()) {
+ const auto last_webhook_data = last_message->GetWebhookData();
+ const auto next_webhook_data = data.GetWebhookData();
+ if (last_webhook_data.has_value() && next_webhook_data.has_value()) {
+ if (last_webhook_data->Username != next_webhook_data->Username || last_webhook_data->Avatar != next_webhook_data->Avatar) {
+ should_attach = false;
+ }
+ }
+ }
+ }
}
}