mirror of
https://github.com/moparisthebest/Conversations
synced 2024-12-26 01:09:13 -05:00
set tablet, phone or pc identity
This commit is contained in:
parent
1b114beb0b
commit
9dc8e3db9d
@ -50,7 +50,6 @@ public abstract class AbstractGenerator {
|
|||||||
"urn:xmpp:otr:0"
|
"urn:xmpp:otr:0"
|
||||||
};
|
};
|
||||||
private String mVersion = null;
|
private String mVersion = null;
|
||||||
protected final String IDENTITY_TYPE = "phone";
|
|
||||||
|
|
||||||
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);
|
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);
|
||||||
|
|
||||||
@ -71,9 +70,17 @@ public abstract class AbstractGenerator {
|
|||||||
return mXmppConnectionService.getString(R.string.app_name) + " " + getIdentityVersion();
|
return mXmppConnectionService.getString(R.string.app_name) + " " + getIdentityVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getIdentityType() {
|
||||||
|
if ("chromium".equals(android.os.Build.BRAND)) {
|
||||||
|
return "pc";
|
||||||
|
} else {
|
||||||
|
return mXmppConnectionService.getString(R.string.default_resource).toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getCapHash() {
|
public String getCapHash() {
|
||||||
StringBuilder s = new StringBuilder();
|
StringBuilder s = new StringBuilder();
|
||||||
s.append("client/" + IDENTITY_TYPE + "//" + getIdentityName() + "<");
|
s.append("client/" + getIdentityType() + "//" + getIdentityName() + "<");
|
||||||
MessageDigest md;
|
MessageDigest md;
|
||||||
try {
|
try {
|
||||||
md = MessageDigest.getInstance("SHA-1");
|
md = MessageDigest.getInstance("SHA-1");
|
||||||
|
@ -47,7 +47,7 @@ public class IqGenerator extends AbstractGenerator {
|
|||||||
query.setAttribute("node", request.query().getAttribute("node"));
|
query.setAttribute("node", request.query().getAttribute("node"));
|
||||||
final Element identity = query.addChild("identity");
|
final Element identity = query.addChild("identity");
|
||||||
identity.setAttribute("category", "client");
|
identity.setAttribute("category", "client");
|
||||||
identity.setAttribute("type", IDENTITY_TYPE);
|
identity.setAttribute("type", getIdentityType());
|
||||||
identity.setAttribute("name", getIdentityName());
|
identity.setAttribute("name", getIdentityName());
|
||||||
for (final String feature : getFeatures()) {
|
for (final String feature : getFeatures()) {
|
||||||
query.addChild("feature").setAttribute("var", feature);
|
query.addChild("feature").setAttribute("var", feature);
|
||||||
@ -61,7 +61,7 @@ public class IqGenerator extends AbstractGenerator {
|
|||||||
query.addChild("name").setContent(mXmppConnectionService.getString(R.string.app_name));
|
query.addChild("name").setContent(mXmppConnectionService.getString(R.string.app_name));
|
||||||
query.addChild("version").setContent(getIdentityVersion());
|
query.addChild("version").setContent(getIdentityVersion());
|
||||||
if ("chromium".equals(android.os.Build.BRAND)) {
|
if ("chromium".equals(android.os.Build.BRAND)) {
|
||||||
query.addChild("os").setContent("Chromium");
|
query.addChild("os").setContent("Chrome OS");
|
||||||
} else{
|
} else{
|
||||||
query.addChild("os").setContent("Android");
|
query.addChild("os").setContent("Android");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user