1.1 --- a/imiptools/handlers/person.py Mon Oct 05 17:19:54 2015 +0200
1.2 +++ b/imiptools/handlers/person.py Mon Oct 05 17:20:30 2015 +0200
1.3 @@ -105,6 +105,20 @@
1.4
1.5 return True
1.6
1.7 + def _declinecounter(self):
1.8 +
1.9 + "Revoke any counter-proposal recorded as a free/busy offer."
1.10 +
1.11 + # Obtain valid organiser and attendee details.
1.12 +
1.13 + oa = self.require_organiser_and_attendees()
1.14 + if not oa:
1.15 + return False
1.16 +
1.17 + self.remove_event_from_freebusy_offers()
1.18 +
1.19 + return True
1.20 +
1.21 def _record(self, from_organiser=True, queue=False, cancel=False):
1.22
1.23 """
1.24 @@ -264,13 +278,14 @@
1.25 "Record a counter-proposal to a proposed event."
1.26
1.27 if self._counter():
1.28 - return self.wrap("A counter proposal to an event invitation has been received.", link=False)
1.29 + return self.wrap("A counter proposal to an event invitation has been received.", link=True)
1.30
1.31 def declinecounter(self):
1.32
1.33 - # NOTE: Queue a rejected modification to any active event.
1.34 + "Record a rejection of a counter-proposal."
1.35
1.36 - return self.wrap("Your counter proposal to an event invitation has been declined.", link=False)
1.37 + if self._declinecounter():
1.38 + return self.wrap("Your counter proposal to an event invitation has been declined.", link=True)
1.39
1.40 def publish(self):
1.41
2.1 --- a/imiptools/handlers/person_outgoing.py Mon Oct 05 17:19:54 2015 +0200
2.2 +++ b/imiptools/handlers/person_outgoing.py Mon Oct 05 17:20:30 2015 +0200
2.3 @@ -205,6 +205,20 @@
2.4
2.5 return True
2.6
2.7 + def _declinecounter(self):
2.8 +
2.9 + "Remove any counter-proposals for the given event."
2.10 +
2.11 + if not Client.is_participating(self):
2.12 + return False
2.13 +
2.14 + # Check for event using UID.
2.15 +
2.16 + if not self.have_new_object():
2.17 + return False
2.18 +
2.19 + self.store.dequeue_request(self.user, self.uid, self.recurrenceid)
2.20 +
2.21 class Event(PersonHandler):
2.22
2.23 "An event handler."
2.24 @@ -229,9 +243,9 @@
2.25
2.26 def declinecounter(self):
2.27
2.28 - "Declined counter-proposals are advisory and do not change events."
2.29 + "Expire any offer made by a counter-proposal."
2.30
2.31 - pass
2.32 + self._declinecounter()
2.33
2.34 def publish(self):
2.35
3.1 --- a/tests/test_person_invitation_counter.sh Mon Oct 05 17:19:54 2015 +0200
3.2 +++ b/tests/test_person_invitation_counter.sh Mon Oct 05 17:20:30 2015 +0200
3.3 @@ -120,3 +120,73 @@
3.4 grep -q "^20141126T160000Z${TAB}20141126T170000Z" "$FBOFFERFILE" \
3.5 && echo "Success" \
3.6 || echo "Failed"
3.7 +
3.8 +# Present the response to the organiser.
3.9 +
3.10 + "$PERSON_SCRIPT" $ARGS < out2r.tmp 2>> $ERROR \
3.11 +| tee out3r.tmp \
3.12 +| "$SHOWMAIL" \
3.13 +> out3.tmp
3.14 +
3.15 + ! [ -e "$FBSENDEROTHERFILE" ] \
3.16 +|| ( ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBSENDEROTHERFILE" \
3.17 + && ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "$FBSENDEROTHERFILE" ) \
3.18 +&& echo "Success" \
3.19 +|| echo "Failed"
3.20 +
3.21 + grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' "$STORE/$SENDER/objects/event6@example.com" \
3.22 +&& grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T160000' "$STORE/$SENDER/objects/event6@example.com" \
3.23 +&& echo "Success" \
3.24 +|| echo "Failed"
3.25 +
3.26 + grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T170000' "$STORE/$SENDER/counters/objects/event6@example.com/$USER" \
3.27 +&& echo "Success" \
3.28 +|| echo "Failed"
3.29 +
3.30 + grep -q 'event6@example.com' "$FBSENDERREQUESTS" \
3.31 +&& echo "Success" \
3.32 +|| echo "Failed"
3.33 +
3.34 +# Check the free/busy state of the recipient so far.
3.35 +
3.36 + "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \
3.37 +| "$SHOWMAIL" \
3.38 +> out4.tmp
3.39 +
3.40 + grep -q 'METHOD:REPLY' out4.tmp \
3.41 +&& ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out4.tmp \
3.42 +&& ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T160000Z/20141126T170000Z' out4.tmp \
3.43 +&& echo "Success" \
3.44 +|| echo "Failed"
3.45 +
3.46 +# Decline the counter-proposal.
3.47 +
3.48 + sed 's/COUNTER/DECLINECOUNTER/' < out2.tmp \
3.49 +| sed 's/^From: calendar/To: vincent.vole/' \
3.50 +| sed 's/^To: paul.boddie/From: paul.boddie/' \
3.51 +> out5.tmp
3.52 +
3.53 +"$OUTGOING_SCRIPT" $ARGS < out5.tmp 2>> $ERROR
3.54 +
3.55 + ! [ -e "$STORE/$SENDER/counters/objects/event6@example.com/$USER" ] \
3.56 +&& echo "Success" \
3.57 +|| echo "Failed"
3.58 +
3.59 + ! grep -q 'event6@example.com' "$FBSENDERREQUESTS" \
3.60 +&& echo "Success" \
3.61 +|| echo "Failed"
3.62 +
3.63 + "$PERSON_SCRIPT" $ARGS < out5.tmp 2>> $ERROR \
3.64 +| "$SHOWMAIL" \
3.65 +> out6.tmp
3.66 +
3.67 + ! [ -e "$FBFILE" ] \
3.68 +|| ( ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \
3.69 + && ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "$FBFILE" ) \
3.70 +&& echo "Success" \
3.71 +|| echo "Failed"
3.72 +
3.73 + ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBOFFERFILE" \
3.74 +&& ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "$FBOFFERFILE" \
3.75 +&& echo "Success" \
3.76 +|| echo "Failed"