mark channels as unread on MESSAGE_CREATE

This commit is contained in:
ouwou 2021-12-05 04:07:30 -05:00
parent 1ea2811713
commit d63941797f
2 changed files with 5 additions and 1 deletions

View File

@ -699,10 +699,11 @@ void ChannelList::OnMessageAck(const MessageAckData &data) {
}
void ChannelList::OnMessageCreate(const Message &msg) {
auto iter = GetIteratorForChannelFromID(msg.ChannelID);
m_model->row_changed(m_model->get_path(iter), iter); // redraw
const auto channel = Abaddon::Get().GetDiscordClient().GetChannel(msg.ChannelID);
if (!channel.has_value()) return;
if (channel->Type != ChannelType::DM && channel->Type != ChannelType::GROUP_DM) return;
auto iter = GetIteratorForChannelFromID(msg.ChannelID);
if (iter)
(*iter)[m_columns.m_sort] = -msg.ID;
}

View File

@ -1444,6 +1444,9 @@ void DiscordClient::HandleGatewayMessageCreate(const GatewayMessage &msg) {
if (data.GuildID.has_value())
AddUserToGuild(data.Author.ID, *data.GuildID);
m_last_message_id[data.ChannelID] = data.ID;
const auto iter = m_unread.find(data.ChannelID);
if (iter == m_unread.end())
m_unread[data.ChannelID] = 0;
m_signal_message_create.emit(data);
}