...
This commit is contained in:
@@ -139,19 +139,6 @@ pub fn (self CalendarEvent) dump(mut e encoder.Encoder) ! {
|
||||
e.add_u32(self.calendar_id)
|
||||
e.add_u8(u8(self.status))
|
||||
e.add_bool(self.is_all_day)
|
||||
e.add_bool(self.is_recurring)
|
||||
|
||||
// Encode recurrence array
|
||||
e.add_u16(u16(self.recurrence.len))
|
||||
for rule in self.recurrence {
|
||||
e.add_u8(u8(rule.frequency))
|
||||
e.add_int(rule.interval)
|
||||
e.add_i64(rule.until)
|
||||
e.add_int(rule.count)
|
||||
e.add_list_int(rule.by_weekday)
|
||||
e.add_list_int(rule.by_monthday)
|
||||
}
|
||||
|
||||
e.add_list_int(self.reminder_mins)
|
||||
e.add_string(self.color)
|
||||
e.add_string(self.timezone)
|
||||
@@ -165,32 +152,8 @@ fn (mut self DBCalendarEvent) load(mut o CalendarEvent, mut e encoder.Decoder) !
|
||||
o.attendees = e.get_list_u32()!
|
||||
o.fs_items = e.get_list_u32()!
|
||||
o.calendar_id = e.get_u32()!
|
||||
o.status = unsafe { EventStatus(e.get_u8()!) } // TODO: is there no better way?
|
||||
o.status = unsafe { EventStatus(e.get_u8()!) }
|
||||
o.is_all_day = e.get_bool()!
|
||||
o.is_recurring = e.get_bool()!
|
||||
|
||||
// Decode recurrence array
|
||||
recurrence_len := e.get_u16()!
|
||||
mut recurrence := []CalendarEventRecurrenceRule{}
|
||||
for _ in 0 .. recurrence_len {
|
||||
frequency := unsafe { RecurrenceFreq(e.get_u8()!) }
|
||||
interval := e.get_int()!
|
||||
until := e.get_i64()!
|
||||
count := e.get_int()!
|
||||
by_weekday := e.get_list_int()!
|
||||
by_monthday := e.get_list_int()!
|
||||
|
||||
recurrence << CalendarEventRecurrenceRule{
|
||||
frequency: frequency
|
||||
interval: interval
|
||||
until: until
|
||||
count: count
|
||||
by_weekday: by_weekday
|
||||
by_monthday: by_monthday
|
||||
}
|
||||
}
|
||||
o.recurrence = recurrence
|
||||
|
||||
o.reminder_mins = e.get_list_int()!
|
||||
o.color = e.get_string()!
|
||||
o.timezone = e.get_string()!
|
||||
@@ -210,8 +173,6 @@ pub mut:
|
||||
calendar_id u32 // Associated calendar
|
||||
status EventStatus
|
||||
is_all_day bool
|
||||
is_recurring bool
|
||||
recurrence []CalendarEventRecurrenceRule
|
||||
reminder_mins []int // Minutes before event for reminders
|
||||
color string // Hex color code
|
||||
timezone string
|
||||
|
||||
Reference in New Issue
Block a user