diff options
Diffstat (limited to 'src/main/java/eu/siacs/conversations/parser')
-rw-r--r-- | src/main/java/eu/siacs/conversations/parser/MessageParser.java | 9 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/parser/PresenceParser.java | 10 |
2 files changed, 15 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 aac8ee45a..d2f4bf9f5 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -369,6 +369,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece if ((body != null || pgpEncrypted != null || axolotlEncrypted != null) && !isMucStatusMessage) { Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, counterpart.toBareJid(), isTypeGroupChat, query); + final boolean conversationMultiMode = conversation.getMode() == Conversation.MODE_MULTI; if (isTypeGroupChat) { if (counterpart.getResourcepart().equals(conversation.getMucOptions().getActualNick())) { status = Message.STATUS_SEND_RECEIVED; @@ -388,7 +389,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece } Message message; if (body != null && body.startsWith("?OTR") && Config.supportOtr()) { - if (!isForwarded && !isTypeGroupChat && isProperlyAddressed) { + if (!isForwarded && !isTypeGroupChat && isProperlyAddressed && !conversationMultiMode) { message = parseOtrChat(body, from, remoteMsgId, conversation); if (message == null) { return; @@ -401,7 +402,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece message = new Message(conversation, pgpEncrypted, Message.ENCRYPTION_PGP, status); } else if (axolotlEncrypted != null && Config.supportOmemo()) { Jid origin; - if (conversation.getMode() == Conversation.MODE_MULTI) { + if (conversationMultiMode) { origin = conversation.getMucOptions().getTrueCounterpart(counterpart); if (origin == null) { Log.d(Config.LOGTAG,"axolotl message in non anonymous conference received"); @@ -429,7 +430,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece message.setTime(timestamp); message.setOob(isOob); message.markable = packet.hasChild("markable", "urn:xmpp:chat-markers:0"); - if (conversation.getMode() == Conversation.MODE_MULTI) { + if (conversationMultiMode) { Jid trueCounterpart = conversation.getMucOptions().getTrueCounterpart(counterpart); message.setTrueCounterpart(trueCounterpart); if (trueCounterpart != null) { @@ -452,7 +453,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece || replacedMessage.getFingerprint().equals(message.getFingerprint()); final boolean trueCountersMatch = replacedMessage.getTrueCounterpart() != null && replacedMessage.getTrueCounterpart().equals(message.getTrueCounterpart()); - if (fingerprintsMatch && (trueCountersMatch || conversation.getMode() == Conversation.MODE_SINGLE)) { + if (fingerprintsMatch && (trueCountersMatch || !conversationMultiMode)) { Log.d(Config.LOGTAG, "replaced message '" + replacedMessage.getBody() + "' with '" + message.getBody() + "'"); final String uuid = replacedMessage.getUuid(); replacedMessage.setUuid(UUID.randomUUID().toString()); diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java index ae5d576a6..8a2d444a7 100644 --- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java @@ -14,6 +14,7 @@ import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.entities.MucOptions; import eu.siacs.conversations.entities.Presence; +import eu.siacs.conversations.generator.IqGenerator; import eu.siacs.conversations.generator.PresenceGenerator; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.xml.Element; @@ -77,6 +78,15 @@ public class PresenceParser extends AbstractParser implements } else { mucOptions.addUser(user); } + if (codes.contains(MucOptions.STATUS_CODE_ROOM_CREATED) && mucOptions.autoPushConfiguration()) { + Log.d(Config.LOGTAG,mucOptions.getAccount().getJid().toBareJid() + +": room '" + +mucOptions.getConversation().getJid().toBareJid() + +"' created. pushing default configuration"); + mXmppConnectionService.pushConferenceConfiguration(mucOptions.getConversation(), + IqGenerator.defaultRoomConfiguration(), + null); + } if (mXmppConnectionService.getPgpEngine() != null) { Element signed = packet.findChild("x", "jabber:x:signed"); if (signed != null) { |