borogove
created pr with
borogove/multi-dm.1
added borogove/multi-dm.2
1: 0ef2769 = 1: 41e89c8 Use to for chatId if not in recipients
2: 90e5a6a = 2: c323e3d clone should clone attributes
3: d86ea28 = 3: a1199ae Actually send to all recipients
4: 1c1061f ! 4: 94bf87d Never add self as counterpart
5: 9c8aa41 = 5: 32b9fad Extended addressing for sent messages specifies all recipients
6: 2da9124 = 6: ce4d9e1 Always add all recipients to outbound message
7: e7db006 = 7: 350343e Use a shared helper for adding extended addressing
8: 4530ece = 8: 40f662a Add startMultiChat to create multiDMs
9: 6810ba9 = 9: 8043c53 Never include ourselves in incoming chat ids
-: ------- > 10: 68e7246 Cannot MAM or bookmark a multiDM
cmds
checkout latest patchset:
ssh pr.pico.sh pull borogove:multi-dm | git am -3checkout specific patchset revision:
ssh pr.pico.sh pull borogove:multi-dm [rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh borogove:multi-dmadd comment to patch request:
ssh pr.pico.sh comment borogove:multi-dm "lgtm!"
Patchset
borogove/multi-dm.1
Use to for chatId if not in recipients
Stephen Paul Weber
clone should clone attributes
2026-11-08T19:15:14ZStephen Paul Weber
Actually send to all recipients
2026-11-09T16:18:06ZStephen Paul Weber
Never add self as counterpart
2026-11-09T16:24:50ZStephen Paul Weber
Extended addressing for sent messages specifies all recipients
2026-11-08T19:20:04ZStephen Paul Weber
→ Always add all recipients to outbound message
2026-11-08T19:20:46ZStephen Paul Weber
Use a shared helper for adding extended addressing
2026-11-08T19:21:50ZStephen Paul Weber
Add startMultiChat to create multiDMs
2026-11-08T19:32:30ZStephen Paul Weber
Never include ourselves in incoming chat ids
2026-11-08T21:01:35ZStephen Paul Weber
2026-11-09T19:40:59Z
Always add all recipients to outbound message
Stephen Paul Weber
2026-11-08T19:21:50ZSemantic diff summary
0 added,
0 modified,
0 signature changed,
0 removed
across 0 analyzed files
(2 files skipped: unsupported file type)
+4
-8
borogove/Chat.hx
#
| ... | ... | @@ -1276,8 +1276,8 @@ class DirectChat extends Chat { | |
| 1276 | 1276 | message.from = client.jid; | |
| 1277 | 1277 | message.sender = message.from.asBare(); | |
| 1278 | 1278 | message.replyTo = [message.sender]; | |
| 1279 | - | message.recipients = counterparts().map((p) -> JID.parse(p)); | |
| 1280 | - | message.to = message.recipients[0]; | |
| 1279 | + | message.recipients = _fullCounterparts.map((p) -> JID.parse(p)); | |
| 1280 | + | message.to = JID.parse(counterparts()[0]); | |
| 1281 | 1281 | if (message.localId == null) message.localId = ID.unique(); | |
| 1282 | 1282 | return message; | |
| 1283 | 1283 | } |
| ... | ... | @@ -1307,11 +1307,10 @@ class DirectChat extends Chat { | |
| 1307 | 1307 | if (typingTimer != null) typingTimer.stop(); | |
| 1308 | 1308 | client.chatActivity(this); | |
| 1309 | 1309 | message = prepareOutgoingMessage(message); | |
| 1310 | - | message.to = message.recipients[0]; // Just pick one for the stanza we re-parse | |
| 1310 | + | final outboxItem = outbox.newItem(); | |
| 1311 | 1311 | final fromStanza = Message.fromStanza(message.build().asStanza(), client.jid).parsed; | |
| 1312 | 1312 | switch (fromStanza) { | |
| 1313 | 1313 | case ChatMessageStanza(_): | |
| 1314 | - | final outboxItem = outbox.newItem(); | |
| 1315 | 1314 | client.storeMessageBuilder(message).then((stored) -> { | |
| 1316 | 1315 | final stanza = message.build().asStanza(); | |
| 1317 | 1316 | if (isActive != null) { |
| ... | ... | @@ -1327,10 +1326,7 @@ class DirectChat extends Chat { | |
| 1327 | 1326 | }); | |
| 1328 | 1327 | case ReactionUpdateStanza(update): | |
| 1329 | 1328 | persistence.storeReaction(client.accountId(), update).then((stored) -> { | |
| 1330 | - | for (recipient in message.recipients) { | |
| 1331 | - | message.to = recipient; | |
| 1332 | - | client.sendStanza(message.build().asStanza()); | |
| 1333 | - | } | |
| 1329 | + | sendMessageStanza(message.build().asStanza(), outboxItem, e2eePreference); | |
| 1334 | 1330 | if (stored != null) client.notifyMessageHandlers(stored, ReactionEvent); | |
| 1335 | 1331 | }); | |
| 1336 | 1332 | default: |
+33
-0
test/TestChat.hx
#
| ... | ... | @@ -1167,6 +1167,39 @@ class TestChat extends utest.Test { | |
| 1167 | 1167 | } | |
| 1168 | 1168 | #end | |
| 1169 | 1169 | ||
| 1170 | + | public function testSendMessageMultiDMSendsOnlyToRoutingJid(async: Async) { | |
| 1171 | + | final persistence = new RecordingPersistence(); | |
| 1172 | + | final client = new Client("me@example.com", persistence); | |
| 1173 | + | final routing = "multi@example.com"; | |
| 1174 | + | final chat = new borogove.Chat.DirectChat(client, client.stream, persistence, routing); | |
| 1175 | + | chat._fullCounterparts = ["bob@example.com", "carol@example.com"]; | |
| 1176 | + | ||
| 1177 | + | client.stream.on("sendStanza", (stanza: Stanza) -> { | |
| 1178 | + | if (stanza.name != "message" || stanza.getChildText("body") != "hello") return EventUnhandled; | |
| 1179 | + | ||
| 1180 | + | Assert.equals(1, persistence.storedMessages.length); | |
| 1181 | + | if (persistence.storedMessages.length > 0) { | |
| 1182 | + | final stored = persistence.storedMessages[0]; | |
| 1183 | + | Assert.equals(routing, stored.chatId()); | |
| 1184 | + | Assert.equals(routing, stored.to?.asString()); | |
| 1185 | + | Assert.same(["bob@example.com", "carol@example.com"], stored.recipients.map(r -> r.asBare().asString())); | |
| 1186 | + | } | |
| 1187 | + | ||
| 1188 | + | Assert.equals(routing, stanza.attr.get("to")); | |
| 1189 | + | final addresses = stanza.getChild("addresses", "http://jabber.org/protocol/address"); | |
| 1190 | + | Assert.notNull(addresses); | |
| 1191 | + | if (addresses != null) { | |
| 1192 | + | Assert.same(["bob@example.com", "carol@example.com"], addresses.allTags("address").map(a -> a.attr.get("jid"))); | |
| 1193 | + | } | |
| 1194 | + | async.done(); | |
| 1195 | + | return EventHandled; | |
| 1196 | + | }); | |
| 1197 | + | ||
| 1198 | + | final builder = new ChatMessageBuilder(); | |
| 1199 | + | builder.text = "hello"; | |
| 1200 | + | chat.sendMessage(builder, borogove.Chat.OutgoingE2EEPreference.NoE2EE); | |
| 1201 | + | } | |
| 1202 | + | ||
| 1170 | 1203 | public function testSendMessageExtendedMultiDMSendsToEachParticipant(async: Async) { | |
| 1171 | 1204 | final persistence = new RecordingPersistence(); | |
| 1172 | 1205 | final client = new Client("me@example.com", persistence); |