summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2021-12-20 02:13:18 -0500
committerouwou <26526779+ouwou@users.noreply.github.com>2021-12-20 02:13:18 -0500
commit9fd0d404a128923c29c7cb4b990ca88cc719e5d6 (patch)
treeceff1813502491b52b537ff9c7d177041f2a200b /src
parentb75599e55d029209ce7b55d581b93911e00b41d5 (diff)
downloadabaddon-portaudio-9fd0d404a128923c29c7cb4b990ca88cc719e5d6.tar.gz
abaddon-portaudio-9fd0d404a128923c29c7cb4b990ca88cc719e5d6.zip
mark channel being switched off as read when switching
Diffstat (limited to 'src')
-rw-r--r--src/components/channels.cpp6
-rw-r--r--src/components/channels.hpp2
2 files changed, 8 insertions, 0 deletions
diff --git a/src/components/channels.cpp b/src/components/channels.cpp
index 76fd69d..c6606e4 100644
--- a/src/components/channels.cpp
+++ b/src/components/channels.cpp
@@ -395,6 +395,12 @@ void ChannelList::OnChannelUnmute(Snowflake id) {
// create a temporary channel row for non-joined threads
// and delete them when the active channel switches off of them if still not joined
void ChannelList::SetActiveChannel(Snowflake id) {
+ // mark channel as read when switching off
+ if (m_active_channel.IsValid())
+ Abaddon::Get().GetDiscordClient().MarkChannelAsRead(m_active_channel, [](...) {});
+
+ m_active_channel = id;
+
if (m_temporary_thread_row) {
const auto thread_id = static_cast<Snowflake>((*m_temporary_thread_row)[m_columns.m_id]);
const auto thread = Abaddon::Get().GetDiscordClient().GetChannel(thread_id);
diff --git a/src/components/channels.hpp b/src/components/channels.hpp
index bc7dfc2..dd861b7 100644
--- a/src/components/channels.hpp
+++ b/src/components/channels.hpp
@@ -132,6 +132,8 @@ protected:
bool m_updating_listing = false;
+ Snowflake m_active_channel;
+
public:
typedef sigc::signal<void, Snowflake> type_signal_action_channel_item_select;
typedef sigc::signal<void, Snowflake> type_signal_action_guild_leave;