From 8df97067bb2f1cbe062e046fa07c80836028152f Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 22 Jan 2023 12:51:04 +0100 Subject: [PATCH] discover commands on domain --- src/main/java/eu/siacs/conversations/xml/Element.java | 2 +- .../android/database/entity/DiscoItemEntity.java | 5 ++++- .../im/conversations/android/xmpp/XmppConnection.java | 2 +- .../android/xmpp/manager/DiscoManager.java | 4 ++-- .../android/xmpp/processor/BindProcessor.java | 10 ++++++++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/xml/Element.java b/src/main/java/eu/siacs/conversations/xml/Element.java index f8e9e523b..e859f380e 100644 --- a/src/main/java/eu/siacs/conversations/xml/Element.java +++ b/src/main/java/eu/siacs/conversations/xml/Element.java @@ -37,7 +37,7 @@ public class Element { return child; } - public T addChild(T child) { + public T addExtension(T child) { this.addChild(child); return child; } diff --git a/src/main/java/im/conversations/android/database/entity/DiscoItemEntity.java b/src/main/java/im/conversations/android/database/entity/DiscoItemEntity.java index 0bfd9b69d..b0a88496b 100644 --- a/src/main/java/im/conversations/android/database/entity/DiscoItemEntity.java +++ b/src/main/java/im/conversations/android/database/entity/DiscoItemEntity.java @@ -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; } diff --git a/src/main/java/im/conversations/android/xmpp/XmppConnection.java b/src/main/java/im/conversations/android/xmpp/XmppConnection.java index b5d323179..14f9523be 100644 --- a/src/main/java/im/conversations/android/xmpp/XmppConnection.java +++ b/src/main/java/im/conversations/android/xmpp/XmppConnection.java @@ -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(); } diff --git a/src/main/java/im/conversations/android/xmpp/manager/DiscoManager.java b/src/main/java/im/conversations/android/xmpp/manager/DiscoManager.java index e0af50364..c7e234af8 100644 --- a/src/main/java/im/conversations/android/xmpp/manager/DiscoManager.java +++ b/src/main/java/im/conversations/android/xmpp/manager/DiscoManager.java @@ -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); } diff --git a/src/main/java/im/conversations/android/xmpp/processor/BindProcessor.java b/src/main/java/im/conversations/android/xmpp/processor/BindProcessor.java index 89fd121f8..6712a6f8c 100644 --- a/src/main/java/im/conversations/android/xmpp/processor/BindProcessor.java +++ b/src/main/java/im/conversations/android/xmpp/processor/BindProcessor.java @@ -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