use bind:0 namespace
This commit is contained in:
parent
5a3cca9554
commit
9f5da67539
|
@ -233,7 +233,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
||||||
Element item = items.findChild("item");
|
Element item = items.findChild("item");
|
||||||
Set<Integer> deviceIds = mXmppConnectionService.getIqParser().deviceIds(item);
|
Set<Integer> deviceIds = mXmppConnectionService.getIqParser().deviceIds(item);
|
||||||
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Received PEP device list " + deviceIds + " update from " + from + ", processing... ");
|
Log.d(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Received PEP device list " + deviceIds + " update from " + from + ", processing... ");
|
||||||
AxolotlService axolotlService = account.getAxolotlService();
|
final AxolotlService axolotlService = account.getAxolotlService();
|
||||||
axolotlService.registerDevices(from, deviceIds);
|
axolotlService.registerDevices(from, deviceIds);
|
||||||
} else if (Namespace.BOOKMARKS.equals(node) && account.getJid().asBareJid().equals(from)) {
|
} else if (Namespace.BOOKMARKS.equals(node) && account.getJid().asBareJid().equals(from)) {
|
||||||
if (account.getXmppConnection().getFeatures().bookmarksConversion()) {
|
if (account.getXmppConnection().getFeatures().bookmarksConversion()) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ public final class Namespace {
|
||||||
public static final String NICK = "http://jabber.org/protocol/nick";
|
public static final String NICK = "http://jabber.org/protocol/nick";
|
||||||
public static final String FLEXIBLE_OFFLINE_MESSAGE_RETRIEVAL = "http://jabber.org/protocol/offline";
|
public static final String FLEXIBLE_OFFLINE_MESSAGE_RETRIEVAL = "http://jabber.org/protocol/offline";
|
||||||
public static final String BIND = "urn:ietf:params:xml:ns:xmpp-bind";
|
public static final String BIND = "urn:ietf:params:xml:ns:xmpp-bind";
|
||||||
public static final String BIND2 = "urn:xmpp:bind2:1";
|
public static final String BIND2 = "urn:xmpp:bind:0";
|
||||||
public static final String STREAM_MANAGEMENT = "urn:xmpp:sm:3";
|
public static final String STREAM_MANAGEMENT = "urn:xmpp:sm:3";
|
||||||
public static final String CSI = "urn:xmpp:csi:0";
|
public static final String CSI = "urn:xmpp:csi:0";
|
||||||
public static final String CARBONS = "urn:xmpp:carbons:2";
|
public static final String CARBONS = "urn:xmpp:carbons:2";
|
||||||
|
|
|
@ -60,7 +60,6 @@ import javax.net.ssl.SSLSocketFactory;
|
||||||
import javax.net.ssl.X509KeyManager;
|
import javax.net.ssl.X509KeyManager;
|
||||||
import javax.net.ssl.X509TrustManager;
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
import eu.siacs.conversations.BuildConfig;
|
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.crypto.XmppDomainVerifier;
|
import eu.siacs.conversations.crypto.XmppDomainVerifier;
|
||||||
|
@ -1233,16 +1232,16 @@ public class XmppConnection implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void authenticate(final SaslMechanism.Version version) throws IOException {
|
private void authenticate(final SaslMechanism.Version version) throws IOException {
|
||||||
final Element element;
|
final Element authElement;
|
||||||
if (version == SaslMechanism.Version.SASL) {
|
if (version == SaslMechanism.Version.SASL) {
|
||||||
element = this.streamFeatures.findChild("mechanisms", Namespace.SASL);
|
authElement = this.streamFeatures.findChild("mechanisms", Namespace.SASL);
|
||||||
} else {
|
} else {
|
||||||
element = this.streamFeatures.findChild("authentication", Namespace.SASL_2);
|
authElement = this.streamFeatures.findChild("authentication", Namespace.SASL_2);
|
||||||
}
|
}
|
||||||
final Collection<String> mechanisms =
|
final Collection<String> mechanisms =
|
||||||
Collections2.transform(
|
Collections2.transform(
|
||||||
Collections2.filter(
|
Collections2.filter(
|
||||||
element.getChildren(),
|
authElement.getChildren(),
|
||||||
c -> c != null && "mechanism".equals(c.getName())),
|
c -> c != null && "mechanism".equals(c.getName())),
|
||||||
c -> c == null ? null : c.getContent());
|
c -> c == null ? null : c.getContent());
|
||||||
final Element cbElement =
|
final Element cbElement =
|
||||||
|
@ -1297,24 +1296,29 @@ public class XmppConnection implements Runnable {
|
||||||
}
|
}
|
||||||
final Element userAgent = authenticate.addChild("user-agent");
|
final Element userAgent = authenticate.addChild("user-agent");
|
||||||
userAgent.setAttribute("id", account.getUuid());
|
userAgent.setAttribute("id", account.getUuid());
|
||||||
userAgent.addChild("software").setContent(mXmppConnectionService.getString(R.string.app_name));
|
userAgent
|
||||||
|
.addChild("software")
|
||||||
|
.setContent(mXmppConnectionService.getString(R.string.app_name));
|
||||||
if (!PhoneHelper.isEmulator()) {
|
if (!PhoneHelper.isEmulator()) {
|
||||||
userAgent
|
userAgent
|
||||||
.addChild("device")
|
.addChild("device")
|
||||||
.setContent(String.format("%s %s", Build.MANUFACTURER, Build.MODEL));
|
.setContent(String.format("%s %s", Build.MANUFACTURER, Build.MODEL));
|
||||||
}
|
}
|
||||||
final Element inline = this.streamFeatures.findChild("inline", Namespace.SASL_2);
|
final Element inline = authElement.findChild("inline", Namespace.SASL_2);
|
||||||
final boolean inlineStreamManagement =
|
final boolean inlineStreamManagement =
|
||||||
inline != null && inline.hasChild("sm", "urn:xmpp:sm:3");
|
inline != null && inline.hasChild("sm", "urn:xmpp:sm:3");
|
||||||
final boolean inlineBind2 = inline != null && inline.hasChild("bind", Namespace.BIND2);
|
final Element inlineBind2 =
|
||||||
final Element inlineBindFeatures =
|
inline != null ? inline.findChild("bind", Namespace.BIND2) : null;
|
||||||
this.streamFeatures.findChild("inline", Namespace.BIND2);
|
final Element inlineBind2Inline =
|
||||||
if (inlineBind2 && inlineBindFeatures != null) {
|
inlineBind2 != null ? inlineBind2.findChild("inline", Namespace.BIND2) : null;
|
||||||
|
if (inlineBind2 != null) {
|
||||||
final Element bind =
|
final Element bind =
|
||||||
generateBindRequest(
|
generateBindRequest(
|
||||||
Collections2.transform(
|
inlineBind2Inline == null
|
||||||
inlineBindFeatures.getChildren(),
|
? Collections.emptyList()
|
||||||
c -> c == null ? null : c.getAttribute("var")));
|
: Collections2.transform(
|
||||||
|
inlineBind2Inline.getChildren(),
|
||||||
|
c -> c == null ? null : c.getAttribute("var")));
|
||||||
authenticate.addChild(bind);
|
authenticate.addChild(bind);
|
||||||
}
|
}
|
||||||
if (inlineStreamManagement && streamId != null) {
|
if (inlineStreamManagement && streamId != null) {
|
||||||
|
|
Loading…
Reference in a new issue