feat(mail): Add isAnnounceAddress() and parseAnnounceName() helpers
Add announce address detection to internal/mail/router.go following the same pattern as isListAddress/parseListName and isQueueAddress/ parseQueueName. Added: - isAnnounceAddress(address string) bool - returns true for 'announce:' prefix - parseAnnounceName(address string) string - extracts channel name - ErrUnknownAnnounce error variable (gt-pn2fq) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,9 @@ var ErrUnknownList = errors.New("unknown mailing list")
|
||||
// ErrUnknownQueue indicates a queue name was not found in configuration.
|
||||
var ErrUnknownQueue = errors.New("unknown queue")
|
||||
|
||||
// ErrUnknownAnnounce indicates an announce channel name was not found in configuration.
|
||||
var ErrUnknownAnnounce = errors.New("unknown announce channel")
|
||||
|
||||
// Router handles message delivery via beads.
|
||||
// It routes messages to the correct beads database based on address:
|
||||
// - Town-level (mayor/, deacon/) -> {townRoot}/.beads
|
||||
@@ -73,6 +76,16 @@ func parseQueueName(address string) string {
|
||||
return strings.TrimPrefix(address, "queue:")
|
||||
}
|
||||
|
||||
// isAnnounceAddress returns true if the address uses announce:name syntax.
|
||||
func isAnnounceAddress(address string) bool {
|
||||
return strings.HasPrefix(address, "announce:")
|
||||
}
|
||||
|
||||
// parseAnnounceName extracts the announce channel name from an announce:name address.
|
||||
func parseAnnounceName(address string) string {
|
||||
return strings.TrimPrefix(address, "announce:")
|
||||
}
|
||||
|
||||
// expandList returns the recipients for a mailing list.
|
||||
// Returns ErrUnknownList if the list is not found.
|
||||
func (r *Router) expandList(listName string) ([]string, error) {
|
||||
|
||||
Reference in New Issue
Block a user