diff options
author | steckbrief <steckbrief@chefmail.de> | 2015-10-05 16:05:56 +0200 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2015-10-05 16:05:56 +0200 |
commit | 383d1aa9e64a245f17dd7ec6d177bb286a489f62 (patch) | |
tree | 0b9d8a50cab4384063669b794ce91804b0a7545c /src/main/java/eu/siacs/conversations/generator | |
parent | c3c42e415ddd7832fea66766377fb4f0d935537a (diff) | |
parent | 1db6e6d5eadbad04768be823b8dbd32827b9b5c3 (diff) |
Merge remote-tracking branch 'remotes/origin/trz/rename' into trz/rebase
Manually merged conflicting files:
src/main/AndroidManifest.xml
src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java
src/main/java/eu/siacs/conversations/generator/IqGenerator.java
src/main/java/eu/siacs/conversations/ui/AboutPreference.java
Diffstat (limited to 'src/main/java/eu/siacs/conversations/generator')
-rw-r--r-- | src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java | 17 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/generator/IqGenerator.java | 8 |
2 files changed, 6 insertions, 19 deletions
diff --git a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java index 3607b69a..190e42bc 100644 --- a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java @@ -12,9 +12,9 @@ import java.util.List; import java.util.Locale; import java.util.TimeZone; +import de.thedevstack.conversationsplus.ConversationsPlusApplication; import de.tzur.conversations.Settings; import eu.siacs.conversations.services.XmppConnectionService; -import eu.siacs.conversations.utils.PhoneHelper; public abstract class AbstractGenerator { private final String[] FEATURES = { @@ -35,8 +35,6 @@ public abstract class AbstractGenerator { "urn:xmpp:receipts" }; private String mVersion = null; - //FIXME use appname or similar!!!!!!!!!!!11elf - public final String IDENTITY_NAME = "Conversations+"; public final String IDENTITY_TYPE = "phone"; private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); @@ -47,20 +45,9 @@ public abstract class AbstractGenerator { this.mXmppConnectionService = service; } - protected String getIdentityVersion() { - if (mVersion == null) { - this.mVersion = PhoneHelper.getVersionName(mXmppConnectionService); - } - return this.mVersion; - } - - protected String getIdentityName() { - return IDENTITY_NAME + " " + getIdentityVersion(); - } - public String getCapHash() { StringBuilder s = new StringBuilder(); - s.append("client/" + IDENTITY_TYPE + "//" + getIdentityName() + "<"); + s.append("client/" + IDENTITY_TYPE + "//" + ConversationsPlusApplication.getNameAndVersion() + "<"); 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 47915e3f..98122446 100644 --- a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java @@ -4,12 +4,12 @@ package eu.siacs.conversations.generator; import java.util.ArrayList; import java.util.List; +import de.thedevstack.conversationsplus.ConversationsPlusApplication; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.DownloadableFile; import eu.siacs.conversations.services.MessageArchiveService; import eu.siacs.conversations.services.XmppConnectionService; -import eu.siacs.conversations.utils.PhoneHelper; import eu.siacs.conversations.utils.Xmlns; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xmpp.forms.Data; @@ -33,7 +33,7 @@ public class IqGenerator extends AbstractGenerator { final Element identity = query.addChild("identity"); identity.setAttribute("category", "client"); identity.setAttribute("type", IDENTITY_TYPE); - identity.setAttribute("name", getIdentityName()); + identity.setAttribute("name", ConversationsPlusApplication.getNameAndVersion()); for (final String feature : getFeatures()) { query.addChild("feature").setAttribute("var", feature); } @@ -43,8 +43,8 @@ public class IqGenerator extends AbstractGenerator { public IqPacket versionResponse(final IqPacket request) { final IqPacket packet = request.generateResponse(IqPacket.TYPE.RESULT); Element query = packet.query("jabber:iq:version"); - query.addChild("name").setContent(IDENTITY_NAME); - query.addChild("version").setContent(getIdentityVersion()); + query.addChild("name").setContent(ConversationsPlusApplication.getName()); + query.addChild("version").setContent(ConversationsPlusApplication.getVersion()); return packet; } |