1.1 --- a/imiptools/client.py Wed Oct 14 14:56:05 2015 +0200
1.2 +++ b/imiptools/client.py Wed Oct 14 18:00:04 2015 +0200
1.3 @@ -351,9 +351,11 @@
1.4
1.5 for attendee, attendee_attr in attendees.items():
1.6
1.7 - # Update attendance in the loaded object.
1.8 + # Update attendance in the loaded object for any recognised
1.9 + # attendees.
1.10
1.11 - attendee_map[attendee] = attendee_attr
1.12 + if attendee_map.has_key(attendee):
1.13 + attendee_map[attendee] = attendee_attr
1.14
1.15 # Set the new details and store the object.
1.16
1.17 @@ -813,7 +815,16 @@
1.18
1.19 "For the current user, record free/busy information from 'attendees'."
1.20
1.21 - for attendee in attendees.keys():
1.22 + obj = self.get_stored_object_version()
1.23 +
1.24 + if not obj or not self.have_new_object():
1.25 + return
1.26 +
1.27 + # Filter out unrecognised attendees.
1.28 +
1.29 + attendees = set(attendees).intersection(uri_values(obj.get_values("ATTENDEE")))
1.30 +
1.31 + for attendee in attendees:
1.32 self.update_freebusy_from_participant(attendee, False)
1.33
1.34 def remove_freebusy_from_organiser(self, organiser):
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/tests/templates/event-request-person-imposter-object.txt Wed Oct 14 18:00:04 2015 +0200
2.3 @@ -0,0 +1,10 @@
2.4 +BEGIN:VEVENT
2.5 +ORGANIZER:mailto:paul.boddie@example.com
2.6 +ATTENDEE;ROLE=CHAIR:mailto:paul.boddie@example.com
2.7 +ATTENDEE;RSVP=TRUE:mailto:oliver.otter@example.com
2.8 +DTSTAMP:20141125T004600Z
2.9 +DTSTART;TZID=Europe/Oslo:20141126T160000
2.10 +DTEND;TZID=Europe/Oslo:20141126T170000
2.11 +SUMMARY:Meeting at 4pm
2.12 +UID:event6@example.com
2.13 +END:VEVENT
3.1 --- a/tests/test_person_non_participation.sh Wed Oct 14 14:56:05 2015 +0200
3.2 +++ b/tests/test_person_non_participation.sh Wed Oct 14 18:00:04 2015 +0200
3.3 @@ -10,9 +10,11 @@
3.4 PREFS=/tmp/prefs
3.5 ARGS="-S $STORE -P $STATIC -p $PREFS -d"
3.6 USER="mailto:vincent.vole@example.com"
3.7 +IMPOSTER="mailto:oliver.otter@example.com"
3.8 SENDER="mailto:paul.boddie@example.com"
3.9 FBFILE="$STORE/$USER/freebusy"
3.10 FBOTHERFILE="$STORE/$USER/freebusy-other/$SENDER"
3.11 +FBIMPOSTERFILE="$STORE/$SENDER/freebusy-other/$IMPOSTER"
3.12 TAB=`printf '\t'`
3.13
3.14 OUTGOING_SCRIPT="$THIS_DIR/../imip_person_outgoing.py"
3.15 @@ -37,6 +39,9 @@
3.16 mkdir -p "$PREFS/$USER"
3.17 echo 'no' > "$PREFS/$USER/participating"
3.18
3.19 +mkdir -p "$PREFS/$SENDER"
3.20 +echo 'yes' > "$PREFS/$SENDER/participating"
3.21 +
3.22 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \
3.23 | "$SHOWMAIL" \
3.24 > out0.tmp
3.25 @@ -45,6 +50,16 @@
3.26 && echo "Success" \
3.27 || echo "Failed"
3.28
3.29 +# Show the request to the outgoing handler first.
3.30 +
3.31 +"$OUTGOING_SCRIPT" < "$TEMPLATES/event-request-person.txt" $ARGS 2>> $ERROR
3.32 +
3.33 + [ -e "$STORE/$SENDER/objects/event6@example.com" ] \
3.34 +&& echo "Success" \
3.35 +|| echo "Failed"
3.36 +
3.37 +# Send a request to the recipient.
3.38 +
3.39 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person.txt" 2>> $ERROR \
3.40 | "$SHOWMAIL" \
3.41 > out2.tmp
3.42 @@ -61,6 +76,8 @@
3.43 && echo "Success" \
3.44 || echo "Failed"
3.45
3.46 +# Make sure that the recipient ignored it.
3.47 +
3.48 "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" < "$TEMPLATES/event-request-person-object.txt" 2>> $ERROR \
3.49 | tee out3.tmp \
3.50 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
3.51 @@ -69,3 +86,21 @@
3.52 || ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \
3.53 && echo "Success" \
3.54 || echo "Failed"
3.55 +
3.56 +# Now see if an imposter can invite themself to the event.
3.57 +
3.58 + "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$IMPOSTER" < "$TEMPLATES/event-request-person-imposter-object.txt" 2>> $ERROR \
3.59 +| tee out4.tmp \
3.60 +| "$PERSON_SCRIPT" $ARGS 2>> $ERROR \
3.61 +| "$SHOWMAIL" \
3.62 +> out5.tmp
3.63 +
3.64 + [ -e "$STORE/$SENDER/objects/event6@example.com" ] \
3.65 +&& ! grep -q "otter" "$STORE/$SENDER/objects/event6@example.com" \
3.66 +&& echo "Success" \
3.67 +|| echo "Failed"
3.68 +
3.69 + ( ! [ -e "$FBIMPOSTERFILE" ] \
3.70 + || ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBIMPOSTERFILE") \
3.71 +&& echo "Success" \
3.72 +|| echo "Failed"