itip

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 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

View Source
const (
	MethodRequest = "request"
	MethodCancel  = "cancel"
	MethodReply   = "reply"
	MethodPublish = "publish"
	MethodOther   = "other"
)

Methods, as the API's ITIPMethod names them.

Variables

View Source
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

func ClientScheduled(src []byte) bool

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

func ForCalendar(src []byte) ([]byte, error)

ForCalendar returns an invitation as a calendar object to store: src without its METHOD line, which calendar collections do not take.

func FromMessage

func FromMessage(raw []byte) ([]byte, error)

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

func Published(src []byte) ([]byte, error)

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

func ScheduleByClient(src []byte) ([]byte, error)

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.

func SetPartStat

func SetPartStat(src []byte, recurrenceID, attendee, answer string) ([]byte, error)

SetPartStat patches attendee's PARTSTAT to answer in src, changing only the attendee's ATTENDEE lines: in every VEVENT when recurrenceID is "", else in the VEVENT with that recurrence ID.

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.

func Parse

func Parse(src []byte, opts calendar.Options) (*Message, error)

Parse reads an iTIP object. METHOD maps to the Method constants: REQUEST, CANCEL, REPLY and PUBLISH to their own, a missing METHOD to publish, and any other (ADD, REFRESH, COUNTER, DECLINECOUNTER) to other.

func (*Message) Main

func (m *Message) Main() calendar.Event

Main is the event the message is about: the one without a recurrence ID (a single event or a series' master), else the first.

Jump to

Keyboard shortcuts

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