Documentation
¶
Overview ¶
Package itip reads iTIP messages that arrive in mail (RFC 5546, RFC 6047) and writes the user's answers: the REPLY mailed to an organizer and the PARTSTAT patch of a stored event (ADR-0019; ADR-0018's patches).
Index ¶
- Constants
- Variables
- func ClientScheduled(src []byte) bool
- func ForCalendar(src []byte) ([]byte, error)
- func FromMessage(raw []byte) ([]byte, error)
- func Published(src []byte) ([]byte, error)
- func Reply(src []byte, recurrenceID, attendee, answer, comment string, now time.Time) ([]byte, error)
- func ScheduleByClient(src []byte) ([]byte, error)
- func SetPartStat(src []byte, recurrenceID, attendee, answer string) ([]byte, error)
- type Message
Constants ¶
const ( MethodRequest = "request" MethodCancel = "cancel" MethodReply = "reply" MethodPublish = "publish" MethodOther = "other" )
Methods, as the API's ITIPMethod names them.
Variables ¶
var ( // ErrNoInvitation is a message without an iCalendar part. ErrNoInvitation = errors.New("itip: no iCalendar part") // ErrNoEvent is an iCalendar object without a usable VEVENT. ErrNoEvent = errors.New("itip: no event") // ErrNotInvited is an attendee the event does not name. ErrNotInvited = errors.New("itip: not an attendee") // ErrNoOccurrence is a recurrence ID the object has no VEVENT for. ErrNoOccurrence = errors.New("itip: no such occurrence") // ErrAnswer is an answer other than accepted, declined or tentative. ErrAnswer = errors.New("itip: answer is accepted, declined or tentative") )
Functions ¶
func ClientScheduled ¶
ClientScheduled reports whether src leaves scheduling to the client: SCHEDULE-AGENT=CLIENT on an event's ORGANIZER (RFC 6638 §7.1), as the copies maild answers by mail carry (ADR-0022).
func ForCalendar ¶
ForCalendar returns an invitation as a calendar object to store: src without its METHOD line, which calendar collections do not take.
func FromMessage ¶
FromMessage returns the iCalendar object of a raw mail message: its first text/calendar part, else its first application/ics part or part whose filename ends in .ics, decoded from its transfer encoding.
func Published ¶ added in v0.8.0
Published returns a published event as a calendar object of the user's own: src without its METHOD line, holding one event. The event is the one a card shows (Message.Main): the first VEVENT without a RECURRENCE-ID, else the first, with the VEVENTs that share its UID (a series' overrides). Every other component but the time zones goes: a file may publish several events, and a calendar resource holds one UID (RFC 4791 §4.1). In the events kept, the ORGANIZER and ATTENDEE lines and the alarms go; nothing else changes. With no organizer and no attendee no server schedules the copy, and an alarm a sender wrote, which a server may act on by mail, does not come along. The answer is that one calendar object and nothing else of src: a second VCALENDAR, or any bytes before or after the first, are not copied through.
func Reply ¶
func Reply(src []byte, recurrenceID, attendee, answer, comment string, now time.Time) ([]byte, error)
Reply writes the iTIP REPLY that tells the organizer attendee's answer (accepted, declined or tentative) to the event in src, an invitation or a stored event: its single event or master when recurrenceID is "", else the VEVENT with that recurrence ID (as calendar.Event.RecurrenceID formats it). comment, when not empty, is a note to the organizer.
func ScheduleByClient ¶
ScheduleByClient sets SCHEDULE-AGENT=CLIENT on every event's ORGANIZER in src, replacing another agent, so a server that schedules sends no message for the copy: maild mails the reply itself (ADR-0022). Only the ORGANIZER lines change.
Types ¶
type Message ¶
type Message struct {
// Method is one of the Method constants.
Method string
// Source is the iCalendar object as it came.
Source []byte
// Events are its VEVENTs in source order, read by calendar.Parse.
Events []calendar.Event
}
Message is an iTIP object read from mail.