summaryrefslogtreecommitdiff
path: root/abaddon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'abaddon.cpp')
-rw-r--r--abaddon.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/abaddon.cpp b/abaddon.cpp
index e72bc0f..13aa738 100644
--- a/abaddon.cpp
+++ b/abaddon.cpp
@@ -38,6 +38,7 @@ Abaddon::Abaddon()
m_discord.signal_guild_update().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnGuildUpdate));
m_discord.signal_reaction_add().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnReactionAdd));
m_discord.signal_reaction_remove().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnReactionRemove));
+ m_discord.signal_disconnected().connect(sigc::mem_fun(*this, &Abaddon::DiscordOnDisconnect));
if (m_settings.GetPrefetch())
m_discord.signal_message_create().connect([this](Snowflake id) {
const auto msg = m_discord.GetMessage(id);
@@ -233,6 +234,14 @@ void Abaddon::DiscordOnReactionRemove(Snowflake message_id, const Glib::ustring
m_main_window->UpdateChatReactionAdd(message_id, param);
}
+void Abaddon::DiscordOnDisconnect(bool is_reconnecting, GatewayCloseCode close_code) {
+ m_main_window->UpdateComponents();
+ if (close_code == GatewayCloseCode::AuthenticationFailed) {
+ Gtk::MessageDialog dlg(*m_main_window, "Discord rejected your token", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
+ dlg.run();
+ }
+}
+
const SettingsManager &Abaddon::GetSettings() const {
return m_settings;
}