Make fallback user mentions support also match against the bot's room-specific username

It seems like Element iOS benefits from this.
This commit is contained in:
Slavi Pantaleev
2024-10-03 16:28:49 +03:00
parent 393be9be5a
commit d9a045a5e4
5 changed files with 61 additions and 26 deletions

View File

@@ -15,6 +15,8 @@ pub struct MessageContext {
admin_whitelist_regexes: Vec<regex::Regex>,
trigger_event_info: TriggerEventInfo,
thread_info: ThreadInfo,
bot_display_name: Option<String>,
}
impl MessageContext {
@@ -31,9 +33,20 @@ impl MessageContext {
admin_whitelist_regexes,
trigger_event_info,
thread_info,
bot_display_name: None,
}
}
pub fn with_bot_display_name(mut self, value: Option<String>) -> Self {
self.bot_display_name = value;
self
}
pub fn bot_display_name(&self) -> &Option<String> {
&self.bot_display_name
}
pub fn room(&self) -> &Room {
&self.room
}