Offer {Resource,Node,Domain}Ref on Jid API

This provides a non-copying API, which is generally favourable. The
other accessors were removed, because the intent was to provide this
"most sensible" API via the "default" (i.e. shortest, most concisely
named) functions.
This commit is contained in:
Jonas Schäfer 2024-03-03 16:15:04 +01:00
commit 7fce1146e0
10 changed files with 86 additions and 133 deletions

View file

@ -39,7 +39,7 @@ pub async fn handle_message_chat<C: ServerConnector>(
Jid::Full(full) => Event::RoomPrivateMessage(
message.id.clone(),
full.to_bare(),
full.resource_str().to_owned(),
full.resource().to_string(),
body.clone(),
time_info.clone(),
),

View file

@ -21,7 +21,7 @@ pub async fn handle_message_group_chat<C: ServerConnector>(
if let Some((_lang, subject)) = message.get_best_subject(langs.clone()) {
events.push(Event::RoomSubject(
from.to_bare(),
from.resource_str().map(String::from),
from.resource().map(|x| x.to_string()),
subject.0.clone(),
time_info.clone(),
));
@ -32,7 +32,7 @@ pub async fn handle_message_group_chat<C: ServerConnector>(
Jid::Full(full) => Event::RoomMessage(
message.id.clone(),
from.to_bare(),
full.resource_str().to_owned(),
full.resource().to_string(),
body.clone(),
time_info,
),