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.2
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
Cannot MAM or bookmark a multiDM
2026-11-09T19:40:59ZStephen Paul Weber
2026-11-10T17:34:01Z
Actually send to all recipients
Stephen Paul Weber
2026-11-09T16:24:50ZWas making the clone, but not using it
Semantic diff summary
0 added,
0 modified,
0 signature changed,
0 removed
across 0 analyzed files
(2 files skipped: unsupported file type)
+3
-3
borogove/Chat.hx
#
| ... | ... | @@ -1400,16 +1400,16 @@ class DirectChat extends Chat { | |
| 1400 | 1400 | if (e2eePreference == Default) e2eePreference = client.outgoingE2EEPreference[0]; | |
| 1401 | 1401 | #if NO_OMEMO | |
| 1402 | 1402 | if (e2eePreference != NoE2EE) throw "Selected E2EE preference unsupported"; | |
| 1403 | - | return Promise.resolve(stanza); | |
| 1403 | + | return Promise.resolve(clone); | |
| 1404 | 1404 | #else | |
| 1405 | 1405 | switch (e2eePreference) { | |
| 1406 | 1406 | case OMEMO: | |
| 1407 | 1407 | // As written this falls back to NoE2EE if allowed | |
| 1408 | - | return client.omemo.encryptMessage([JID.parse(counterpart)], stanza).then((encryptedStanza) -> { | |
| 1408 | + | return client.omemo.encryptMessage([JID.parse(counterpart)], clone).then((encryptedStanza) -> { | |
| 1409 | 1409 | return Promise.resolve(encryptedStanza); | |
| 1410 | 1410 | }); | |
| 1411 | 1411 | case NoE2EE: | |
| 1412 | - | return Promise.resolve(stanza); | |
| 1412 | + | return Promise.resolve(clone); | |
| 1413 | 1413 | case Default: | |
| 1414 | 1414 | throw "Impossible"; | |
| 1415 | 1415 | } |
+51
-0
test/TestChat.hx
#
| ... | ... | @@ -1230,6 +1230,57 @@ class TestChat extends utest.Test { | |
| 1230 | 1230 | chat.sendMessage(builder, borogove.Chat.OutgoingE2EEPreference.OMEMO); | |
| 1231 | 1231 | } | |
| 1232 | 1232 | #end | |
| 1233 | + | ||
| 1234 | + | public function testSendMessageExtendedMultiDMSendsToEachParticipant(async: Async) { | |
| 1235 | + | final persistence = new RecordingPersistence(); | |
| 1236 | + | final client = new Client("me@example.com", persistence); | |
| 1237 | + | final chat = client.getDirectChat("bob@example.com\ncarol@example.com"); | |
| 1238 | + | final sent: Array<Stanza> = []; | |
| 1239 | + | ||
| 1240 | + | client.stream.on("sendStanza", (stanza: Stanza) -> { | |
| 1241 | + | if (stanza.name != "message" || stanza.getChildText("body") != "hello") return EventUnhandled; | |
| 1242 | + | sent.push(stanza); | |
| 1243 | + | if (sent.length < 2) return EventUnhandled; | |
| 1244 | + | ||
| 1245 | + | final tos = sent.map(s -> s.attr.get("to")); | |
| 1246 | + | tos.sort(Reflect.compare); | |
| 1247 | + | Assert.same(["bob@example.com", "carol@example.com"], tos); | |
| 1248 | + | for (s in sent) { | |
| 1249 | + | final addresses = s.getChild("addresses", "http://jabber.org/protocol/address"); | |
| 1250 | + | Assert.notNull(addresses); | |
| 1251 | + | if (addresses != null) { | |
| 1252 | + | final jids = addresses.allTags("address").map(a -> a.attr.get("jid")); | |
| 1253 | + | jids.sort(Reflect.compare); | |
| 1254 | + | Assert.same(["bob@example.com", "carol@example.com"], jids); | |
| 1255 | + | } | |
| 1256 | + | } | |
| 1257 | + | ||
| 1258 | + | Assert.equals(1, persistence.storedMessages.length); | |
| 1259 | + | if (persistence.storedMessages.length > 0) { | |
| 1260 | + | final stored = persistence.storedMessages[0]; | |
| 1261 | + | Assert.equals(chat.chatId, stored.chatId()); | |
| 1262 | + | Assert.equals("bob@example.com", stored.to?.asString()); | |
| 1263 | + | Assert.same(["bob@example.com", "carol@example.com"], stored.recipients.map(r -> r.asBare().asString())); | |
| 1264 | + | } | |
| 1265 | + | async.done(); | |
| 1266 | + | return EventHandled; | |
| 1267 | + | }); | |
| 1268 | + | ||
| 1269 | + | final builder = new ChatMessageBuilder(); | |
| 1270 | + | builder.text = "hello"; | |
| 1271 | + | chat.sendMessage(builder, borogove.Chat.OutgoingE2EEPreference.NoE2EE); | |
| 1272 | + | } | |
| 1273 | + | ||
| 1274 | + | } | |
| 1275 | + | ||
| 1276 | + | @:access(borogove) | |
| 1277 | + | class RecordingPersistence extends Dummy { | |
| 1278 | + | public var storedMessages: Array<borogove.ChatMessage> = []; | |
| 1279 | + | ||
| 1280 | + | override public function storeMessages(accountId: String, messages: Array<borogove.ChatMessage>) { | |
| 1281 | + | storedMessages = storedMessages.concat(messages); | |
| 1282 | + | return Promise.resolve(messages); | |
| 1283 | + | } | |
| 1233 | 1284 | } | |
| 1234 | 1285 | ||
| 1235 | 1286 | @:access(borogove) |