borogove
created pr with
borogove/compare-to-bare-jid.1
commented
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 -3checkout specific patchset revision:
ssh pr.pico.sh pull borogove:compare-to-bare-jid [rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh borogove:compare-to-bare-jidadd comment to patch request:
ssh pr.pico.sh comment borogove:compare-to-bare-jid "lgtm!"
Patchset
borogove/compare-to-bare-jid.1
Fix commands by comparing to bare jid
Eric Roberts
2026-11-18T15:49:54ZWe had bareJid already and it was unused so this appears to just be a mistake.
Diff stat
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 { | |
| 998 | 998 | resolve((itemsGet.getResult() ?? []).filter(item -> | |
| 999 | 999 | // Remove advertisement of commands at other JIDs for now | |
| 1000 | 1000 | // 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 | |
| 1002 | 1002 | ).map(item -> new Command(client, item))); | |
| 1003 | 1003 | }); | |
| 1004 | 1004 | client.sendQuery(itemsGet); |
+29
-0
test/TestChat.hx
#
| ... | ... | @@ -415,6 +415,35 @@ class TestChat extends utest.Test { | |
| 415 | 415 | chat.moderate(message, "Spam"); | |
| 416 | 416 | } | |
| 417 | 417 | ||
| 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 | + | ||
| 418 | 447 | public function testChannelCommandsReturnsSettingsForOwner(async: Async) { | |
| 419 | 448 | final persistence = new Dummy(); | |
| 420 | 449 | final client = new Client("test@example.com", persistence); |