1.1 --- a/imiptools/content.py Wed Oct 22 00:48:30 2014 +0200
1.2 +++ b/imiptools/content.py Wed Oct 22 14:06:26 2014 +0200
1.3 @@ -274,6 +274,12 @@
1.4 return self.recipients.intersection(map(get_address, values))
1.5
1.6 def require_organiser_and_attendees(self):
1.7 +
1.8 + """
1.9 + Return the organiser and attendees for the current object, filtered by
1.10 + the recipients of interest. Return None if no identities are eligible.
1.11 + """
1.12 +
1.13 attendee_map = self.get_value_map("ATTENDEE")
1.14 organiser = self.get_item("ORGANIZER")
1.15
1.16 @@ -288,6 +294,36 @@
1.17
1.18 return organiser, attendees
1.19
1.20 + def have_new_object(self, attendee, objtype):
1.21 +
1.22 + """
1.23 + Return whether the current object is new to the 'attendee' for the
1.24 + given 'objtype'.
1.25 + """
1.26 +
1.27 + f = self.store.get_event(attendee, self.uid)
1.28 + event = f and parse_object(f, "utf-8", objtype)
1.29 +
1.30 + # If found, compare SEQUENCE and potentially DTSTAMP.
1.31 +
1.32 + if event:
1.33 + sequence = get_value(event, "SEQUENCE")
1.34 + dtstamp = get_value(event, "DTSTAMP")
1.35 +
1.36 + # If the request refers to an older version of the event, ignore
1.37 + # it.
1.38 +
1.39 + old_dtstamp = self.dtstamp < dtstamp
1.40 +
1.41 + if sequence is not None and (
1.42 + int(self.sequence) < int(sequence) or
1.43 + int(self.sequence) == int(sequence) and old_dtstamp
1.44 + ) or old_dtstamp:
1.45 +
1.46 + return False
1.47 +
1.48 + return True
1.49 +
1.50 # Handler registry.
1.51
1.52 methods = {