From d52ace59a9139b027ec6a3fe7d8585136cbf9c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Wed, 7 Jun 2023 18:51:12 +0200 Subject: [PATCH] xmpp: add MucUser payload in send_room_private_message Messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- xmpp/src/lib.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xmpp/src/lib.rs b/xmpp/src/lib.rs index 41d55ade..2a28b08b 100644 --- a/xmpp/src/lib.rs +++ b/xmpp/src/lib.rs @@ -259,12 +259,16 @@ impl Agent { &mut self, room: BareJid, recipient: RoomNick, - type_: MessageType, lang: &str, text: &str, ) { - let recipient = room.with_resource(recipient); - self.send_message(recipient.into(), type_, lang, text).await + let recipient: Jid = room.with_resource(recipient).into(); + let mut message = Message::new(Some(recipient)).with_payload(MucUser::new()); + message.type_ = MessageType::Chat; + message + .bodies + .insert(String::from(lang), Body(String::from(text))); + let _ = self.client.send_stanza(message.into()).await; } fn make_initial_presence(disco: &DiscoInfoResult, node: &str) -> Presence {