Documentation
¶
Overview ¶
Package calendar reads vdir calendars (one iCalendar file per event, as vdirsyncer and khal keep them), expands their events for a month, and fires their reminders. It never touches the network: syncing is left to the tool that fills the directories.
Index ¶
- func Parse(data string, local *time.Location) ([]Event, []Skip, error)
- type Alarm
- type Clock
- type Event
- type Month
- type Occurrence
- type Reminder
- type Skip
- type Source
- type Store
- func (s *Store) Changes() (<-chan struct{}, func())
- func (s *Store) Close()
- func (s *Store) Configure(sources []Source) error
- func (s *Store) Configured() bool
- func (s *Store) Month(year int, month time.Month) *Month
- func (s *Store) Next(now time.Time) (Occurrence, bool)
- func (s *Store) RunReminders(notify func(Reminder))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Alarm ¶
Alarm is one VALARM: a trigger relative to the event's start (or its end), or at a fixed time.
type Clock ¶
Clock is the time source reminders are scheduled on.
var WallClock Clock = wallClock{}
WallClock is the real clock.
type Event ¶
type Event struct {
UID string
Summary string
Location string
Start time.Time
End time.Time
AllDay bool
Alarms []Alarm
// contains filtered or unexported fields
}
Event is one VEVENT: a single event, or the series an RRULE expands.
type Month ¶
type Month struct {
// contains filtered or unexported fields
}
Month is a month's occurrences by day of the month.
func (*Month) Day ¶
func (m *Month) Day(d int) []Occurrence
Day lists day d's occurrences: all-day ones first, then by start.
type Occurrence ¶
type Occurrence struct {
Summary string
Location string
Start time.Time
End time.Time
AllDay bool
Color string
}
Occurrence is one instance of an event, in the store's location.
type Reminder ¶
type Reminder struct {
Occurrence
At time.Time
}
Reminder is an alarm of an occurrence coming due.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds the events of the configured vdir directories, follows their changes, expands them per month on demand, and keeps each expansion until a file changes.
func (*Store) Changes ¶
func (s *Store) Changes() (<-chan struct{}, func())
Changes ticks after every change of the events; stop ends the feed.
func (*Store) Close ¶
func (s *Store) Close()
Close stops following the directories and the reminders.
func (*Store) Configure ¶
Configure replaces the sources: every .ics file under each directory is read and the directories are watched. A directory that cannot be read or watched is reported and left out; the others still load.
func (*Store) Configured ¶
Configured reports whether any source is configured.
func (*Store) Month ¶
Month returns the occurrences of year's month, expanding them once until the files change.
func (*Store) Next ¶
func (s *Store) Next(now time.Time) (Occurrence, bool)
Next is the first timed occurrence starting at now or later, within a week.
func (*Store) RunReminders ¶
RunReminders fires notify for every alarm coming due from now on, one timer to the next alarm, until Close. A change of the files reschedules it.