# HG changeset patch # User Paul Boddie # Date 1513376589 -3600 # Node ID 66be902d24e4e1930fb2574a5acfaae6667f3560 # Parent 20f2f788e42a63c0458b1207acd2cf93aad058d5 Hide separate, cancelled objects from editing. diff -r 20f2f788e42a -r 66be902d24e4 imip_text_client.py --- a/imip_text_client.py Tue Dec 12 00:10:43 2017 +0100 +++ b/imip_text_client.py Fri Dec 15 23:23:09 2017 +0100 @@ -24,7 +24,7 @@ from imiptools.config import settings from imiptools.content import get_objects_from_itip, handle_calendar_data, \ handle_calendar_object, have_itip_part, \ - parse_itip_part + is_cancel_itip, parse_itip_part from imiptools.data import get_address, get_main_period, get_recurrence_periods, get_value, parse_object from imiptools.dates import get_datetime_item, get_time, to_timezone from imiptools.editing import EditingClient, PeriodError @@ -1144,13 +1144,17 @@ if handle_data: for itip in all_itip: - objects += handle_calendar_data(itip, get_handlers(cl, person.handlers, None)) + handled = handle_calendar_data(itip, get_handlers(cl, person.handlers, None)) + if not is_cancel_itip(itip): + objects += handled # Or just obtain objects from the data. else: for itip in all_itip: - objects += get_objects_from_itip(itip, ["VEVENT"]) + handled = get_objects_from_itip(itip, ["VEVENT"]) + if not is_cancel_itip(itip): + objects += handled # Choose an object to edit. diff -r 20f2f788e42a -r 66be902d24e4 imiptools/content.py --- a/imiptools/content.py Tue Dec 12 00:10:43 2017 +0100 +++ b/imiptools/content.py Fri Dec 15 23:23:09 2017 +0100 @@ -134,6 +134,12 @@ return not not itip +def is_cancel_itip(itip): + + "Return whether 'itip' is cancelling objects." + + return get_value(itip, "METHOD") == "CANCEL" + def handle_calendar_data(itip, handlers): """