add jingle message init namespace to features
This commit is contained in:
parent
5b12e23382
commit
442b952700
|
@ -23,6 +23,7 @@ import eu.siacs.conversations.xmpp.XmppConnection;
|
||||||
import eu.siacs.conversations.xmpp.jingle.stanzas.FileTransferDescription;
|
import eu.siacs.conversations.xmpp.jingle.stanzas.FileTransferDescription;
|
||||||
|
|
||||||
public abstract class AbstractGenerator {
|
public abstract class AbstractGenerator {
|
||||||
|
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);
|
||||||
private final String[] FEATURES = {
|
private final String[] FEATURES = {
|
||||||
Namespace.JINGLE,
|
Namespace.JINGLE,
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ public abstract class AbstractGenerator {
|
||||||
"http://jabber.org/protocol/caps",
|
"http://jabber.org/protocol/caps",
|
||||||
"http://jabber.org/protocol/disco#info",
|
"http://jabber.org/protocol/disco#info",
|
||||||
"urn:xmpp:avatar:metadata+notify",
|
"urn:xmpp:avatar:metadata+notify",
|
||||||
Namespace.NICK+"+notify",
|
Namespace.NICK + "+notify",
|
||||||
"urn:xmpp:ping",
|
"urn:xmpp:ping",
|
||||||
"jabber:iq:version",
|
"jabber:iq:version",
|
||||||
"http://jabber.org/protocol/chatstates"
|
"http://jabber.org/protocol/chatstates"
|
||||||
|
@ -55,24 +56,26 @@ public abstract class AbstractGenerator {
|
||||||
private final String[] PRIVACY_SENSITIVE = {
|
private final String[] PRIVACY_SENSITIVE = {
|
||||||
"urn:xmpp:time" //XEP-0202: Entity Time leaks time zone
|
"urn:xmpp:time" //XEP-0202: Entity Time leaks time zone
|
||||||
};
|
};
|
||||||
|
|
||||||
private final String[] VOIP_NAMESPACES = {
|
private final String[] VOIP_NAMESPACES = {
|
||||||
Namespace.JINGLE_TRANSPORT_ICE_UDP,
|
Namespace.JINGLE_TRANSPORT_ICE_UDP,
|
||||||
Namespace.JINGLE_FEATURE_AUDIO,
|
Namespace.JINGLE_FEATURE_AUDIO,
|
||||||
Namespace.JINGLE_FEATURE_VIDEO,
|
Namespace.JINGLE_FEATURE_VIDEO,
|
||||||
Namespace.JINGLE_APPS_RTP,
|
Namespace.JINGLE_APPS_RTP,
|
||||||
Namespace.JINGLE_APPS_DTLS,
|
Namespace.JINGLE_APPS_DTLS,
|
||||||
|
Namespace.JINGLE_MESSAGE
|
||||||
};
|
};
|
||||||
private String mVersion = null;
|
|
||||||
|
|
||||||
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);
|
|
||||||
|
|
||||||
protected XmppConnectionService mXmppConnectionService;
|
protected XmppConnectionService mXmppConnectionService;
|
||||||
|
private String mVersion = null;
|
||||||
|
|
||||||
AbstractGenerator(XmppConnectionService service) {
|
AbstractGenerator(XmppConnectionService service) {
|
||||||
this.mXmppConnectionService = service;
|
this.mXmppConnectionService = service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getTimestamp(long time) {
|
||||||
|
DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
|
return DATE_FORMAT.format(time);
|
||||||
|
}
|
||||||
|
|
||||||
String getIdentityVersion() {
|
String getIdentityVersion() {
|
||||||
if (mVersion == null) {
|
if (mVersion == null) {
|
||||||
this.mVersion = PhoneHelper.getVersionName(mXmppConnectionService);
|
this.mVersion = PhoneHelper.getVersionName(mXmppConnectionService);
|
||||||
|
@ -113,11 +116,6 @@ public abstract class AbstractGenerator {
|
||||||
return Base64.encodeToString(sha1, Base64.NO_WRAP);
|
return Base64.encodeToString(sha1, Base64.NO_WRAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getTimestamp(long time) {
|
|
||||||
DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC"));
|
|
||||||
return DATE_FORMAT.format(time);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getFeatures(Account account) {
|
public List<String> getFeatures(Account account) {
|
||||||
final XmppConnection connection = account.getXmppConnection();
|
final XmppConnection connection = account.getXmppConnection();
|
||||||
final ArrayList<String> features = new ArrayList<>(Arrays.asList(FEATURES));
|
final ArrayList<String> features = new ArrayList<>(Arrays.asList(FEATURES));
|
||||||
|
@ -138,9 +136,9 @@ public abstract class AbstractGenerator {
|
||||||
features.add(Namespace.IDLE);
|
features.add(Namespace.IDLE);
|
||||||
}
|
}
|
||||||
if (connection != null && connection.getFeatures().bookmarks2()) {
|
if (connection != null && connection.getFeatures().bookmarks2()) {
|
||||||
features.add(Namespace.BOOKMARKS2 +"+notify");
|
features.add(Namespace.BOOKMARKS2 + "+notify");
|
||||||
} else {
|
} else {
|
||||||
features.add(Namespace.BOOKMARKS+"+notify");
|
features.add(Namespace.BOOKMARKS + "+notify");
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(features);
|
Collections.sort(features);
|
||||||
|
|
Loading…
Reference in New Issue