concord 2.4.3

A terminal user interface client for Discord
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
use std::{collections::BTreeMap, path::PathBuf};

use serde::{Deserialize, Serialize, de};

use crate::discord::ids::{
    Id,
    marker::{ChannelMarker, GuildMarker},
};
use crate::discord::{MicrophoneSensitivityDb, VoiceVolumePercent};

pub const DEFAULT_SERVER_WIDTH: u16 = 20;
pub const DEFAULT_CHANNEL_LIST_WIDTH: u16 = 24;
pub const DEFAULT_MEMBER_LIST_WIDTH: u16 = 26;

#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(default)]
pub struct DisplayOptions {
    pub disable_image_preview: bool,
    pub show_avatars: bool,
    pub show_images: bool,
    pub media_playback: bool,
    pub image_preview_quality: ImagePreviewQualityPreset,
    pub attachment_viewer_quality: ImagePreviewQualityPreset,
    pub image_protocol: ImageProtocolPreference,
    pub show_custom_emoji: bool,
    pub circular_avatars: bool,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(default)]
pub struct ComposerOptions {
    pub emojis_as_links: bool,
    pub ping_on_reply: bool,
}

impl Default for ComposerOptions {
    fn default() -> Self {
        Self {
            emojis_as_links: false,
            ping_on_reply: true,
        }
    }
}

#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(default)]
pub struct CredentialOptions {
    pub store: CredentialStoreMode,
}

#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub enum CredentialStoreMode {
    #[default]
    Auto,
    Keychain,
    Plain,
}

#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(default)]
pub struct NotificationOptions {
    pub desktop_notifications: bool,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub notification_icon: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub notification_sound: Option<PathBuf>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub voice_join_sound: Option<PathBuf>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub voice_leave_sound: Option<PathBuf>,
}

#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
#[serde(default)]
pub struct VoiceOptions {
    pub self_mute: bool,
    pub self_deaf: bool,
    pub allow_microphone_transmit: bool,
    pub microphone_sensitivity: MicrophoneSensitivityDb,
    pub microphone_volume: VoiceVolumePercent,
    pub voice_output_volume: VoiceVolumePercent,
}

#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
#[serde(default)]
pub struct KeymapOptions {
    pub leader: Option<String>,
    pub groups: BTreeMap<String, String>,
    pub guild_actions: BTreeMap<String, KeymapBinding>,
    pub channel_actions: BTreeMap<String, KeymapBinding>,
    pub message_actions: BTreeMap<String, KeymapBinding>,
    pub member_actions: BTreeMap<String, KeymapBinding>,
    pub thread_actions: BTreeMap<String, KeymapBinding>,
    pub notification_inbox_actions: BTreeMap<String, KeymapBinding>,
    pub composer: BTreeMap<String, KeymapBinding>,
    #[serde(flatten)]
    pub mappings: BTreeMap<String, KeymapBinding>,
}

#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct KeymapBinding {
    pub keys: Vec<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
}

#[derive(Deserialize)]
#[serde(untagged)]
enum KeymapBindingInput {
    // Variant order matters: `untagged` tries top to bottom, so `Disabled`
    // catches `false` before `Keys` reads it, and `Keys` catches an array
    // before `Structured`.
    Disabled(bool),
    Keys(KeymapKeysInput),
    Structured {
        keys: KeymapKeysInput,
        description: Option<String>,
    },
}

#[derive(Deserialize)]
#[serde(untagged)]
enum KeymapKeysInput {
    One(String),
    Many(Vec<String>),
}

impl KeymapKeysInput {
    fn into_keys(self) -> Vec<String> {
        match self {
            Self::One(key) if key.trim().is_empty() => Vec::new(),
            Self::One(key) => vec![key],
            Self::Many(keys) if keys.iter().all(|key| key.trim().is_empty()) => Vec::new(),
            Self::Many(keys) => keys,
        }
    }
}

impl KeymapBinding {
    pub fn one(key: impl Into<String>) -> Self {
        Self {
            keys: vec![key.into()],
            description: None,
        }
    }

    pub fn disabled() -> Self {
        Self {
            keys: Vec::new(),
            description: None,
        }
    }

    pub fn is_disabled(&self) -> bool {
        self.keys.is_empty()
    }
}

impl<'de> Deserialize<'de> for KeymapBinding {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let (keys, description) = match KeymapBindingInput::deserialize(deserializer)? {
            KeymapBindingInput::Disabled(false) => return Ok(Self::disabled()),
            KeymapBindingInput::Disabled(true) => {
                return Err(de::Error::custom(
                    "keymap binding boolean must be false to disable the shortcut",
                ));
            }
            KeymapBindingInput::Keys(keys) => (keys.into_keys(), None),
            KeymapBindingInput::Structured { keys, description } => (keys.into_keys(), description),
        };
        if keys.is_empty() {
            Ok(Self::disabled())
        } else {
            Ok(Self { keys, description })
        }
    }
}

#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(default)]
pub struct PresenceOptions {
    pub share_rich_presence: bool,
}

impl Default for PresenceOptions {
    fn default() -> Self {
        Self {
            share_rich_presence: true,
        }
    }
}

#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
#[serde(default)]
pub struct AppOptions {
    pub display: DisplayOptions,
    pub composer: ComposerOptions,
    pub credentials: CredentialOptions,
    pub notifications: NotificationOptions,
    pub voice: VoiceOptions,
    pub presence: PresenceOptions,
}

/// Validated Highlight Group and UI definitions from `theme.toml`.
///
/// The storage is private so only registered names cross the configuration
/// boundary into runtime theme resolution.
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct ThemeOptions {
    highlights: BTreeMap<HighlightGroup, HighlightDefinitionOptions>,
    border_shapes: BorderShapeOptions,
}

impl ThemeOptions {
    pub(crate) fn highlights(&self) -> &BTreeMap<HighlightGroup, HighlightDefinitionOptions> {
        &self.highlights
    }

    pub(crate) const fn border_shapes(&self) -> &BorderShapeOptions {
        &self.border_shapes
    }

    pub(crate) const fn border_shapes_mut(&mut self) -> &mut BorderShapeOptions {
        &mut self.border_shapes
    }

    pub(crate) fn highlight_mut(
        &mut self,
        group: HighlightGroup,
    ) -> &mut HighlightDefinitionOptions {
        self.highlights.entry(group).or_default()
    }
}

macro_rules! define_border_surfaces {
    ($($variant:ident => $name:literal, rounded_by_default = $rounded:literal),+ $(,)?) => {
        #[derive(Clone, Copy, Debug, Eq, PartialEq)]
        #[repr(usize)]
        pub(crate) enum BorderSurface {
            $($variant),+
        }

        impl BorderSurface {
            pub(crate) const ALL: &'static [Self] = &[$(Self::$variant),+];
            pub(crate) const COUNT: usize = Self::ALL.len();

            pub(crate) fn from_name(name: &str) -> Option<Self> {
                match name {
                    $($name => Some(Self::$variant),)+
                    _ => None,
                }
            }

            pub(crate) const fn rounded_by_default(self) -> bool {
                match self {
                    $(Self::$variant => $rounded),+
                }
            }
        }
    };
}

define_border_surfaces! {
    Pane => "pane", rounded_by_default = false,
    Composer => "composer", rounded_by_default = true,
    Modal => "modal", rounded_by_default = false,
    Picker => "picker", rounded_by_default = false,
    Login => "login", rounded_by_default = false,
    Message => "message", rounded_by_default = true,
    Forum => "forum", rounded_by_default = true,
}

#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub(crate) struct BorderShapeOptions {
    pub(crate) default: Option<BorderShape>,
    surfaces: [Option<BorderShape>; BorderSurface::COUNT],
}

impl BorderShapeOptions {
    pub(crate) const fn get(&self, surface: BorderSurface) -> Option<BorderShape> {
        self.surfaces[surface as usize]
    }

    pub(crate) fn set(&mut self, surface: BorderSurface, shape: BorderShape) {
        self.surfaces[surface as usize] = Some(shape);
    }
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) enum BorderShape {
    Plain,
    Rounded,
    Double,
    Thick,
    LightDoubleDashed,
    HeavyDoubleDashed,
    LightTripleDashed,
    HeavyTripleDashed,
    LightQuadrupleDashed,
    HeavyQuadrupleDashed,
    QuadrantInside,
    QuadrantOutside,
}

impl BorderShape {
    pub(super) fn from_name(name: &str) -> Option<Self> {
        match name {
            "plain" => Some(Self::Plain),
            "rounded" => Some(Self::Rounded),
            "double" => Some(Self::Double),
            "thick" => Some(Self::Thick),
            "light_double_dashed" => Some(Self::LightDoubleDashed),
            "heavy_double_dashed" => Some(Self::HeavyDoubleDashed),
            "light_triple_dashed" => Some(Self::LightTripleDashed),
            "heavy_triple_dashed" => Some(Self::HeavyTripleDashed),
            "light_quadruple_dashed" => Some(Self::LightQuadrupleDashed),
            "heavy_quadruple_dashed" => Some(Self::HeavyQuadrupleDashed),
            "quadrant_inside" => Some(Self::QuadrantInside),
            "quadrant_outside" => Some(Self::QuadrantOutside),
            _ => None,
        }
    }
}

#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub(crate) struct HighlightDefinitionOptions {
    pub(crate) link: Option<HighlightLinkOptions>,
    pub(crate) foreground: Option<String>,
    pub(crate) background: Option<String>,
    pub(crate) bold: Option<bool>,
    pub(crate) italic: Option<bool>,
    pub(crate) dim: Option<bool>,
    pub(crate) underline: Option<bool>,
    pub(crate) strikethrough: Option<bool>,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) enum HighlightLinkOptions {
    Inherit(HighlightGroup),
    Detached,
}

macro_rules! define_highlight_groups {
    ($($variant:ident => $name:literal),+ $(,)?) => {
        #[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
        #[repr(usize)]
        pub(crate) enum HighlightGroup {
            $($variant),+
        }

        impl HighlightGroup {
            pub(crate) const ALL: &'static [Self] = &[$(Self::$variant),+];
            pub(crate) const COUNT: usize = Self::ALL.len();

            pub(crate) const fn name(self) -> &'static str {
                match self {
                    $(Self::$variant => $name),+
                }
            }

            pub(super) fn from_name(name: &str) -> Option<Self> {
                match name {
                    $($name => Some(Self::$variant),)+
                    _ => None,
                }
            }
        }
    };
}

define_highlight_groups! {
    Normal => "Normal",
    Strong => "Strong",
    Emphasis => "Emphasis",
    Muted => "Muted",
    Title => "Title",
    Heading => "Heading",
    Decoration => "Decoration",
    Hint => "Hint",
    Description => "Description",
    Shortcut => "Shortcut",
    Activity => "Activity",
    ChannelTypeMarker => "ChannelTypeMarker",
    FieldLabel => "FieldLabel",
    SearchContext => "SearchContext",
    Timestamp => "Timestamp",
    Placeholder => "Placeholder",
    Disabled => "Disabled",
    Loading => "Loading",
    Edited => "Edited",
    Unavailable => "Unavailable",
    LoginTitle => "LoginTitle",
    LoginHint => "LoginHint",
    PaneTitle => "PaneTitle",
    ModalTitle => "ModalTitle",
    ComposerTitle => "ComposerTitle",
    HeaderTitle => "HeaderTitle",
    HeaderLabel => "HeaderLabel",
    MessageAuthor => "MessageAuthor",
    MessageTimestamp => "MessageTimestamp",
    CategoryHeading => "CategoryHeading",
    MemberGroupHeading => "MemberGroupHeading",
    MessageSecondary => "MessageSecondary",
    ForumSecondary => "ForumSecondary",
    EmbedAuthor => "EmbedAuthor",
    EmbedTitle => "EmbedTitle",
    EmbedFieldName => "EmbedFieldName",
    EmbedFooter => "EmbedFooter",
    CodeBlockBorder => "CodeBlockBorder",
    ScrollbarTrack => "ScrollbarTrack",
    UnavailableEmoji => "UnavailableEmoji",
    HeaderError => "HeaderError",
    HeaderWarning => "HeaderWarning",
    Border => "Border",
    FocusBorder => "FocusBorder",
    Selection => "Selection",
    SelectionBorder => "SelectionBorder",
    PaneBorder => "PaneBorder",
    FocusedPaneBorder => "FocusedPaneBorder",
    LoginBorder => "LoginBorder",
    ComposerBorder => "ComposerBorder",
    ActiveComposerBorder => "ActiveComposerBorder",
    ModalBorder => "ModalBorder",
    ComposerPickerBorder => "ComposerPickerBorder",
    SelectedRow => "SelectedRow",
    SelectionMarker => "SelectionMarker",
    ActiveField => "ActiveField",
    ActiveTab => "ActiveTab",
    MessageSelectedBorder => "MessageSelectedBorder",
    ForumBorder => "ForumBorder",
    ForumSelectedBorder => "ForumSelectedBorder",
    ScrollbarThumb => "ScrollbarThumb",
    UnreadNotice => "UnreadNotice",
    Editing => "Editing",
    Reaction => "Reaction",
    SelfReaction => "SelfReaction",
    PresenceOnline => "PresenceOnline",
    PresenceIdle => "PresenceIdle",
    PresenceDnd => "PresenceDnd",
    PresenceOffline => "PresenceOffline",
    VoiceDisabled => "VoiceDisabled",
    VoiceConnection => "VoiceConnection",
    FolderFallback => "FolderFallback",
    NavigationActive => "NavigationActive",
    NavigationMentioned => "NavigationMentioned",
    NavigationNotified => "NavigationNotified",
    NavigationUnread => "NavigationUnread",
    MentionBadge => "MentionBadge",
    NotificationBadge => "NotificationBadge",
    JoinedVoiceChannel => "JoinedVoiceChannel",
    VoiceSpeaking => "VoiceSpeaking",
    ReplyPingEnabled => "ReplyPingEnabled",
    Tag => "Tag",
    RelationshipFriend => "RelationshipFriend",
    RelationshipIncoming => "RelationshipIncoming",
    RelationshipOutgoing => "RelationshipOutgoing",
    RelationshipBlocked => "RelationshipBlocked",
    RelationshipNone => "RelationshipNone",
    GaugeFill => "GaugeFill",
    MessageBody => "MessageBody",
    MarkdownHeading1 => "MarkdownHeading1",
    MarkdownHeading2 => "MarkdownHeading2",
    MarkdownHeading3 => "MarkdownHeading3",
    MarkdownQuote => "MarkdownQuote",
    MarkdownMarker => "MarkdownMarker",
    MessageAttachment => "MessageAttachment",
    ImageOverflow => "ImageOverflow",
    InlineCode => "InlineCode",
    MessageLink => "MessageLink",
    MentionSelf => "MentionSelf",
    MentionOther => "MentionOther",
    MentionRole => "MentionRole",
    MentionPickerRole => "MentionPickerRole",
    EmbedGutter => "EmbedGutter",
    EmbedLink => "EmbedLink",
    CommandName => "CommandName",
    SystemThreadName => "SystemThreadName",
    PollAnswerSelected => "PollAnswerSelected",
    PollWinner => "PollWinner",
    UnreadBanner => "UnreadBanner",
    UnreadDivider => "UnreadDivider",
    ForumPinnedBadge => "ForumPinnedBadge",
    BotBadge => "BotBadge",
    Error => "Error",
    Warning => "Warning",
    Success => "Success",
    Info => "Info",
}

#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize)]
#[serde(default)]
pub(super) struct KeymapFileOptions {
    pub(super) keymap: KeymapOptions,
}

#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
#[serde(default)]
pub(super) struct UiStateFileOptions {
    pub(super) ui_state: UiStateOptions,
}

#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(default)]
pub struct UiStateOptions {
    #[serde(default = "default_pane_visible")]
    pub guild_pane_visible: bool,
    #[serde(default = "default_pane_visible")]
    pub channel_pane_visible: bool,
    #[serde(default = "default_pane_visible")]
    pub member_pane_visible: bool,
    #[serde(default = "default_server_width")]
    pub server_width: u16,
    #[serde(default = "default_channel_list_width")]
    pub channel_list_width: u16,
    #[serde(default = "default_member_list_width")]
    pub member_list_width: u16,
    pub collapsed_channel_categories: Vec<Id<ChannelMarker>>,
    pub collapsed_server_folder_ids: Vec<u64>,
    pub collapsed_server_folder_guilds: Vec<Vec<Id<GuildMarker>>>,
    /// One-to-one DMs confirmed to contain enough messages from the current
    /// user. This avoids reclassifying an established conversation when those
    /// messages later fall outside the latest 50-message window.
    pub established_dms: Vec<Id<ChannelMarker>>,
}

impl Default for UiStateOptions {
    fn default() -> Self {
        Self {
            guild_pane_visible: true,
            channel_pane_visible: true,
            member_pane_visible: true,
            server_width: default_server_width(),
            channel_list_width: default_channel_list_width(),
            member_list_width: default_member_list_width(),
            collapsed_channel_categories: Vec::new(),
            collapsed_server_folder_ids: Vec::new(),
            collapsed_server_folder_guilds: Vec::new(),
            established_dms: Vec::new(),
        }
    }
}

fn default_pane_visible() -> bool {
    true
}

fn default_server_width() -> u16 {
    DEFAULT_SERVER_WIDTH
}

fn default_channel_list_width() -> u16 {
    DEFAULT_CHANNEL_LIST_WIDTH
}

fn default_member_list_width() -> u16 {
    DEFAULT_MEMBER_LIST_WIDTH
}

#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub enum ImagePreviewQualityPreset {
    Efficient,
    #[default]
    Balanced,
    High,
    Original,
}

#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub enum ImageProtocolPreference {
    #[default]
    Auto,
    Iterm2,
    Kitty,
    Sixel,
    Halfblocks,
}

impl ImagePreviewQualityPreset {
    pub fn label(self) -> &'static str {
        match self {
            Self::Efficient => "efficient",
            Self::Balanced => "balanced",
            Self::High => "high",
            Self::Original => "original",
        }
    }

    pub fn next(self) -> Self {
        match self {
            Self::Efficient => Self::Balanced,
            Self::Balanced => Self::High,
            Self::High => Self::Original,
            Self::Original => Self::Efficient,
        }
    }
}

impl Default for NotificationOptions {
    fn default() -> Self {
        Self {
            desktop_notifications: true,
            notification_icon: None,
            notification_sound: None,
            voice_join_sound: None,
            voice_leave_sound: None,
        }
    }
}

impl Default for CredentialOptions {
    fn default() -> Self {
        Self {
            store: CredentialStoreMode::Auto,
        }
    }
}

impl Default for DisplayOptions {
    fn default() -> Self {
        Self {
            disable_image_preview: false,
            show_avatars: true,
            show_images: true,
            media_playback: false,
            image_preview_quality: ImagePreviewQualityPreset::default(),
            attachment_viewer_quality: ImagePreviewQualityPreset::Original,
            image_protocol: ImageProtocolPreference::default(),
            show_custom_emoji: true,
            circular_avatars: false,
        }
    }
}

impl DisplayOptions {
    pub fn avatars_visible(self) -> bool {
        !self.disable_image_preview && self.show_avatars
    }

    pub fn images_visible(self) -> bool {
        !self.disable_image_preview && self.show_images
    }

    pub fn media_playback_enabled(self) -> bool {
        self.media_playback
    }

    pub fn custom_emoji_visible(self) -> bool {
        !self.disable_image_preview && self.show_custom_emoji
    }
}