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