borogove

created pr with borogove/compare-to-bare-jid.1 on 2026-11-18T15:51:30Z · by 3c31bc8c
commented on 2026-11-18T15:51:30Z · by 3c31bc8c
Changes are available at https://tangled.org/mrry.band/borogove on branch compare-to-bare-jid.
cmds
checkout latest patchset:
ssh pr.pico.sh pull borogove:compare-to-bare-jid | git am -3
checkout specific patchset revision:
ssh pr.pico.sh pull borogove:compare-to-bare-jid [rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh borogove:compare-to-bare-jid
add comment to patch request:
ssh pr.pico.sh comment borogove:compare-to-bare-jid "lgtm!"

Patchset borogove/compare-to-bare-jid.1 on 2026-11-18T15:51:30Z · commit 34eda96

Fix commands by comparing to bare jid
Eric Roberts 2026-11-18T15:49:54Z
We had bareJid already and it was unused so this appears to just be a
mistake.
Diff stat
test/TestChat.hx | 29 +++++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
Semantic diff summary
0 added, 0 modified, 0 signature changed, 0 removed across 0 analyzed files (2 files skipped: unsupported file type)
+1 -1 borogove/Chat.hx #
......@@ -998,7 +998,7 @@ abstract class Chat extends EventEmitter {
998998 resolve((itemsGet.getResult() ?? []).filter(item ->
999999 // Remove advertisement of commands at other JIDs for now
10001000 // It's a potential security/privacy issue depending on UX
1001- item.jid != null && item.jid.asBare().equals(jid) && item.node != null
1001+ item.jid != null && item.jid.asBare().equals(bareJid) && item.node != null
10021002 ).map(item -> new Command(client, item)));
10031003 });
10041004 client.sendQuery(itemsGet);
+29 -0 test/TestChat.hx #
......@@ -415,6 +415,35 @@ class TestChat extends utest.Test {
415415 chat.moderate(message, "Spam");
416416 }
417417
418+ public function testCommandsFromResourceFiltersByBareJid(async: Async) {
419+ final client = new Client("test@example.com", new Dummy());
420+ final chat = client.getDirectChat("friend@example.com");
421+ final caps = new borogove.Caps("", [], ["http://jabber.org/protocol/commands"], []);
422+ chat.presence.set("desktop", new Presence(caps, null, null));
423+ client.capsRepo.add(caps);
424+
425+ client.stream.on("sendStanza", (stanza: Stanza) -> {
426+ Assert.equals("friend@example.com/desktop", stanza.attr.get("to"));
427+ client.stream.onStanza(
428+ new Stanza("iq", {
429+ xmlns: "jabber:client",
430+ type: "result",
431+ id: stanza.attr.get("id"),
432+ from: stanza.attr.get("to")
433+ }).tag("query", { xmlns: "http://jabber.org/protocol/disco#items" })
434+ .tag("item", { jid: "friend@example.com", node: "same-account" }).up()
435+ .tag("item", { jid: "other@example.com/desktop", node: "other-account" }).up()
436+ .up()
437+ );
438+ return EventHandled;
439+ });
440+
441+ chat.commands().then(commands -> {
442+ Assert.same(["same-account"], commands.map(command -> command.node));
443+ async.done();
444+ });
445+ }
446+
418447 public function testChannelCommandsReturnsSettingsForOwner(async: Async) {
419448 final persistence = new Dummy();
420449 final client = new Client("test@example.com", persistence);
Back to top