aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <xmpp-dev@marcschink.de>2017-12-05 21:46:48 +0100
committerAndroid Development <you@example.com>2017-12-10 14:57:25 +0100
commit7aedb6fbabe298595364723d68419562f724e6e2 (patch)
treef3074c9a0c30e0e24e6f937028e2b4f2268f8e8d
parent5a41f4bc38683bac27254d99bb6f8cc2b3374b5d (diff)
XmppUri: Parse 'message action' query
-rw-r--r--src/main/java/eu/siacs/conversations/utils/XmppUri.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/utils/XmppUri.java b/src/main/java/eu/siacs/conversations/utils/XmppUri.java
index c20c9a4..5674164 100644
--- a/src/main/java/eu/siacs/conversations/utils/XmppUri.java
+++ b/src/main/java/eu/siacs/conversations/utils/XmppUri.java
@@ -15,6 +15,7 @@ public class XmppUri {
protected String jid;
protected boolean muc;
+ protected boolean message;
protected List<Fingerprint> fingerprints = new ArrayList<>();
private String body;
protected boolean safeSource = true;
@@ -68,6 +69,7 @@ public class XmppUri {
} else if ("xmpp".equalsIgnoreCase(scheme)) {
// sample: xmpp:foo@bar.com
muc = isMuc(uri.getQuery());
+ message = parseMessage(uri.getQuery());
if (uri.getAuthority() != null) {
jid = uri.getAuthority();
} else {
@@ -138,6 +140,16 @@ public class XmppUri {
return null;
}
+ protected boolean parseMessage(String query) {
+ for(String pair : query == null ? new String[0] : query.split(";")) {
+ final String[] parts = pair.split("=", 2);
+ if (parts.length == 1 && "message".equals(parts[0])) {
+ return true;
+ }
+ }
+ return false;
+ }
+
protected boolean isMuc(String query) {
for(String pair : query == null ? new String[0] : query.split(";")) {
final String[] parts = pair.split("=",2);
@@ -165,6 +177,10 @@ public class XmppUri {
}
}
+ public boolean isMessage() {
+ return message;
+ }
+
public String getBody() {
return body;
}