parse message that only contain oob tag. fixes #2359
This commit is contained in:
parent
75749d7c7b
commit
b34a1f7f5e
|
@ -29,6 +29,7 @@ public abstract class AbstractGenerator {
|
||||||
"urn:xmpp:jingle:transports:ibb:1",
|
"urn:xmpp:jingle:transports:ibb:1",
|
||||||
"http://jabber.org/protocol/muc",
|
"http://jabber.org/protocol/muc",
|
||||||
"jabber:x:conference",
|
"jabber:x:conference",
|
||||||
|
Namespace.OOB,
|
||||||
"http://jabber.org/protocol/caps",
|
"http://jabber.org/protocol/caps",
|
||||||
"http://jabber.org/protocol/disco#info",
|
"http://jabber.org/protocol/disco#info",
|
||||||
"urn:xmpp:avatar:metadata+notify",
|
"urn:xmpp:avatar:metadata+notify",
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class MessageGenerator extends AbstractGenerator {
|
||||||
if (message.hasFileOnRemoteHost()) {
|
if (message.hasFileOnRemoteHost()) {
|
||||||
Message.FileParams fileParams = message.getFileParams();
|
Message.FileParams fileParams = message.getFileParams();
|
||||||
content = fileParams.url.toString();
|
content = fileParams.url.toString();
|
||||||
packet.addChild("x","jabber:x:oob").addChild("url").setContent(content);
|
packet.addChild("x",Namespace.OOB).addChild("url").setContent(content);
|
||||||
} else {
|
} else {
|
||||||
content = message.getBody();
|
content = message.getBody();
|
||||||
}
|
}
|
||||||
|
|
|
@ -372,8 +372,8 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
||||||
final Element mucUserElement = packet.findChild("x", "http://jabber.org/protocol/muc#user");
|
final Element mucUserElement = packet.findChild("x", "http://jabber.org/protocol/muc#user");
|
||||||
final String pgpEncrypted = packet.findChildContent("x", "jabber:x:encrypted");
|
final String pgpEncrypted = packet.findChildContent("x", "jabber:x:encrypted");
|
||||||
final Element replaceElement = packet.findChild("replace", "urn:xmpp:message-correct:0");
|
final Element replaceElement = packet.findChild("replace", "urn:xmpp:message-correct:0");
|
||||||
final Element oob = packet.findChild("x", "jabber:x:oob");
|
final Element oob = packet.findChild("x", Namespace.OOB);
|
||||||
final boolean isOob = oob!= null && body != null && body.equals(oob.findChildContent("url"));
|
final String oobUrl = oob != null ? oob.findChildContent("url") : null;
|
||||||
final String replacementId = replaceElement == null ? null : replaceElement.getAttribute("id");
|
final String replacementId = replaceElement == null ? null : replaceElement.getAttribute("id");
|
||||||
final Element axolotlEncrypted = packet.findChild(XmppAxolotlMessage.CONTAINERTAG, AxolotlService.PEP_PREFIX);
|
final Element axolotlEncrypted = packet.findChild(XmppAxolotlMessage.CONTAINERTAG, AxolotlService.PEP_PREFIX);
|
||||||
int status;
|
int status;
|
||||||
|
@ -414,7 +414,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
||||||
mXmppConnectionService.updateConversationUi();
|
mXmppConnectionService.updateConversationUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((body != null || pgpEncrypted != null || axolotlEncrypted != null) && !isMucStatusMessage) {
|
if ((body != null || pgpEncrypted != null || axolotlEncrypted != null || oobUrl != null) && !isMucStatusMessage) {
|
||||||
Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, counterpart.toBareJid(), isTypeGroupChat, false, query);
|
Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, counterpart.toBareJid(), isTypeGroupChat, false, query);
|
||||||
final boolean conversationMultiMode = conversation.getMode() == Conversation.MODE_MULTI;
|
final boolean conversationMultiMode = conversation.getMode() == Conversation.MODE_MULTI;
|
||||||
|
|
||||||
|
@ -471,6 +471,9 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
||||||
if (conversationMultiMode) {
|
if (conversationMultiMode) {
|
||||||
message.setTrueCounterpart(origin);
|
message.setTrueCounterpart(origin);
|
||||||
}
|
}
|
||||||
|
} else if (body == null && oobUrl != null) {
|
||||||
|
message = new Message(conversation, oobUrl, Message.ENCRYPTION_NONE, status);
|
||||||
|
message.setOob(true);
|
||||||
} else {
|
} else {
|
||||||
message = new Message(conversation, body, Message.ENCRYPTION_NONE, status);
|
message = new Message(conversation, body, Message.ENCRYPTION_NONE, status);
|
||||||
}
|
}
|
||||||
|
@ -480,7 +483,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
||||||
message.setServerMsgId(serverMsgId);
|
message.setServerMsgId(serverMsgId);
|
||||||
message.setCarbon(isCarbon);
|
message.setCarbon(isCarbon);
|
||||||
message.setTime(timestamp);
|
message.setTime(timestamp);
|
||||||
message.setOob(isOob);
|
message.setOob(body != null && body.equals(oobUrl));
|
||||||
message.markable = packet.hasChild("markable", "urn:xmpp:chat-markers:0");
|
message.markable = packet.hasChild("markable", "urn:xmpp:chat-markers:0");
|
||||||
if (conversationMultiMode) {
|
if (conversationMultiMode) {
|
||||||
final Jid fallback = conversation.getMucOptions().getTrueCounterpart(counterpart);
|
final Jid fallback = conversation.getMucOptions().getTrueCounterpart(counterpart);
|
||||||
|
|
|
@ -10,4 +10,5 @@ public final class Namespace {
|
||||||
public static final String MAM = "urn:xmpp:mam:2";
|
public static final String MAM = "urn:xmpp:mam:2";
|
||||||
public static final String MAM_LEGACY = "urn:xmpp:mam:0";
|
public static final String MAM_LEGACY = "urn:xmpp:mam:0";
|
||||||
public static final String IDLE = "urn:xmpp:idle:1";
|
public static final String IDLE = "urn:xmpp:idle:1";
|
||||||
|
public static final String OOB = "jabber:x:oob";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue