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

Function parseMessageIDList

internal/outbound/reply.go:129–141  ·  view source on GitHub ↗

parseMessageIDList splits a References / In-Reply-To header value into individual message-ids. The header format is one or more tokens separated by whitespace (RFC 5322 § 3.6.4); the official grammar is permissive enough that we tokenize on whitespace and then trim — any fragment that

(header string)

Source from the content-addressed store, hash-verified

127// is permissive enough that we tokenize on whitespace and then trim — any
128// fragment that isn't bracketed is dropped.
129func parseMessageIDList(header string) []string {
130 if header == "" {
131 return nil
132 }
133 fields := strings.Fields(header)
134 out := make([]string, 0, len(fields))
135 for _, f := range fields {
136 if strings.HasPrefix(f, "<") && strings.HasSuffix(f, ">") && len(f) > 2 {
137 out = append(out, f)
138 }
139 }
140 return out
141}
142
143// parseAddressList parses an RFC 5322 address list header and returns
144// lowercased bare email addresses. Invalid entries are silently skipped.

Callers 1

BuildReferencesChainFunction · 0.85

Calls 1

makeFunction · 0.85

Tested by

no test coverage detected