mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-30 12:42:16 -05:00
fixed broken caps
This commit is contained in:
parent
f8b662e7f8
commit
3c64839daf
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user