# HG changeset patch # User Paul Boddie # Date 1422145075 -3600 # Node ID 68aac5bf9dea5328b5f542114b1a677a1a94146b # Parent b72619415ebf812ab365bc0c9cd141886ce865aa Fixed PARTSTAT inspection to consider changes to all attendees (and not the current user). diff -r b72619415ebf -r 68aac5bf9dea imiptools/content.py --- a/imiptools/content.py Sun Jan 25 00:56:53 2015 +0100 +++ b/imiptools/content.py Sun Jan 25 01:17:55 2015 +0100 @@ -509,40 +509,38 @@ obj = obj or self.get_object(attendee, objtype) # If found, compare SEQUENCE and potentially DTSTAMP. + # NOTE: Some clients like Claws Mail erase time information from DTSTAMP + # NOTE: and make it invalid. Thus, attendance information may also be + # NOTE: checked. if obj: sequence = get_value(obj, "SEQUENCE") dtstamp = get_value(obj, "DTSTAMP") - # NOTE: Some clients like Claws Mail erase time information from DTSTAMP - # NOTE: and make it invalid. Thus, attendance information may also be - # NOTE: checked. - - for _attendee, old_attr in get_items(obj, "ATTENDEE"): - if _attendee == attendee: - break - else: - return False - - for _attendee, new_attr in self.get_items("ATTENDEE"): - if _attendee == attendee: - break - else: - return False - - old_partstat = old_attr.get("PARTSTAT") - new_partstat = new_attr.get("PARTSTAT") - - partstat_set = old_partstat == "NEEDS-ACTION" and new_partstat and \ - new_partstat != old_partstat - # If the request refers to an older version of the object, ignore # it. - return is_new_object(sequence, self.sequence, dtstamp, self.dtstamp, partstat_set) + return is_new_object(sequence, self.sequence, dtstamp, self.dtstamp, + self.is_partstat_updated(obj)) return True + def is_partstat_updated(self, obj): + old_attendees = get_value_map(obj, "ATTENDEE") + new_attendees = self.get_value_map("ATTENDEE") + + for attendee, attr in old_attendees.items(): + old_partstat = attr.get("PARTSTAT") + new_attr = new_attendees.get(attendee) + new_partstat = new_attr and new_attr.get("PARTSTAT") + + if old_partstat == "NEEDS-ACTION" and new_partstat and \ + new_partstat != old_partstat: + + return True + + return False + def update_dtstamp(self): "Update the DTSTAMP in the current object."