allow roster action with name
This commit is contained in:
parent
75a7686f63
commit
9360f5c960
|
@ -423,6 +423,9 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
||||||
}
|
}
|
||||||
|
|
||||||
final Contact contact = account.getRoster().getContact(contactJid);
|
final Contact contact = account.getRoster().getContact(contactJid);
|
||||||
|
if (invite.getName() != null) {
|
||||||
|
contact.setServerName(invite.getName());
|
||||||
|
}
|
||||||
if (contact.isSelf()) {
|
if (contact.isSelf()) {
|
||||||
switchToConversation(contact,null);
|
switchToConversation(contact,null);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -16,6 +16,7 @@ public class XmppUri {
|
||||||
protected String jid;
|
protected String jid;
|
||||||
protected List<Fingerprint> fingerprints = new ArrayList<>();
|
protected List<Fingerprint> fingerprints = new ArrayList<>();
|
||||||
private String body;
|
private String body;
|
||||||
|
private String name;
|
||||||
private String action;
|
private String action;
|
||||||
protected boolean safeSource = true;
|
protected boolean safeSource = true;
|
||||||
|
|
||||||
|
@ -92,7 +93,8 @@ public class XmppUri {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.fingerprints = parseFingerprints(uri.getQuery());
|
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)) {
|
} else if ("imto".equalsIgnoreCase(scheme)) {
|
||||||
// sample: imto://xmpp/foo@bar.com
|
// sample: imto://xmpp/foo@bar.com
|
||||||
try {
|
try {
|
||||||
|
@ -137,10 +139,10 @@ public class XmppUri {
|
||||||
return fingerprints;
|
return fingerprints;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String parseBody(String query) {
|
protected String parseParameter(String key, String query) {
|
||||||
for(String pair : query == null ? new String[0] : query.split(";")) {
|
for(String pair : query == null ? new String[0] : query.split(";")) {
|
||||||
final String[] parts = pair.split("=",2);
|
final String[] parts = pair.split("=",2);
|
||||||
if (parts.length == 2 && "body".equals(parts[0].toLowerCase(Locale.US))) {
|
if (parts.length == 2 && key.equals(parts[0].toLowerCase(Locale.US))) {
|
||||||
try {
|
try {
|
||||||
return URLDecoder.decode(parts[1],"UTF-8");
|
return URLDecoder.decode(parts[1],"UTF-8");
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
@ -190,6 +192,10 @@ public class XmppUri {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Fingerprint> getFingerprints() {
|
public List<Fingerprint> getFingerprints() {
|
||||||
return this.fingerprints;
|
return this.fingerprints;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue