1.1 --- a/imiptools/period.py Thu Mar 05 16:30:13 2015 +0100
1.2 +++ b/imiptools/period.py Thu Mar 05 17:15:57 2015 +0100
1.3 @@ -82,17 +82,23 @@
1.4 else:
1.5 i += 1
1.6
1.7 -def remove_additional_periods(freebusy, uid):
1.8 +def remove_additional_periods(freebusy, uid, recurrenceids=None):
1.9
1.10 """
1.11 Remove from 'freebusy' all periods associated with 'uid' having a
1.12 recurrence identifier indicating an additional or modified period.
1.13 +
1.14 + If 'recurrenceids' is specified, remove all periods associated with 'uid'
1.15 + that do not have a recurrence identifier in the given list.
1.16 """
1.17
1.18 i = 0
1.19 while i < len(freebusy):
1.20 t = freebusy[i]
1.21 - if len(t) >= 5 and t[2] == uid and t[4]:
1.22 + if len(t) >= 5 and t[2] == uid and t[4] and (
1.23 + recurrenceids is None or
1.24 + recurrenceids is not None and t[4] not in recurrenceids
1.25 + ):
1.26 del freebusy[i]
1.27 else:
1.28 i += 1