2015-10-17 | Paul Boddie | raw annotate files changeset graph | Consolidated descriptions of events for both REFRESH requests and for messages sent by the manager, bundling the necessary REQUEST and CANCEL payloads to describe events and their recurrences. Changed organiser-sent messages in the manager to be also sent to the user's own address, not the people-outgoing version of that address, adding support for self-sent CANCEL messages in the person handler. Added the removal of cancelled recurrences to restore periods in events edited in the manager. Otherwise, such periods can never be restored. Expanded the REFRESH method tests. |
1 #!/bin/sh 2 3 THIS_DIR=`dirname $0` 4 5 TEMPLATES="$THIS_DIR/templates" 6 PERSON_SCRIPT="$THIS_DIR/../imip_person.py" 7 RESOURCE_SCRIPT="$THIS_DIR/../imip_resource.py" 8 SHOWMAIL="$THIS_DIR/../tools/showmail.py" 9 STORE=/tmp/store 10 STATIC=/tmp/static 11 PREFS=/tmp/prefs 12 ARGS="-S $STORE -P $STATIC -p $PREFS -d" 13 USER="mailto:resource-room-confroom@example.com" 14 SENDER="mailto:paul.boddie@example.com" 15 FBFILE="$STORE/$USER/freebusy" 16 FBSENDERFILE="$STORE/$SENDER/freebusy" 17 FBSENDEROTHERFILE="$STORE/$SENDER/freebusy-other/$USER" 18 TAB=`printf '\t'` 19 20 OUTGOING_SCRIPT="$THIS_DIR/../imip_person_outgoing.py" 21 22 ERROR=err.tmp 23 24 rm -r $STORE 25 rm -r $STATIC 26 rm -r $PREFS 27 rm $ERROR 28 rm out*.tmp 29 30 mkdir -p "$PREFS/$USER" 31 echo 'Europe/Oslo' > "$PREFS/$USER/TZID" 32 echo 'share' > "$PREFS/$USER/freebusy_sharing" 33 34 mkdir -p "$PREFS/$SENDER" 35 echo 'Europe/Oslo' > "$PREFS/$SENDER/TZID" 36 echo 'always' > "$PREFS/$SENDER/event_refreshing" 37 38 # Publish an event, testing registration in the outgoing handler. 39 40 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring.txt" 2>> $ERROR 41 42 grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDERFILE" \ 43 && echo "Success" \ 44 || echo "Failed" 45 46 # Present the request to the recipient. 47 48 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring.txt" 2>> $ERROR \ 49 | "$SHOWMAIL" \ 50 > out1.tmp 51 52 grep -q 'METHOD:REPLY' out1.tmp \ 53 && echo "Success" \ 54 || echo "Failed" 55 56 grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \ 57 && echo "Success" \ 58 || echo "Failed" 59 60 # Present the response to the sender. 61 62 "$PERSON_SCRIPT" $ARGS < out1.tmp 2>> $ERROR \ 63 | "$SHOWMAIL" \ 64 > out2.tmp 65 66 grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDEROTHERFILE" \ 67 && echo "Success" \ 68 || echo "Failed" 69 70 # Attempt to add an occurrence to the event. 71 72 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-add-recurring.txt" 2>> $ERROR 73 74 grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDERFILE" \ 75 && grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBSENDERFILE" \ 76 && echo "Success" \ 77 || echo "Failed" 78 79 # Present the request to the recipient. 80 81 "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-add-recurring.txt" 2>> $ERROR \ 82 | "$SHOWMAIL" \ 83 > out3.tmp 84 85 grep -q 'METHOD:REFRESH' out3.tmp \ 86 && echo "Success" \ 87 || echo "Failed" 88 89 grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \ 90 && ! grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBFILE" \ 91 && echo "Success" \ 92 || echo "Failed" 93 94 # Present the refresh message to the organiser. 95 96 "$PERSON_SCRIPT" $ARGS < out3.tmp 2>> $ERROR \ 97 | "$SHOWMAIL" \ 98 > out4.tmp 99 100 grep -q 'METHOD:REQUEST' out4.tmp \ 101 && echo "Success" \ 102 || echo "Failed" 103 104 # Present the request to the recipient. 105 106 "$RESOURCE_SCRIPT" $ARGS < out4.tmp 2>> $ERROR \ 107 | tee out5r.tmp \ 108 | "$SHOWMAIL" \ 109 > out5.tmp 110 111 grep -q 'METHOD:REPLY' out5.tmp \ 112 && echo "Success" \ 113 || echo "Failed" 114 115 grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \ 116 && grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBFILE" \ 117 && echo "Success" \ 118 || echo "Failed" 119 120 # Present the response to the sender. 121 122 "$PERSON_SCRIPT" $ARGS < out5r.tmp 2>> $ERROR \ 123 | "$SHOWMAIL" \ 124 > out6.tmp 125 126 grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDEROTHERFILE" \ 127 && grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBSENDEROTHERFILE" \ 128 && echo "Success" \ 129 || echo "Failed"