diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-07-31 22:32:51 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-07-31 22:32:51 +0200 |
commit | 9dc8e3db9dba2eadcbba5e77d62edf6fa7ff8fe7 (patch) | |
tree | 5c11c21c2ca87957428ac1a2f039f6601b20d789 /src/main/java/eu | |
parent | 1b114beb0b21e3ddd2aedaa50092fc609bdba8c2 (diff) |
set tablet, phone or pc identity
Diffstat (limited to 'src/main/java/eu')
-rw-r--r-- | src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java | 11 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/generator/IqGenerator.java | 4 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java index 7964a38a..8edc24c3 100644 --- a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java @@ -50,7 +50,6 @@ public abstract class AbstractGenerator { "urn:xmpp:otr:0" }; 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); @@ -71,9 +70,17 @@ public abstract class AbstractGenerator { 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() { StringBuilder s = new StringBuilder(); - s.append("client/" + IDENTITY_TYPE + "//" + getIdentityName() + "<"); + s.append("client/" + getIdentityType() + "//" + getIdentityName() + "<"); MessageDigest md; try { md = MessageDigest.getInstance("SHA-1"); diff --git a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java index ad650c3e..4116729a 100644 --- a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java @@ -47,7 +47,7 @@ public class IqGenerator extends AbstractGenerator { query.setAttribute("node", request.query().getAttribute("node")); final Element identity = query.addChild("identity"); identity.setAttribute("category", "client"); - identity.setAttribute("type", IDENTITY_TYPE); + identity.setAttribute("type", getIdentityType()); identity.setAttribute("name", getIdentityName()); for (final String feature : getFeatures()) { 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("version").setContent(getIdentityVersion()); if ("chromium".equals(android.os.Build.BRAND)) { - query.addChild("os").setContent("Chromium"); + query.addChild("os").setContent("Chrome OS"); } else{ query.addChild("os").setContent("Android"); } |