docs: document the first ": " sender split for ambiguous names

This commit is contained in:
github-actions[bot] committed 2026-11-12 13:51:02 -06:00
1 parent 0013ad0248
commit 1da6ddb42f
2 files changed
+26

No files matched your search

+4
View File
@@ -219,6 +219,10 @@ Group-text messages look like `SenderName: message text` after decryption.
`DF)EQ4X:: hello` has the sender `DF)EQ4X:`, and a colon-space in the text
(`Alice: note: hi`) does not split it. A message with no `: ` at all
(`Alice:hi`) still splits on the bare colon.
- A name that itself contains `: ` cannot be recovered — the first `: ` is
always the boundary, exactly as the official client splits it. So
`some: name: test: this is a test: hello` has the sender `some` and the text
`name: test: this is a test: hello`; use `text=` as well to target the rest.
- Matching is **case-sensitive**, and a pattern matches *anywhere* in the
field unless you anchor it. The three most common shapes, at a glance:
@@ -945,6 +945,28 @@ TEST_F(FilterTest, TextColonSpaceDoesNotSplitSender) {
FILTER_ACT_DROP);
}
// A name that itself contains ": " is inherently ambiguous. The official
// client splits on the first ": " too, so "some: name: test: ..." has the
// sender "some" — pin that so it stays deliberate rather than drifting.
TEST_F(FilterTest, SenderNameWithColonSpaceSplitsAtFirstDelimiter) {
auto pkt = makePacket(ROUTE_TYPE_FLOOD, PAYLOAD_TYPE_GRP_TXT, 20);
auto chan = channelFromStore(filter, 0);
expectOk(filter, "add sender=^some$ text=\"^name: test: this is\"");
auto payload = makeGroupText("some: name: test", "this is a test: hello");
EXPECT_EQ(filter.checkContent(&pkt, PAYLOAD_TYPE_GRP_TXT, chan, payload.data,
payload.len, nullptr),
FILTER_ACT_DROP);
// the full intended name is not recoverable, so an anchored pattern for it
// cannot match
filter.clearRules();
expectOk(filter, "add sender=\"^some: name: test$\"");
EXPECT_EQ(filter.checkContent(&pkt, PAYLOAD_TYPE_GRP_TXT, chan, payload.data,
payload.len, nullptr),
FILTER_ACT_ALLOW);
}
TEST_F(FilterTest, SenderRegexIsUnanchoredByDefault) {
expectOk(filter, "add sender=Spam"); // substring, case-sensitive
auto payload = makeGroupText("theSpamBot", "hi");