add more logging to caps fetching
This commit is contained in:
parent
8059aa7b0d
commit
971bb60f42
|
@ -2778,6 +2778,7 @@ public class XmppConnectionService extends Service {
|
|||
updateConversationUi();
|
||||
}
|
||||
}
|
||||
|
||||
private void fetchConferenceMembers(final Conversation conversation) {
|
||||
final Account account = conversation.getAccount();
|
||||
final AxolotlService axolotlService = account.getAxolotlService();
|
||||
|
@ -3304,7 +3305,7 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
|
||||
public void createMessageAsync(final Message message) {
|
||||
mDatabaseWriterExecutor.execute(()-> databaseBackend.createMessage(message));
|
||||
mDatabaseWriterExecutor.execute(() -> databaseBackend.createMessage(message));
|
||||
}
|
||||
|
||||
public void updateMessage(Message message, String uuid) {
|
||||
|
@ -4444,34 +4445,38 @@ public class XmppConnectionService extends Service {
|
|||
|
||||
public void fetchCaps(Account account, final Jid jid, final Presence presence) {
|
||||
final Pair<String, String> key = new Pair<>(presence.getHash(), presence.getVer());
|
||||
ServiceDiscoveryResult disco = getCachedServiceDiscoveryResult(key);
|
||||
final ServiceDiscoveryResult disco = getCachedServiceDiscoveryResult(key);
|
||||
if (disco != null) {
|
||||
presence.setServiceDiscoveryResult(disco);
|
||||
} else {
|
||||
if (!account.inProgressDiscoFetches.contains(key)) {
|
||||
account.inProgressDiscoFetches.add(key);
|
||||
IqPacket request = new IqPacket(IqPacket.TYPE.GET);
|
||||
request.setTo(jid);
|
||||
final String node = presence.getNode();
|
||||
final String ver = presence.getVer();
|
||||
final Element query = request.query(Namespace.DISCO_INFO);
|
||||
if (node != null && ver != null) {
|
||||
query.setAttribute("node", node + "#" + ver);
|
||||
}
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": making disco request for " + key.second + " to " + jid);
|
||||
sendIqPacket(account, request, (a, response) -> {
|
||||
if (response.getType() == IqPacket.TYPE.RESULT) {
|
||||
ServiceDiscoveryResult discoveryResult = new ServiceDiscoveryResult(response);
|
||||
if (presence.getVer().equals(discoveryResult.getVer())) {
|
||||
databaseBackend.insertDiscoveryResult(discoveryResult);
|
||||
injectServiceDiscoveryResult(a.getRoster(), presence.getHash(), presence.getVer(), discoveryResult);
|
||||
} else {
|
||||
Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": mismatch in caps for contact " + jid + " " + presence.getVer() + " vs " + discoveryResult.getVer());
|
||||
}
|
||||
}
|
||||
a.inProgressDiscoFetches.remove(key);
|
||||
});
|
||||
if (account.inProgressDiscoFetches.contains(key)) {
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": skipping duplicate disco request for " + key.second + " to " + jid);
|
||||
return;
|
||||
}
|
||||
account.inProgressDiscoFetches.add(key);
|
||||
final IqPacket request = new IqPacket(IqPacket.TYPE.GET);
|
||||
request.setTo(jid);
|
||||
final String node = presence.getNode();
|
||||
final String ver = presence.getVer();
|
||||
final Element query = request.query(Namespace.DISCO_INFO);
|
||||
if (node != null && ver != null) {
|
||||
query.setAttribute("node", node + "#" + ver);
|
||||
}
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": making disco request for " + key.second + " to " + jid);
|
||||
sendIqPacket(account, request, (a, response) -> {
|
||||
if (response.getType() == IqPacket.TYPE.RESULT) {
|
||||
ServiceDiscoveryResult discoveryResult = new ServiceDiscoveryResult(response);
|
||||
if (presence.getVer().equals(discoveryResult.getVer())) {
|
||||
databaseBackend.insertDiscoveryResult(discoveryResult);
|
||||
injectServiceDiscoveryResult(a.getRoster(), presence.getHash(), presence.getVer(), discoveryResult);
|
||||
} else {
|
||||
Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": mismatch in caps for contact " + jid + " " + presence.getVer() + " vs " + discoveryResult.getVer());
|
||||
}
|
||||
} else {
|
||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": unable to fetch caps from " + jid);
|
||||
}
|
||||
a.inProgressDiscoFetches.remove(key);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue