aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-04-27 23:55:16 +0200
committerChristian Schneppe <christian@pix-art.de>2018-04-27 23:55:16 +0200
commit4edd1b09946b861779e131c4a9c1c761ea445035 (patch)
treed94534f8f49c1aa9202617ef22db2f8385bcbb4a /src/main/java/de/pixart
parent5a1105d37a87eaf1c369d9f8d9b7e67d6a0e1cd4 (diff)
include node when requesting disco features
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r--src/main/java/de/pixart/messenger/entities/Presence.java11
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java34
2 files changed, 28 insertions, 17 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Presence.java b/src/main/java/de/pixart/messenger/entities/Presence.java
index af467f1f6..e21da6b37 100644
--- a/src/main/java/de/pixart/messenger/entities/Presence.java
+++ b/src/main/java/de/pixart/messenger/entities/Presence.java
@@ -47,19 +47,22 @@ public class Presence implements Comparable {
private ServiceDiscoveryResult disco;
private final String ver;
private final String hash;
+ private final String node;
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.ver = ver;
this.hash = hash;
+ this.node = node;
this.message = message;
}
public static Presence parse(String show, Element caps, String message) {
final String hash = caps == null ? null : caps.getAttribute("hash");
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) {
@@ -78,6 +81,10 @@ public class Presence implements Comparable {
return this.ver;
}
+ public String getNode() {
+ return this.node;
+ }
+
public String getHash() {
return this.hash;
}
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index d0240251c..ef98b6aa6 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -178,6 +178,15 @@ public class XmppConnectionService extends Service {
private final IqGenerator mIqGenerator = new IqGenerator(this);
private final List<String> mInProgressAvatarFetches = new ArrayList<>();
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;
private ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor(true);
private long mLastActivity = 0;
@@ -200,15 +209,6 @@ public class XmppConnectionService extends Service {
private OnMessagePacketReceived mMessageParser = new MessageParser(this);
private OnPresencePacketReceived mPresenceParser = new PresenceParser(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);
public OnContactStatusChanged onContactStatusChanged = (contact, online) -> {
Conversation conversation = find(getConversations(), contact);
@@ -4011,19 +4011,23 @@ public class XmppConnectionService extends Service {
account.inProgressDiscoFetches.add(key);
IqPacket request = new IqPacket(IqPacket.TYPE.GET);
request.setTo(jid);
- request.query("http://jabber.org/protocol/disco#info");
- Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": making disco request for " + key.second + " to " + jid);
- sendIqPacket(account, request, (account1, discoPacket) -> {
+ String node = presence.getNode();
+ Element query = request.query("http://jabber.org/protocol/disco#info");
+ 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) {
ServiceDiscoveryResult disco1 = new ServiceDiscoveryResult(discoPacket);
if (presence.getVer().equals(disco1.getVer())) {
databaseBackend.insertDiscoveryResult(disco1);
- injectServiceDiscorveryResult(account1.getRoster(), presence.getHash(), presence.getVer(), disco1);
+ injectServiceDiscorveryResult(a.getRoster(), presence.getHash(), presence.getVer(), disco1);
} 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);
});
}
}