aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-02-15 19:19:20 +0100
committerChristian Schneppe <christian@pix-art.de>2018-02-15 19:19:20 +0100
commita5176a16f2b593addffec613ae975f04cfbf1c1b (patch)
tree794913e243af8b236850165b4e113c62360a64c1 /src/main/java/de
parent4467368c8c9f08da589b2b8acdeea96b49048011 (diff)
allow roster action with name
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/ui/StartConversationActivity.java3
-rw-r--r--src/main/java/de/pixart/messenger/utils/XmppUri.java18
2 files changed, 15 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
index 83427a713..30c6b8d97 100644
--- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
@@ -442,6 +442,9 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
}
final Contact contact = account.getRoster().getContact(contactJid);
+ if (invite.getName() != null) {
+ contact.setServerName(invite.getName());
+ }
if (contact.isSelf()) {
switchToConversation(contact, null);
return true;
diff --git a/src/main/java/de/pixart/messenger/utils/XmppUri.java b/src/main/java/de/pixart/messenger/utils/XmppUri.java
index 63640089e..daa14a3c3 100644
--- a/src/main/java/de/pixart/messenger/utils/XmppUri.java
+++ b/src/main/java/de/pixart/messenger/utils/XmppUri.java
@@ -17,6 +17,7 @@ public class XmppUri {
protected String fingerprint;
protected List<Fingerprint> fingerprints = new ArrayList<>();
private String body;
+ private String name;
private String action;
protected boolean safeSource = true;
public static final String OMEMO_URI_PARAM = "omemo-sid-";
@@ -93,7 +94,8 @@ public class XmppUri {
}
}
this.fingerprints = parseFingerprints(uri.getQuery());
- this.body = parseBody(uri.getQuery());
+ this.body = parseParameter("body", uri.getQuery());
+ this.name = parseParameter("name", uri.getQuery());
} else if ("imto".equalsIgnoreCase(scheme)) {
// sample: imto://xmpp/foo@bar.com
try {
@@ -138,12 +140,12 @@ public class XmppUri {
return fingerprints;
}
- protected String parseBody(String query) {
- for(String pair : query == null ? new String[0] : query.split(";")) {
- final String[] parts = pair.split("=",2);
- if (parts.length == 2 && "body".equals(parts[0].toLowerCase(Locale.US))) {
+ protected String parseParameter(String key, String query) {
+ for (String pair : query == null ? new String[0] : query.split(";")) {
+ final String[] parts = pair.split("=", 2);
+ if (parts.length == 2 && key.equals(parts[0].toLowerCase(Locale.US))) {
try {
- return URLDecoder.decode(parts[1],"UTF-8");
+ return URLDecoder.decode(parts[1], "UTF-8");
} catch (UnsupportedEncodingException e) {
return null;
}
@@ -191,6 +193,10 @@ public class XmppUri {
return body;
}
+ public String getName() {
+ return name;
+ }
+
public List<Fingerprint> getFingerprints() {
return this.fingerprints;
}