From eb31479913fdbf3c352c5657ff164a87333f1e6b Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 25 Mar 2021 08:19:53 +0100 Subject: [PATCH] [muc] Make sendMessage() return a MessageView of the sent message --- .../main/java/org/jivesoftware/smackx/muc/MultiUserChat.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java index aac039264..7e0c0359b 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java @@ -57,6 +57,7 @@ import org.jivesoftware.smack.filter.ToMatchesFilter; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.MessageBuilder; +import org.jivesoftware.smack.packet.MessageView; import org.jivesoftware.smack.packet.Presence; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.util.Objects; @@ -2034,16 +2035,18 @@ public class MultiUserChat { * Sends a Message to the chat room. * * @param messageBuilder the message. + * @return a read-only view of the send message. * @throws NotConnectedException if the XMPP connection is not connected. * @throws InterruptedException if the calling thread was interrupted. */ - public void sendMessage(MessageBuilder messageBuilder) throws NotConnectedException, InterruptedException { + public MessageView sendMessage(MessageBuilder messageBuilder) throws NotConnectedException, InterruptedException { for (MucMessageInterceptor interceptor : messageInterceptors) { interceptor.intercept(messageBuilder, this); } Message message = messageBuilder.to(room).ofType(Message.Type.groupchat).build(); connection.sendStanza(message); + return message; } /**