<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6645">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Sean Bright: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_calendar_icalendar: Filter out occurrences superceded by another VEVENT<br><br>When we are loading the calendars, we call libical's<br>icalcomponent_foreach_recurrence method for each VEVENT component that<br>we have in our calendar.<br><br>That method has no knowledge concerning the existence of the other<br>VEVENT components and will feed our callback with all ocurrences<br>matching the requested time span.<br><br>The occurrences generated by icalcomponent_foreach_recurrence while<br>expanding a recurring VEVENT's RRULE and RDATE properties can be<br>superceded by an other VEVENT sharing the same UID.<br><br>I use an external iterator (in libical terminology) to avoid messing<br>with the internal ones from the calling function, and search for<br>VEVENTS which could supersede the current occurrence.<br><br>The event which can invalidate this occurence needs to have:<br><br>- the same UID as our recurrent component (comp)<br>- a RECURRENCE-ID property, which represents the start time of this<br> occurrence<br><br>If one component is found, just clean and return.<br><br>ASTERISK-27296 #close<br>Reported by: Benoît Dereck-Tricot<br><br>Change-Id: I8587ae3eaa765af7cb21eda3b6bf84e8a1c87af8<br>---<br>M res/res_calendar_icalendar.c<br>1 file changed, 37 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_calendar_icalendar.c b/res/res_calendar_icalendar.c<br>index 4139cf4..58876c1 100644<br>--- a/res/res_calendar_icalendar.c<br>+++ b/res/res_calendar_icalendar.c<br>@@ -177,7 +177,7 @@<br> }<br> <br> /* span->start & span->end may be dates or floating times which have no timezone,<br>- * which would mean that they should apply to the local timezone for all recepients.<br>+ * which would mean that they should apply to the local timezone for all recipients.<br> * For example, if a meeting was set for 1PM-2PM floating time, people in different time<br> * zones would not be scheduled at the same local times. Dates are often treated as<br> * floating times, so all day events will need to be converted--so we can trust the<br>@@ -249,7 +249,42 @@<br> }<br> }<br> <br>- /* Get the attendees */<br>+ /*<br>+ * If comp has an RRULE and/or RDATE property, we need to check whether<br>+ * another vevent component supercedes this span. Such a component would<br>+ * have two characteristics:<br>+ * - its UID is the same as comp<br>+ * - its RECURRENCE-ID property is the same time as span->start<br>+ */<br>+ if (icalcomponent_get_first_property(comp, ICAL_RRULE_PROPERTY)<br>+ || icalcomponent_get_first_property(comp, ICAL_RDATE_PROPERTY)) {<br>+ icalcompiter comp_iter;<br>+ icaltimetype span_start = icaltime_from_timet_with_zone(<br>+ event->start, icaltime_is_date(start), icaltime_get_timezone(start));<br>+<br>+ icaltime_set_timezone(&span_start, icaltime_get_timezone(start));<br>+ for (comp_iter = icalcomponent_begin_component(pvt->data, ICAL_VEVENT_COMPONENT);<br>+ icalcompiter_deref(&comp_iter);<br>+ icalcompiter_next(&comp_iter)) {<br>+ icalcomponent *vevent = icalcompiter_deref(&comp_iter);<br>+ icalproperty *uid = icalcomponent_get_first_property(vevent, ICAL_UID_PROPERTY);<br>+<br>+ if (uid && !strcmp(icalproperty_get_value_as_string(uid), event->uid)) {<br>+ icaltimetype recurrence_id = icalcomponent_get_recurrenceid(vevent);<br>+<br>+ /* Set the same timezone that we want to compare against */<br>+ icaltime_set_timezone(&recurrence_id, icaltime_get_timezone(start));<br>+<br>+ if (!icaltime_compare(recurrence_id, span_start)<br>+ && icaltime_is_date(span_start) == icaltime_is_date(recurrence_id)) {<br>+ event = ast_calendar_unref_event(event);<br>+ return;<br>+ }<br>+ }<br>+ }<br>+ }<br>+<br>+ /* Get the attendees */<br> for (prop = icalcomponent_get_first_property(comp, ICAL_ATTENDEE_PROPERTY);<br> prop; prop = icalcomponent_get_next_property(comp, ICAL_ATTENDEE_PROPERTY)) {<br> struct ast_calendar_attendee *attendee;<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6645">change 6645</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/6645"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I8587ae3eaa765af7cb21eda3b6bf84e8a1c87af8 </div>
<div style="display:none"> Gerrit-Change-Number: 6645 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benoît Dereck-Tricot <benoit.dereck-tricot@eyepea.eu> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>