diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-12-18 01:58:29 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-12-18 01:58:29 -0500 |
commit | f580535d3570de59125cc377b01188601c82b5b9 (patch) | |
tree | 01a6d40ac08fde25e0e0705e8088c26f76cb6f12 /src/discord/objects.cpp | |
parent | 1d7529e60925c36af5aa5a8702e7a0827e646f00 (diff) | |
download | abaddon-portaudio-f580535d3570de59125cc377b01188601c82b5b9.tar.gz abaddon-portaudio-f580535d3570de59125cc377b01188601c82b5b9.zip |
add mute/unmute channel menu item
Diffstat (limited to 'src/discord/objects.cpp')
-rw-r--r-- | src/discord/objects.cpp | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/src/discord/objects.cpp b/src/discord/objects.cpp index a41b664..9e3741f 100644 --- a/src/discord/objects.cpp +++ b/src/discord/objects.cpp @@ -143,6 +143,27 @@ void from_json(const nlohmann::json &j, UserGuildSettingsChannelOverride &m) { JS_D("channel_id", m.ChannelID); } +void to_json(nlohmann::json &j, const UserGuildSettingsChannelOverride &m) { + j["channel_id"] = m.ChannelID; + j["collapsed"] = m.Collapsed; + j["message_notifications"] = m.MessageNotifications; + j["mute_config"] = m.MuteConfig; + j["muted"] = m.Muted; +} + +void from_json(const nlohmann::json &j, MuteConfigData &m) { + JS_ON("end_time", m.EndTime); + JS_D("selected_time_window", m.SelectedTimeWindow); +} + +void to_json(nlohmann::json &j, const MuteConfigData &m) { + if (m.EndTime.has_value()) + j["end_time"] = *m.EndTime; + else + j["end_time"] = nullptr; + j["selected_time_window"] = m.SelectedTimeWindow; +} + void from_json(const nlohmann::json &j, UserGuildSettingsEntry &m) { JS_D("version", m.Version); JS_D("suppress_roles", m.SuppressRoles); @@ -151,13 +172,26 @@ void from_json(const nlohmann::json &j, UserGuildSettingsEntry &m) { JS_D("mobile_push", m.MobilePush); JS_D("message_notifications", m.MessageNotifications); JS_D("hide_muted_channels", m.HideMutedChannels); - JS_D("guild_id", m.GuildID); + JS_N("guild_id", m.GuildID); JS_D("channel_overrides", m.ChannelOverrides); } +void to_json(nlohmann::json &j, const UserGuildSettingsEntry &m) { + j["channel_overrides"] = m.ChannelOverrides; + j["guild_id"] = m.GuildID; + j["hide_muted_channels"] = m.HideMutedChannels; + j["message_notifications"] = m.MessageNotifications; + j["mobile_push"] = m.MobilePush; + j["mute_config"] = m.MuteConfig; + j["muted"] = m.Muted; + j["suppress_everyone"] = m.SuppressEveryone; + j["suppress_roles"] = m.SuppressRoles; + j["version"] = m.Version; +} + void from_json(const nlohmann::json &j, UserGuildSettingsData &m) { JS_D("version", m.Version); - JS_D("partial", m.IsParital); + JS_D("partial", m.IsPartial); JS_D("entries", m.Entries); } |