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

Sean Bright asteriskteam at digium.com
Thu Aug 17 12:02:06 CDT 2017


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


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/44/6244/1

diff --git a/res/res_calendar_icalendar.c b/res/res_calendar_icalendar.c
index 3348060..d4e0580 100644
--- a/res/res_calendar_icalendar.c
+++ b/res/res_calendar_icalendar.c
@@ -313,6 +313,7 @@
  static void icalendar_update_events(struct icalendar_pvt *pvt)
 {
 	struct icaltimetype start_time, end_time;
+	struct icaldurationtype recur_duration;
 	icalcomponent *iter;
 
 	if (!pvt) {
@@ -330,9 +331,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/6244
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id90c3cfc79d561a5521d79be176683e225f2edef
Gerrit-Change-Number: 6244
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/b92355ea/attachment.html>


More information about the asterisk-code-review mailing list