mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-25 15:52:06 +01:00
[muc] Make sendMessage() return a MessageView of the sent message
This commit is contained in:
parent
64a2db3f19
commit
eb31479913
1 changed files with 4 additions and 1 deletions
|
@ -57,6 +57,7 @@ import org.jivesoftware.smack.filter.ToMatchesFilter;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.MessageBuilder;
|
import org.jivesoftware.smack.packet.MessageBuilder;
|
||||||
|
import org.jivesoftware.smack.packet.MessageView;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
|
@ -2034,16 +2035,18 @@ public class MultiUserChat {
|
||||||
* Sends a Message to the chat room.
|
* Sends a Message to the chat room.
|
||||||
*
|
*
|
||||||
* @param messageBuilder the message.
|
* @param messageBuilder the message.
|
||||||
|
* @return a read-only view of the send message.
|
||||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||||
* @throws InterruptedException if the calling thread was interrupted.
|
* @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) {
|
for (MucMessageInterceptor interceptor : messageInterceptors) {
|
||||||
interceptor.intercept(messageBuilder, this);
|
interceptor.intercept(messageBuilder, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Message message = messageBuilder.to(room).ofType(Message.Type.groupchat).build();
|
Message message = messageBuilder.to(room).ofType(Message.Type.groupchat).build();
|
||||||
connection.sendStanza(message);
|
connection.sendStanza(message);
|
||||||
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue