forked from aksdb/CalAnonSync
Support wholeDay creation
This commit is contained in:
parent
4c5cf1dec7
commit
88fe09795e
|
@ -82,7 +82,7 @@ func main() {
|
|||
// No anonymization? Fine.
|
||||
title = ewsItem.Subject
|
||||
}
|
||||
ical := CreateICal(ewsItem.Hash(), title, ewsItem.Start, ewsItem.End)
|
||||
ical := CreateICal(ewsItem.Hash(), title, ewsItem.Start, ewsItem.End, ewsItem.IsAllDayEvent)
|
||||
calDavItem := CalDAVItem{HRef: uid + ".ics", ICal: ical}
|
||||
|
||||
err := c.UploadItem(calDavItem)
|
||||
|
|
|
@ -223,7 +223,7 @@ func ParseICal(r io.Reader) (*ICal, error) {
|
|||
// Create a new empty ICal structure with the given parameters.
|
||||
// Currently only supports time based events; date-only is not
|
||||
// supported.
|
||||
func CreateICal(uid, summary string, start, end time.Time) *ICal {
|
||||
func CreateICal(uid, summary string, start, end time.Time, wholeDay bool) *ICal {
|
||||
model := struct {
|
||||
UID string
|
||||
Summary string
|
||||
|
@ -249,6 +249,13 @@ func CreateICal(uid, summary string, start, end time.Time) *ICal {
|
|||
// Internal stuff, so this really should not fail.
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if wholeDay {
|
||||
// To not duplicate the wholeDay logic here (or in the template),
|
||||
// simply postprocess the generated ical.
|
||||
ical.Update(start, end, wholeDay)
|
||||
}
|
||||
|
||||
return ical
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue