include node when requesting disco features
This commit is contained in:
parent
afb7c0592b
commit
fa13d2336e
|
@ -44,19 +44,22 @@ public class Presence implements Comparable {
|
||||||
private ServiceDiscoveryResult disco;
|
private ServiceDiscoveryResult disco;
|
||||||
private final String ver;
|
private final String ver;
|
||||||
private final String hash;
|
private final String hash;
|
||||||
|
private final String node;
|
||||||
private final String message;
|
private final String message;
|
||||||
|
|
||||||
private Presence(Status status, String ver, String hash, String message) {
|
private Presence(Status status, String ver, String hash, String node, String message) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.ver = ver;
|
this.ver = ver;
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
|
this.node = node;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Presence parse(String show, Element caps, String message) {
|
public static Presence parse(String show, Element caps, String message) {
|
||||||
final String hash = caps == null ? null : caps.getAttribute("hash");
|
final String hash = caps == null ? null : caps.getAttribute("hash");
|
||||||
final String ver = caps == null ? null : caps.getAttribute("ver");
|
final String ver = caps == null ? null : caps.getAttribute("ver");
|
||||||
return new Presence(Status.fromShowString(show), ver, hash, message);
|
final String node = caps == null ? null : caps.getAttribute("node");
|
||||||
|
return new Presence(Status.fromShowString(show), ver, hash, node, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compareTo(Object other) {
|
public int compareTo(Object other) {
|
||||||
|
@ -75,6 +78,10 @@ public class Presence implements Comparable {
|
||||||
return this.ver;
|
return this.ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getNode() {
|
||||||
|
return this.node;
|
||||||
|
}
|
||||||
|
|
||||||
public String getHash() {
|
public String getHash() {
|
||||||
return this.hash;
|
return this.hash;
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,6 +166,15 @@ public class XmppConnectionService extends Service {
|
||||||
private final IqGenerator mIqGenerator = new IqGenerator(this);
|
private final IqGenerator mIqGenerator = new IqGenerator(this);
|
||||||
private final List<String> mInProgressAvatarFetches = new ArrayList<>();
|
private final List<String> mInProgressAvatarFetches = new ArrayList<>();
|
||||||
private final HashSet<Jid> mLowPingTimeoutMode = new HashSet<>();
|
private final HashSet<Jid> mLowPingTimeoutMode = new HashSet<>();
|
||||||
|
private final OnIqPacketReceived mDefaultIqHandler = (account, packet) -> {
|
||||||
|
if (packet.getType() != IqPacket.TYPE.RESULT) {
|
||||||
|
Element error = packet.findChild("error");
|
||||||
|
String text = error != null ? error.findChildContent("text") : null;
|
||||||
|
if (text != null) {
|
||||||
|
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received iq error - " + text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
public DatabaseBackend databaseBackend;
|
public DatabaseBackend databaseBackend;
|
||||||
private ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor(true);
|
private ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor(true);
|
||||||
private long mLastActivity = 0;
|
private long mLastActivity = 0;
|
||||||
|
@ -188,15 +197,6 @@ public class XmppConnectionService extends Service {
|
||||||
private OnMessagePacketReceived mMessageParser = new MessageParser(this);
|
private OnMessagePacketReceived mMessageParser = new MessageParser(this);
|
||||||
private OnPresencePacketReceived mPresenceParser = new PresenceParser(this);
|
private OnPresencePacketReceived mPresenceParser = new PresenceParser(this);
|
||||||
private IqParser mIqParser = new IqParser(this);
|
private IqParser mIqParser = new IqParser(this);
|
||||||
private final OnIqPacketReceived mDefaultIqHandler = (account, packet) -> {
|
|
||||||
if (packet.getType() != IqPacket.TYPE.RESULT) {
|
|
||||||
Element error = packet.findChild("error");
|
|
||||||
String text = error != null ? error.findChildContent("text") : null;
|
|
||||||
if (text != null) {
|
|
||||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received iq error - " + text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
private MessageGenerator mMessageGenerator = new MessageGenerator(this);
|
private MessageGenerator mMessageGenerator = new MessageGenerator(this);
|
||||||
public OnContactStatusChanged onContactStatusChanged = (contact, online) -> {
|
public OnContactStatusChanged onContactStatusChanged = (contact, online) -> {
|
||||||
Conversation conversation = find(getConversations(), contact);
|
Conversation conversation = find(getConversations(), contact);
|
||||||
|
@ -3653,19 +3653,23 @@ public class XmppConnectionService extends Service {
|
||||||
account.inProgressDiscoFetches.add(key);
|
account.inProgressDiscoFetches.add(key);
|
||||||
IqPacket request = new IqPacket(IqPacket.TYPE.GET);
|
IqPacket request = new IqPacket(IqPacket.TYPE.GET);
|
||||||
request.setTo(jid);
|
request.setTo(jid);
|
||||||
request.query("http://jabber.org/protocol/disco#info");
|
String node = presence.getNode();
|
||||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": making disco request for " + key.second + " to " + jid);
|
Element query = request.query("http://jabber.org/protocol/disco#info");
|
||||||
sendIqPacket(account, request, (account1, discoPacket) -> {
|
if (node != null) {
|
||||||
|
query.setAttribute("node",node);
|
||||||
|
}
|
||||||
|
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": making disco request for " + key.second + " to " + jid+ "node="+node);
|
||||||
|
sendIqPacket(account, request, (a, discoPacket) -> {
|
||||||
if (discoPacket.getType() == IqPacket.TYPE.RESULT) {
|
if (discoPacket.getType() == IqPacket.TYPE.RESULT) {
|
||||||
ServiceDiscoveryResult disco1 = new ServiceDiscoveryResult(discoPacket);
|
ServiceDiscoveryResult disco1 = new ServiceDiscoveryResult(discoPacket);
|
||||||
if (presence.getVer().equals(disco1.getVer())) {
|
if (presence.getVer().equals(disco1.getVer())) {
|
||||||
databaseBackend.insertDiscoveryResult(disco1);
|
databaseBackend.insertDiscoveryResult(disco1);
|
||||||
injectServiceDiscorveryResult(account1.getRoster(), presence.getHash(), presence.getVer(), disco1);
|
injectServiceDiscorveryResult(a.getRoster(), presence.getHash(), presence.getVer(), disco1);
|
||||||
} else {
|
} else {
|
||||||
Log.d(Config.LOGTAG, account1.getJid().asBareJid() + ": mismatch in caps for contact " + jid + " " + presence.getVer() + " vs " + disco1.getVer());
|
Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": mismatch in caps for contact " + jid + " " + presence.getVer() + " vs " + disco1.getVer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
account1.inProgressDiscoFetches.remove(key);
|
a.inProgressDiscoFetches.remove(key);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue