xmpp: Only send RoomSubject with empty body

Signed-off-by: pep <pep@bouah.net>
This commit is contained in:
pep 2026-01-27 21:50:49 +01:00
commit cff9195d6e
No known key found for this signature in database
GPG key ID: DEDA74AEECA9D0F2
2 changed files with 14 additions and 13 deletions

View file

@ -30,6 +30,7 @@ XXXX-YY-ZZ [ RELEASER <admin@localhost> ]
resyncs. Adds a parameter to `muc::room::JoinRoomSettings`. resyncs. Adds a parameter to `muc::room::JoinRoomSettings`.
* Changed: * Changed:
- Replaced unimplemented! with info! calls. - Replaced unimplemented! with info! calls.
- Only send `Event::RoomSubject` when there's no body as per 0045.
* Added: * Added:
- Agent::send_room_message takes RoomMessageSettings argument (!483) - Agent::send_room_message takes RoomMessageSettings argument (!483)
- Agent::send_raw_message takes RawMessageSettings for any message type (!487) - Agent::send_raw_message takes RawMessageSettings for any message type (!487)

View file

@ -20,25 +20,25 @@ pub async fn handle_message_group_chat(
) { ) {
let config = agent.get_config().await; let config = agent.get_config().await;
let langs: Vec<&str> = config.lang.iter().map(String::as_str).collect(); let langs: Vec<&str> = config.lang.iter().map(String::as_str).collect();
let mut found_subject = false;
if let Some((_lang, subject)) = message.get_best_subject(langs.clone()) { let Some((_lang, body)) = message.get_best_body_cloned(langs.clone()) else {
events.push(Event::RoomSubject( // 0045 §7.2.15
from.to_bare(), // a <message/> stanza from the room JID (or from the occupant JID of the entity that set
from.resource().map(RoomNick::from_resource_ref), // the subject), with a <subject/> element but no <body/> element
subject.clone(), if let Some((_lang, subject)) = message.get_best_subject(langs) {
time_info.clone(), events.push(Event::RoomSubject(
)); from.to_bare(),
found_subject = true; from.resource().map(RoomNick::from_resource_ref),
} subject.clone(),
time_info.clone(),
let Some((_lang, body)) = message.get_best_body_cloned(langs) else { ));
if !found_subject { } else {
debug!( debug!(
"Received groupchat message without body/subject:\n{:#?}", "Received groupchat message without body/subject:\n{:#?}",
message message
); );
} }
return; return;
}; };