From 0dca7f8a5a6e543da81cd3730793a0162dbc1cb5 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 1 Oct 2023 08:05:36 +0200 Subject: [PATCH] JMI: send 'ringing' and receipts only for contacts fixes #110 --- .../conversations/parser/MessageParser.java | 19 ++++++++++++++++--- .../xmpp/jingle/JingleRtpConnection.java | 4 +++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index 006923bd7..0378c2927 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -849,9 +849,22 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece if (serverMsgId == null) { serverMsgId = extractStanzaId(account, packet); } - mXmppConnectionService.getJingleConnectionManager().deliverMessage(account, packet.getTo(), packet.getFrom(), child, remoteMsgId, serverMsgId, timestamp); - if (!account.getJid().asBareJid().equals(from.asBareJid()) && remoteMsgId != null) { - processMessageReceipts(account, packet, remoteMsgId, query); + mXmppConnectionService + .getJingleConnectionManager() + .deliverMessage( + account, + packet.getTo(), + packet.getFrom(), + child, + remoteMsgId, + serverMsgId, + timestamp); + final Contact contact = account.getRoster().getContact(from); + if (mXmppConnectionService.confirmMessages() + && !contact.isSelf() + && remoteMsgId != null + && contact.showInContactList()) { + processMessageReceipts(account, packet, remoteMsgId, null); } } else if (query.isCatchup()) { if ("propose".equals(action)) { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java index ad2702850..fb335ef93 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -1505,7 +1505,9 @@ public class JingleRtpConnection extends AbstractJingleConnection } this.message.setTime(timestamp); startRinging(); - sendJingleMessage("ringing"); + if (xmppConnectionService.confirmMessages() && id.getContact().showInContactList()) { + sendJingleMessage("ringing"); + } } else { Log.d( Config.LOGTAG,