diff options
author | steckbrief <steckbrief@chefmail.de> | 2015-02-20 22:19:31 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2015-02-20 22:19:31 +0100 |
commit | 20eae3955700341188bc1907a506970f5817a153 (patch) | |
tree | 6e50d9083a4392875b5f9dbe92b38973cf95c332 /src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java | |
parent | 980a84a6ce4358e8662addf203695e01d9f931dc (diff) | |
parent | ecbceae88b7a7aa871e5396efec1e2ff8d056d46 (diff) |
Merge master-origin
Conflicts:
src/main/java/eu/siacs/conversations/ui/SettingsActivity.java
src/main/java/eu/siacs/conversations/ui/XmppActivity.java
src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
src/main/java/eu/siacs/conversations/utils/UIHelper.java
src/main/res/values-de/strings.xml
Diffstat (limited to 'src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java index 870ee757..526e5b19 100644 --- a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java @@ -5,6 +5,7 @@ import android.util.Base64; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -14,16 +15,22 @@ import java.util.TimeZone; import eu.siacs.conversations.services.XmppConnectionService; public abstract class AbstractGenerator { - public final String[] FEATURES = {"urn:xmpp:jingle:1", + private final String[] FEATURES = { + "urn:xmpp:jingle:1", "urn:xmpp:jingle:apps:file-transfer:3", "urn:xmpp:jingle:transports:s5b:1", - "urn:xmpp:jingle:transports:ibb:1", "urn:xmpp:receipts", - "urn:xmpp:chat-markers:0", "http://jabber.org/protocol/muc", - "jabber:x:conference", "http://jabber.org/protocol/caps", + "urn:xmpp:jingle:transports:ibb:1", + "http://jabber.org/protocol/muc", + "jabber:x:conference", + "http://jabber.org/protocol/caps", "http://jabber.org/protocol/disco#info", "urn:xmpp:avatar:metadata+notify", "urn:xmpp:ping"}; - public final String IDENTITY_NAME = "Conversations 0.10"; + private final String[] MESSAGE_CONFIRMATION_FEATURES = { + "urn:xmpp:chat-markers:0", + "urn:xmpp:receipts" + }; + public final String IDENTITY_NAME = "Conversations 1.0"; public final String IDENTITY_TYPE = "phone"; private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US); @@ -43,9 +50,8 @@ public abstract class AbstractGenerator { } catch (NoSuchAlgorithmException e) { return null; } - List<String> features = Arrays.asList(FEATURES); - Collections.sort(features); - for (String feature : features) { + + for (String feature : getFeatures()) { s.append(feature + "<"); } byte[] sha1 = md.digest(s.toString().getBytes()); @@ -56,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; + } } |