send jmi finish alongside session terminate

This commit is contained in:
Daniel Gultsch 2024-01-21 14:48:07 +01:00
parent 21b8bf424a
commit 18dea352b0
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2
2 changed files with 10 additions and 1 deletions

View file

@ -234,7 +234,6 @@ public class MessageGenerator extends AbstractGenerator {
final MessagePacket packet = new MessagePacket(); final MessagePacket packet = new MessagePacket();
packet.setType(MessagePacket.TYPE_CHAT); packet.setType(MessagePacket.TYPE_CHAT);
packet.setTo(with); packet.setTo(with);
packet.setId(JingleRtpConnection.JINGLE_MESSAGE_PROPOSE_ID_PREFIX + sessionId);
final Element finish = packet.addChild("finish", Namespace.JINGLE_MESSAGE); final Element finish = packet.addChild("finish", Namespace.JINGLE_MESSAGE);
finish.setAttribute("id", sessionId); finish.setAttribute("id", sessionId);
final Element reasonElement = finish.addChild("reason", Namespace.JINGLE); final Element reasonElement = finish.addChild("reason", Namespace.JINGLE);

View file

@ -1986,6 +1986,7 @@ public class JingleRtpConnection extends AbstractJingleConnection
protected void sendSessionTerminate(final Reason reason, final String text) { protected void sendSessionTerminate(final Reason reason, final String text) {
sendSessionTerminate(reason, text, this::writeLogMessage); sendSessionTerminate(reason, text, this::writeLogMessage);
sendJingleMessageFinish(reason);
} }
private void sendTransportInfo( private void sendTransportInfo(
@ -2358,6 +2359,15 @@ public class JingleRtpConnection extends AbstractJingleConnection
xmppConnectionService.sendMessagePacket(id.account, messagePacket); xmppConnectionService.sendMessagePacket(id.account, messagePacket);
} }
private void sendJingleMessageFinish(final Reason reason) {
final var account = id.getAccount();
final MessagePacket messagePacket =
xmppConnectionService
.getMessageGenerator()
.sessionFinish(id.with, id.sessionId, reason);
xmppConnectionService.sendMessagePacket(account, messagePacket);
}
private boolean isOmemoEnabled() { private boolean isOmemoEnabled() {
final Conversational conversational = message.getConversation(); final Conversational conversational = message.getConversation();
if (conversational instanceof Conversation) { if (conversational instanceof Conversation) {