1.1 --- a/imiptools/period.py Sun Mar 01 00:24:11 2015 +0100
1.2 +++ b/imiptools/period.py Sun Mar 01 22:00:09 2015 +0100
1.3 @@ -73,6 +73,13 @@
1.4 else:
1.5 i += 1
1.6
1.7 +def remove_affected_period(freebusy, uid, recurrenceid):
1.8 + found = bisect_left(freebusy, (recurrenceid,))
1.9 + if found < len(freebusy):
1.10 + start, end, _uid, transp, _recurrenceid = freebusy[found][:5]
1.11 + if start == recurrenceid and recurrenceid != _recurrenceid and uid == _uid:
1.12 + del freebusy[found]
1.13 +
1.14 def get_overlapping(freebusy, period):
1.15
1.16 """
1.17 @@ -366,27 +373,7 @@
1.18
1.19 return start, end, uid, recurrenceid, key
1.20
1.21 -def remove_from_freebusy(freebusy, attendee, uid, recurrenceid, store):
1.22 -
1.23 - """
1.24 - For the given 'attendee', remove periods from 'freebusy' that are associated
1.25 - with 'uid' and 'recurrenceid' in the 'store'.
1.26 - """
1.27 -
1.28 - remove_period(freebusy, uid, recurrenceid)
1.29 - store.set_freebusy(attendee, freebusy)
1.30 -
1.31 -def remove_from_freebusy_for_other(freebusy, user, other, uid, recurrenceid, store):
1.32 -
1.33 - """
1.34 - For the given 'user', remove for the 'other' party periods from 'freebusy'
1.35 - that are associated with 'uid' and 'recurrenceid' in the 'store'.
1.36 - """
1.37 -
1.38 - remove_period(freebusy, uid, recurrenceid)
1.39 - store.set_freebusy_for_other(user, freebusy, other)
1.40 -
1.41 -def _update_freebusy(freebusy, periods, transp, uid, recurrenceid):
1.42 +def update_freebusy(freebusy, periods, transp, uid, recurrenceid):
1.43
1.44 """
1.45 Update the free/busy details with the given 'periods', 'transp' setting and
1.46 @@ -398,24 +385,4 @@
1.47 for start, end in periods:
1.48 insert_period(freebusy, (start, end, uid, transp, recurrenceid))
1.49
1.50 -def update_freebusy(freebusy, attendee, periods, transp, uid, recurrenceid, store):
1.51 -
1.52 - """
1.53 - For the given 'attendee', update the free/busy details with the given
1.54 - 'periods', 'transp' setting and 'uid' plus 'recurrenceid' in the 'store'.
1.55 - """
1.56 -
1.57 - _update_freebusy(freebusy, periods, transp, uid, recurrenceid)
1.58 - store.set_freebusy(attendee, freebusy)
1.59 -
1.60 -def update_freebusy_for_other(freebusy, user, other, periods, transp, uid, recurrenceid, store):
1.61 -
1.62 - """
1.63 - For the given 'user', update the free/busy details of 'other' with the given
1.64 - 'periods', 'transp' setting and 'uid' plus 'recurrenceid' in the 'store'.
1.65 - """
1.66 -
1.67 - _update_freebusy(freebusy, periods, transp, uid, recurrenceid)
1.68 - store.set_freebusy_for_other(user, freebusy, other)
1.69 -
1.70 # vim: tabstop=4 expandtab shiftwidth=4