diff options
author | iNPUTmice <daniel@gultsch.de> | 2015-01-28 00:28:00 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2015-01-28 00:28:00 +0100 |
commit | 3c64839dafcbaaed9ee0f7ef01afe6516f49020b (patch) | |
tree | bf28dc000701272418a799ce35e29332462f7c10 /src | |
parent | f8b662e7f8cc11f50063ed7d1b48f91dddb246e5 (diff) |
fixed broken caps
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java | 24 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/generator/IqGenerator.java | 7 |
2 files changed, 17 insertions, 14 deletions
diff --git a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java index 7689a183..04e114da 100644 --- a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java @@ -8,13 +8,14 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.List; import java.util.Locale; import java.util.TimeZone; import eu.siacs.conversations.services.XmppConnectionService; public abstract class AbstractGenerator { - public final String[] FEATURES = { + private final String[] FEATURES = { "urn:xmpp:jingle:1", "urn:xmpp:jingle:apps:file-transfer:3", "urn:xmpp:jingle:transports:s5b:1", @@ -25,7 +26,7 @@ public abstract class AbstractGenerator { "http://jabber.org/protocol/disco#info", "urn:xmpp:avatar:metadata+notify", "urn:xmpp:ping"}; - public final String[] MESSAGE_CONFIRMATION_FEATURES = { + private final String[] MESSAGE_CONFIRMATION_FEATURES = { "urn:xmpp:chat-markers:0", "urn:xmpp:receipts" }; @@ -49,13 +50,8 @@ public abstract class AbstractGenerator { } catch (NoSuchAlgorithmException e) { return null; } - ArrayList<String> features = new ArrayList<>(); - features.addAll(Arrays.asList(FEATURES)); - if (mXmppConnectionService.confirmMessages()) { - features.addAll(Arrays.asList(MESSAGE_CONFIRMATION_FEATURES)); - } - Collections.sort(features); - for (String feature : features) { + + for (String feature : getFeatures()) { s.append(feature + "<"); } byte[] sha1 = md.digest(s.toString().getBytes()); @@ -66,4 +62,14 @@ public abstract class AbstractGenerator { DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC")); return DATE_FORMAT.format(time); } + + public List<String> getFeatures() { + ArrayList<String> features = new ArrayList<>(); + features.addAll(Arrays.asList(FEATURES)); + if (mXmppConnectionService.confirmMessages()) { + features.addAll(Arrays.asList(MESSAGE_CONFIRMATION_FEATURES)); + } + Collections.sort(features); + return features; + } } diff --git a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java index 290e0d60..161e6f89 100644 --- a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java @@ -1,8 +1,7 @@ package eu.siacs.conversations.generator; + import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; import java.util.List; import eu.siacs.conversations.entities.Account; @@ -33,9 +32,7 @@ public class IqGenerator extends AbstractGenerator { identity.setAttribute("category", "client"); identity.setAttribute("type", this.IDENTITY_TYPE); identity.setAttribute("name", IDENTITY_NAME); - final List<String> features = Arrays.asList(FEATURES); - Collections.sort(features); - for (final String feature : features) { + for (final String feature : getFeatures()) { query.addChild("feature").setAttribute("var", feature); } return packet; |