don’t send origin-ids to rooms that support stable-ids. fixes #3905

This commit is contained in:
Daniel Gultsch 2020-11-14 11:59:35 +01:00
parent 16c4e3eec7
commit 1fafe4287d
2 changed files with 8 additions and 2 deletions

View file

@ -211,6 +211,10 @@ public class MucOptions {
return conversation.getBooleanAttribute(Conversation.ATTRIBUTE_MODERATED, false);
}
public boolean stableId() {
return getFeatures().contains("http://jabber.org/protocol/muc#stable_id");
}
public User deleteUser(Jid jid) {
User user = findUserByFullJid(jid);
if (user != null) {

View file

@ -18,12 +18,12 @@ import eu.siacs.conversations.http.P1S3UrlStreamHandler;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.chatstate.ChatState;
import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager;
import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection;
import eu.siacs.conversations.xmpp.jingle.Media;
import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
import eu.siacs.conversations.xmpp.Jid;
public class MessageGenerator extends AbstractGenerator {
private static final String OMEMO_FALLBACK_MESSAGE = "I sent you an OMEMO encrypted message but your client doesnt seem to support that. Find more information on https://conversations.im/omemo";
@ -58,7 +58,9 @@ public class MessageGenerator extends AbstractGenerator {
}
packet.setFrom(account.getJid());
packet.setId(message.getUuid());
if (conversation.getMode() == Conversational.MODE_SINGLE || message.isPrivateMessage() || !conversation.getMucOptions().stableId()) {
packet.addChild("origin-id", Namespace.STANZA_IDS).setAttribute("id", message.getUuid());
}
if (message.edited()) {
packet.addChild("replace", "urn:xmpp:message-correct:0").setAttribute("id", message.getEditedIdWireFormat());
}