fix: tidy iMessage/Signal sender envelopes (#1080) - thanks @tyler6204

Co-authored-by: Tyler Yust <TYTYYUST@YAHOO.COM>
This commit is contained in:
Peter Steinberger
2026-01-17 08:29:13 +00:00
parent d0bc08a934
commit ab49fe0e92
4 changed files with 7 additions and 5 deletions

View File

@@ -33,7 +33,8 @@ function hasSenderMetaLine(body: string, ctx: MsgContext): boolean {
if (candidates.length === 0) return false;
return candidates.some((candidate) => {
const escaped = escapeRegExp(candidate);
// Check for sender at start of line OR after envelope header bracket
// Envelope bodies look like "[Signal ...] Alice: hi".
// Treat the post-header sender prefix as already having sender metadata.
const pattern = new RegExp(`(^|\\n|\\]\\s*)${escaped}:\\s`, "i");
return pattern.test(body);
});

View File

@@ -383,8 +383,8 @@ export async function monitorIMessageProvider(opts: MonitorIMessageOpts = {}): P
}
const chatTarget = formatIMessageChatTarget(chatId);
// For groups: use chat name or just "Group" (channel "iMessage" is already shown)
// For DMs: show sender, only add id: suffix if raw differs from normalized
// For groups: use chat name or just "Group" (channel "iMessage" is already shown).
// For DMs: keep headers compact; only add id: suffix if raw differs from normalized.
const fromLabel = isGroup
? `${message.chat_name || "Group"} id:${chatId ?? "unknown"}`
: senderNormalized === sender

View File

@@ -65,8 +65,8 @@ export function createSignalEventHandler(deps: SignalEventHandlerDeps) {
};
async function handleSignalInboundMessage(entry: SignalInboundEntry) {
// For groups: use group name or just "Group" (channel "Signal" is already shown)
// For DMs: show sender, only add id: suffix if display differs from name
// For groups: use group name or just "Group" (channel "Signal" is already shown).
// For DMs: keep headers compact; only add id: suffix if display differs from name.
const fromLabel = entry.isGroup
? `${entry.groupName || "Group"} id:${entry.groupId}`
: entry.senderName === entry.senderDisplay