discover commands on domain
This commit is contained in:
parent
bd343eafa0
commit
8df97067bb
|
@ -37,7 +37,7 @@ public class Element {
|
|||
return child;
|
||||
}
|
||||
|
||||
public <T extends Extension> T addChild(T child) {
|
||||
public <T extends Extension> T addExtension(T child) {
|
||||
this.addChild(child);
|
||||
return child;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ import im.conversations.android.xmpp.model.disco.items.Item;
|
|||
})
|
||||
public class DiscoItemEntity {
|
||||
|
||||
private static final String EMPTY_STRING = "";
|
||||
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
public Long id;
|
||||
|
||||
|
@ -66,7 +68,8 @@ public class DiscoItemEntity {
|
|||
entity.accountId = accountId;
|
||||
entity.address = address;
|
||||
entity.node = Strings.nullToEmpty(node);
|
||||
entity.parentAddress = "";
|
||||
entity.parentAddress = EMPTY_STRING;
|
||||
entity.parentNode = EMPTY_STRING;
|
||||
entity.discoId = discoId;
|
||||
return entity;
|
||||
}
|
||||
|
|
|
@ -1922,7 +1922,7 @@ public class XmppConnection implements Runnable {
|
|||
|
||||
@Override
|
||||
public void onFailure(@NonNull Throwable t) {
|
||||
Log.d(Config.LOGTAG, "unable to fetch disco foo " + t);
|
||||
Log.d(Config.LOGTAG, "unable to fetch disco", t);
|
||||
// TODO reset stream ID so we get a proper connect next time
|
||||
finalizeBind();
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class DiscoManager extends AbstractManager {
|
|||
final var requestNode = hash != null && node != null ? hash.capabilityNode(node) : node;
|
||||
final var iqRequest = new IqPacket(IqPacket.TYPE.GET);
|
||||
iqRequest.setTo(entity.address);
|
||||
final var infoQueryRequest = iqRequest.addChild(new InfoQuery());
|
||||
final InfoQuery infoQueryRequest = iqRequest.addExtension(new InfoQuery());
|
||||
if (requestNode != null) {
|
||||
infoQueryRequest.setNode(requestNode);
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public class DiscoManager extends AbstractManager {
|
|||
final var requestNode = Strings.emptyToNull(node);
|
||||
final var iqPacket = new IqPacket(IqPacket.TYPE.GET);
|
||||
iqPacket.setTo(entity.address);
|
||||
final var itemsQueryRequest = iqPacket.addChild(new ItemsQuery());
|
||||
final ItemsQuery itemsQueryRequest = iqPacket.addExtension(new ItemsQuery());
|
||||
if (requestNode != null) {
|
||||
itemsQueryRequest.setNode(requestNode);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package im.conversations.android.xmpp.processor;
|
|||
import android.content.Context;
|
||||
import eu.siacs.conversations.xml.Namespace;
|
||||
import eu.siacs.conversations.xmpp.Jid;
|
||||
import im.conversations.android.xmpp.Entity;
|
||||
import im.conversations.android.xmpp.XmppConnection;
|
||||
import im.conversations.android.xmpp.manager.BlockingManager;
|
||||
import im.conversations.android.xmpp.manager.BookmarkManager;
|
||||
|
@ -33,11 +34,16 @@ public class BindProcessor extends XmppConnection.Delegate implements Consumer<J
|
|||
|
||||
getManager(RosterManager.class).fetch();
|
||||
|
||||
if (getManager(DiscoManager.class)
|
||||
.hasFeature(account.address.getDomain(), Namespace.BLOCKING)) {
|
||||
final var discoManager = getManager(DiscoManager.class);
|
||||
|
||||
if (discoManager.hasFeature(account.address.getDomain(), Namespace.BLOCKING)) {
|
||||
getManager(BlockingManager.class).fetch();
|
||||
}
|
||||
|
||||
if (discoManager.hasFeature(account.address.getDomain(), Namespace.COMMANDS)) {
|
||||
discoManager.items(Entity.discoItem(account.address.getDomain()), Namespace.COMMANDS);
|
||||
}
|
||||
|
||||
getManager(BookmarkManager.class).fetch();
|
||||
|
||||
// TODO send initial presence
|
||||
|
|
Loading…
Reference in a new issue