MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / writeThreadingHeaders

Function writeThreadingHeaders

internal/outbound/compose.go:237–246  ·  view source on GitHub ↗

writeThreadingHeaders writes the In-Reply-To and References headers per RFC 5322 § 3.6.4. References is the full ancestor chain in conversation order (oldest → newest) and must be space-separated message-ids; mail clients use it to anchor a reply to an existing thread by matching ANY id in the chain

(writeHeader func(string, string), replyToMsgID string, references []string)

Source from the content-addressed store, hash-verified

235// non-empty references slice for any reply that may reach a recipient who
236// did not see the immediate parent (multi-party / agent-mediated threads).
237func writeThreadingHeaders(writeHeader func(string, string), replyToMsgID string, references []string) {
238 if replyToMsgID != "" {
239 writeHeader("In-Reply-To", replyToMsgID)
240 }
241 if len(references) > 0 {
242 writeHeader("References", strings.Join(references, " "))
243 } else if replyToMsgID != "" {
244 writeHeader("References", replyToMsgID)
245 }
246}
247
248func headerWriter(buf *strings.Builder) func(string, string) {
249 return func(key, value string) {

Callers 3

ComposeMessageFunction · 0.85
ComposeMultipartMessageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected