diff --git a/components/chatmessage.cpp b/components/chatmessage.cpp index 03398dd..68d2359 100644 --- a/components/chatmessage.cpp +++ b/components/chatmessage.cpp @@ -277,6 +277,18 @@ void ChatMessageItemContainer::UpdateTextComponent(Gtk::TextView *tv) { case MessageType::CALL: { b->insert_markup(s, "[started a call]"); } break; + case MessageType::GUILD_DISCOVERY_DISQUALIFIED: { + b->insert_markup(s, "This server has been removed from Server Discovery because it no longer passes all the requirements."); + } break; + case MessageType::GUILD_DISCOVERY_REQUALIFIED: { + b->insert_markup(s, "This server is eligible for Server Discovery again and has been automatically relisted!"); + } break; + case MessageType::GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING: { + b->insert_markup(s, "This server has failed Discovery activity requirements for 1 week. If this server fails for 4 weeks in a row, it will be automatically removed from Discovery."); + } break; + case MessageType::GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING: { + b->insert_markup(s, "This server has failed Discovery activity requirements for 3 weeks in a row. If this server fails for 1 more week, it will be removed from Discovery."); + } break; default: break; } } diff --git a/components/completer.cpp b/components/completer.cpp index 4108331..3d1a4d0 100644 --- a/components/completer.cpp +++ b/components/completer.cpp @@ -160,8 +160,11 @@ void Completer::CompleteEmojis(const Glib::ustring &term) { return entry; }; + const auto self_id = discord.GetUserData().ID; + const bool can_use_external = discord.GetSelfPremiumType() != EPremiumType::None && discord.HasChannelPermission(self_id, channel_id, Permission::USE_EXTERNAL_EMOJIS); + int i = 0; - if (discord.GetSelfPremiumType() == EPremiumType::None) { + if (!can_use_external) { if (channel->GuildID.has_value()) { const auto guild = discord.GetGuild(*channel->GuildID); diff --git a/discord/discord.cpp b/discord/discord.cpp index 93e5ff4..e0de3e9 100644 --- a/discord/discord.cpp +++ b/discord/discord.cpp @@ -1218,6 +1218,9 @@ void DiscordClient::HandleGatewayChannelUpdate(const GatewayMessage &msg) { if (cur.has_value()) { cur->update_from_json(msg.Data); m_store.SetChannel(id, *cur); + if (cur->PermissionOverwrites.has_value()) + for (const auto &p : *cur->PermissionOverwrites) + m_store.SetPermissionOverwrite(id, p.ID, p); m_signal_channel_update.emit(id); } } diff --git a/discord/message.hpp b/discord/message.hpp index baf147e..e24f248 100644 --- a/discord/message.hpp +++ b/discord/message.hpp @@ -23,10 +23,10 @@ enum class MessageType { USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2 = 10, // yep USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3 = 11, // yep CHANNEL_FOLLOW_ADD = 12, // yep - GUILD_DISCOVERY_DISQUALIFIED = 14, // nope - GUILD_DISCOVERY_REQUALIFIED = 15, // nope - GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING = 16, // nope - GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING = 17, // nope + GUILD_DISCOVERY_DISQUALIFIED = 14, // yep + GUILD_DISCOVERY_REQUALIFIED = 15, // yep + GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING = 16, // yep + GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING = 17, // yep THREAD_CREATED = 18, // nope INLINE_REPLY = 19, // yep APPLICATION_COMMAND = 20, // yep diff --git a/discord/store.cpp b/discord/store.cpp index d2b2375..bd9ad32 100644 --- a/discord/store.cpp +++ b/discord/store.cpp @@ -753,7 +753,8 @@ bool Store::CreateTables() { channel_id INTEGER NOT NULL, type INTEGER NOT NULL, allow INTEGER NOT NULL, - deny INTEGER NOT NULL + deny INTEGER NOT NULL, + PRIMARY KEY(id, channel_id) ) )";