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 RESOURCE_SCRIPT="$THIS_DIR/../imip_resource.py" 7 SHOWMAIL="$THIS_DIR/../tools/showmail.py" 8 STORE=/tmp/store 9 STATIC=/tmp/static 10 PREFS=/tmp/prefs 11 ARGS="-S $STORE -P $STATIC -p $PREFS -d" 12 13 ERROR=err.tmp 14 15 export N=$1 16 export START=20141126T090000 17 export END=20141126T100000 18 export SENDERADDRESS="person-$N@example.com" 19 export SENDER="mailto:person-$N@example.com" 20 21 # Exit if a previous result indicates acceptance of a request. 22 23 [ -e "outP${N}.tmp" ] \ 24 && `grep 'PARTSTAT' "outP${N}.tmp" | grep -q 'ACCEPTED'` \ 25 && exit 0 26 27 FBRESULT=$2 28 29 # Find the end of a busy period or use the initial start. 30 31 FBSTART=`grep 'FREEBUSY' "$FBRESULT" | grep -v 'VFREEBUSY' | tail -n 1 | cut -d: -f2 | cut -d/ -f2 | tr -d '\\r'` 32 FBEND=`python "$THIS_DIR/next_time.py" "$FBSTART" 09 16` 33 START=${FBSTART:-$START} 34 END=${FBEND:-$END} 35 36 echo "Try for $N with $START and $END..." 37 38 # Request a resource on behalf of a numbered person identity. 39 40 envsubst < "$TEMPLATES/event-request-group.txt" \ 41 | tee "inP${N}.tmp" \ 42 | "$RESOURCE_SCRIPT" $ARGS 2>> $ERROR \ 43 | "$SHOWMAIL" 2>> $ERROR \ 44 > "outP${N}.tmp"