From 1ae74784ca5466c879e678687f84f4b9b1e91420 Mon Sep 17 00:00:00 2001 From: Artem Shipovskiy Date: Fri, 29 Jan 2016 23:14:41 +0500 Subject: Add device name to client info --- .../eu/siacs/conversations/generator/AbstractGenerator.java | 10 ++++++++++ .../java/eu/siacs/conversations/generator/IqGenerator.java | 1 + src/main/java/eu/siacs/conversations/utils/PhoneHelper.java | 4 ++++ 3 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java index fe43e0bfb..835eef36b 100644 --- a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java @@ -37,6 +37,8 @@ public abstract class AbstractGenerator { "urn:xmpp:receipts" }; private String mVersion = null; + + private String mVersionOs = null; protected final String IDENTITY_NAME = "Pix-Art Messenger"; protected final String IDENTITY_TYPE = "phone"; @@ -55,6 +57,14 @@ public abstract class AbstractGenerator { return this.mVersion; } + protected String getIdentityVersionOs() { + if (mVersionOs == null) { + this.mVersionOs = "Android/" + android.os.Build.MODEL + + "/" + android.os.Build.VERSION.RELEASE; + } + return this.mVersionOs; + } + public String getIdentityName() { return IDENTITY_NAME + " " + getIdentityVersion(); } diff --git a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java index 345f68ae3..3b9f8ce06 100644 --- a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java @@ -57,6 +57,7 @@ public class IqGenerator extends AbstractGenerator { Element query = packet.query("jabber:iq:version"); query.addChild("name").setContent(IDENTITY_NAME); query.addChild("version").setContent(getIdentityVersion()); + query.addChild("os").setContent(getIdentityVersionOs()); return packet; } diff --git a/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java b/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java index 6c1b4bef5..48c9104f9 100644 --- a/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java @@ -133,4 +133,8 @@ public class PhoneHelper { return "unknown"; } } + + public static String getOSVersion(Context context) { + return "Android/" + android.os.Build.MODEL + "/" + android.os.Build.VERSION.RELEASE; + } } -- cgit v1.2.3