[Asterisk-code-review] res calendar icalendar: Properly handle recurring events (asterisk[13])

Sean Bright asteriskteam at digium.com
Thu Aug 17 12:01:46 CDT 2017


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/6242


Change subject: res_calendar_icalendar: Properly handle recurring events
......................................................................

res_calendar_icalendar: Properly handle recurring events

When looking for recurring events, use the correct end time based on the
configured 'timeframe.'

ASTERISK-27174 #close
Reported by: Mark Thompson

Change-Id: Id90c3cfc79d561a5521d79be176683e225f2edef
---
M res/res_calendar_icalendar.c
1 file changed, 4 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/42/6242/1

diff --git a/res/res_calendar_icalendar.c b/res/res_calendar_icalendar.c
index 8ac9051..3c1b43d 100644
--- a/res/res_calendar_icalendar.c
+++ b/res/res_calendar_icalendar.c
@@ -315,6 +315,7 @@
  static void icalendar_update_events(struct icalendar_pvt *pvt)
 {
 	struct icaltimetype start_time, end_time;
+	struct icaldurationtype recur_duration;
 	icalcomponent *iter;
 
 	if (!pvt) {
@@ -332,9 +333,10 @@
 		return;
 	}
 
+	recur_duration = icaldurationtype_from_int(pvt->owner->timeframe * 60);
+
 	start_time = icaltime_current_time_with_zone(icaltimezone_get_utc_timezone());
-	end_time = icaltime_current_time_with_zone(icaltimezone_get_utc_timezone());
-	end_time.second += pvt->owner->timeframe * 60;
+	end_time = icaltime_add(start_time, recur_duration);
 	icaltime_normalize(end_time);
 
 	for (iter = icalcomponent_get_first_component(pvt->data, ICAL_VEVENT_COMPONENT);

-- 
To view, visit https://gerrit.asterisk.org/6242
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id90c3cfc79d561a5521d79be176683e225f2edef
Gerrit-Change-Number: 6242
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170817/c2d9edea/attachment.html>


More information about the asterisk-code-review mailing list