compose

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package compose holds the compose window's logic, with no UI: the recipient fields' addresses, Send Later's choices, the attachment reminder and the links the editor keeps (docs/specs/compose-ui.md). Outgoing mail itself is internal/compose's.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowedLink(href string) bool

AllowedLink reports whether the editor keeps a link.

func HTMLText

func HTMLText(src string) string

HTMLText is the text of HTML: blocks and line breaks end a line, then white space is squashed.

func HasAttachment

func HasAttachment(src string, attachments int) bool

HasAttachment reports a chip, or an image outside every quote.

func MentionsAttachment

func MentionsAttachment(text string) bool

MentionsAttachment reports whether text holds an attachment word as a whole word.

func NeedsReminder

func NeedsReminder(src, signatureHTML string, attachments int) bool

NeedsReminder reports whether the user's own text mentions an attachment and none is attached.

func OwnText

func OwnText(src, signatureHTML string) string

OwnText is the text the user wrote: no quotes, no attribution line, no signature (docs/specs/compose-ui.md, Attachment reminder).

func ParseAddresses

func ParseAddresses(text string) (addresses []api.Address, invalid []string)

ParseAddresses splits typed or pasted text into addresses, dropping repeats without regard to case; pieces that do not parse come back as invalid, trimmed.

func RecipientPrefix added in v0.10.0

func RecipientPrefix(text string) (string, string)

RecipientPrefix returns the completed part of a field, including its last separator, and the last unfinished address for completion.

func Token

func Token(a api.Address) string

Token writes an address as a recipient field's token, which reads back as this one recipient whatever the mail it came from says: the text is untrusted. An address that cannot be written plainly becomes one quoted piece, which is invalid and holds the send back.

func TomorrowMorning

func TomorrowMorning(now time.Time) time.Time

TomorrowMorning is where the Send Later sheet starts.

func ValidAddress

func ValidAddress(text string) bool

ValidAddress reports whether text is a plausible email address.

Types

type Choice

type Choice struct {
	Label string
	At    time.Time
}

Choice is a Send Later choice and its time.

func SendChoices

func SendChoices(now time.Time) []Choice

SendChoices offers tonight at 9 PM while that is ahead, then tomorrow at 8 AM, in now's zone.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL