# HG changeset patch # User Paul Boddie # Date 1461102273 -7200 # Node ID 238440836219c0237ea02b48c60d44a31c261302 # Parent 6e78257c4acd4ad85c43da608c69ac2767affb19 Send REQUEST messages to other attendees when an attendee has created a new recurrence, thus updating the others with the details of the new recurrence together with the originating attendee's attendance details. Extended the tests to propagate such messages and to inspect the results. diff -r 6e78257c4acd -r 238440836219 imiptools/handlers/person.py --- a/imiptools/handlers/person.py Tue Apr 19 21:57:44 2016 +0200 +++ b/imiptools/handlers/person.py Tue Apr 19 23:44:33 2016 +0200 @@ -214,6 +214,18 @@ # Update free/busy details for the event. self.update_event_in_freebusy(for_organiser=True) + + # Produce a REQUEST for the created occurrence for other + # attendees of the parent event. + + obj = self.get_parent_object() + stored_attendees = set(obj.get_values("ATTENDEE")) + attendees = stored_attendees.difference(attendees) + + for attendee in attendees: + methods, parts = self.get_message_parts(self.obj, "REQUEST", attendee) + self.add_results(methods, [get_address(attendee)], parts) + return True # Merge the attendance for the received object. diff -r 6e78257c4acd -r 238440836219 tests/test_person_invitation_decline_instance.sh --- a/tests/test_person_invitation_decline_instance.sh Tue Apr 19 21:57:44 2016 +0200 +++ b/tests/test_person_invitation_decline_instance.sh Tue Apr 19 23:44:33 2016 +0200 @@ -250,6 +250,34 @@ && echo "Success" \ || echo "Failed" +# This should cause the organiser to tell the second user about the recurrence. + + grep -q 'METHOD:REQUEST' out6.tmp \ +&& echo "Success" \ +|| echo "Failed" + + "$PERSON_SCRIPT" $ARGS < out6.tmp 2>> $ERROR \ +| "$SHOWMAIL" \ +> out62.tmp + + "$LIST_SCRIPT" $LIST_ARGS "$USER2" "object" "event26@example.com" \ +> out6O2.tmp + + "$LIST_SCRIPT" $LIST_ARGS "$USER2" "recurrence" "event26@example.com" "20141011T100000" \ +> out6R2.tmp + +# The second user's schedule should remain unchanged. +# NOTE: The nature of the periods might need to change, with the recurrence +# NOTE: taking over the affected period. + + "$LIST_SCRIPT" $LIST_ARGS "$USER2" "freebusy" \ +> out6f2.tmp + + [ `grep "event26@example.com" "out6f2.tmp" | wc -l` = '2' ] \ +&& grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out6f2.tmp" \ +&& echo "Success" \ +|| echo "Failed" + # Test recurrence acceptance in the outgoing handler. "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER1" "20141011T100000" "20141011T110000" "event26@example.com" "20141011T100000" 2>> $ERROR \ @@ -321,3 +349,43 @@ && grep -q 'event26@example.com' "out8R.tmp" \ && echo "Success" \ || echo "Failed" + +# Test recurrence declining in the outgoing handler. +# Now the second user declines the parent event. + + "$DECLINE_SCRIPT" $DECLINE_ARGS "$USER2" "event26@example.com" 2>> $ERROR \ +| tee out9.tmp \ +| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR + + "$LIST_SCRIPT" $LIST_ARGS "$USER2" "freebusy" \ +> out9s.tmp + + [ `grep "event26@example.com" "out9s.tmp" | wc -l` = '0' ] \ +&& ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out9s.tmp" \ +&& ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out9s.tmp" \ +&& echo "Success" \ +|| echo "Failed" + +# Test declining in the incoming handler. + + "$PERSON_SCRIPT" $ARGS < out9.tmp 2>> $ERROR \ +| "$SHOWMAIL" \ +> out10.tmp + + "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ +> out10f.tmp + + [ `grep "event26@example.com" "out10f.tmp" | wc -l` = '2' ] \ +&& grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out10f.tmp" \ +&& grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out10f.tmp" \ +&& echo "Success" \ +|| echo "Failed" + + "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER2" \ +> out10o.tmp + + [ `grep "event26@example.com" "out10o.tmp" | wc -l` = '1' ] \ +&& ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out10o.tmp" \ +&& grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out10o.tmp" \ +&& echo "Success" \ +|| echo "Failed"