diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-07-31 22:32:51 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-08-02 21:46:43 +0200 |
commit | 0abb0334ae3b4a01f153d29dc27582875427c977 (patch) | |
tree | 6be59582d84069ad119d44e63d293a56eb421211 /src/main/java/de/pixart/messenger/generator | |
parent | ade00a8f948b835c7669ff9136a968fddeabc81c (diff) |
set tablet, phone or pc identity
Diffstat (limited to 'src/main/java/de/pixart/messenger/generator')
-rw-r--r-- | src/main/java/de/pixart/messenger/generator/AbstractGenerator.java | 14 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/generator/IqGenerator.java | 4 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/generator/AbstractGenerator.java b/src/main/java/de/pixart/messenger/generator/AbstractGenerator.java index bb68dae7b..d0f083d20 100644 --- a/src/main/java/de/pixart/messenger/generator/AbstractGenerator.java +++ b/src/main/java/de/pixart/messenger/generator/AbstractGenerator.java @@ -51,10 +51,6 @@ public abstract class AbstractGenerator { }; private String mVersion = null; - private String mVersionOs = 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); protected XmppConnectionService mXmppConnectionService; @@ -82,9 +78,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/de/pixart/messenger/generator/IqGenerator.java b/src/main/java/de/pixart/messenger/generator/IqGenerator.java index b8d79d953..b6f8c693a 100644 --- a/src/main/java/de/pixart/messenger/generator/IqGenerator.java +++ b/src/main/java/de/pixart/messenger/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"); } |