paul@728 | 1 | #!/bin/sh |
paul@728 | 2 | |
paul@728 | 3 | THIS_DIR=`dirname $0` |
paul@728 | 4 | |
paul@728 | 5 | TEMPLATES="$THIS_DIR/templates" |
paul@728 | 6 | RESOURCE_SCRIPT="$THIS_DIR/../imip_resource.py" |
paul@728 | 7 | SHOWMAIL="$THIS_DIR/../tools/showmail.py" |
paul@728 | 8 | STORE=/tmp/store |
paul@728 | 9 | STATIC=/tmp/static |
paul@728 | 10 | PREFS=/tmp/prefs |
paul@728 | 11 | ARGS="-S $STORE -P $STATIC -p $PREFS -d" |
paul@728 | 12 | USER="mailto:resource-room-confroom@example.com" |
paul@728 | 13 | ERROR=err.tmp |
paul@728 | 14 | |
paul@728 | 15 | rm -r $STORE |
paul@728 | 16 | rm -r $STATIC |
paul@728 | 17 | rm -r $PREFS |
paul@728 | 18 | rm $ERROR |
paul@728 | 19 | rm out*.tmp |
paul@728 | 20 | |
paul@728 | 21 | mkdir -p "$PREFS/$USER" |
paul@728 | 22 | echo 'Europe/Oslo' > "$PREFS/$USER/TZID" |
paul@728 | 23 | echo 'share' > "$PREFS/$USER/freebusy_sharing" |
paul@728 | 24 | echo 'never' > "$PREFS/$USER/organiser_replacement" |
paul@728 | 25 | |
paul@728 | 26 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \ |
paul@728 | 27 | | "$SHOWMAIL" \ |
paul@728 | 28 | > out0.tmp |
paul@728 | 29 | |
paul@728 | 30 | grep -q 'METHOD:REPLY' out0.tmp \ |
paul@728 | 31 | && ! grep -q '^FREEBUSY' out0.tmp \ |
paul@728 | 32 | && echo "Success" \ |
paul@728 | 33 | || echo "Failed" |
paul@728 | 34 | |
paul@728 | 35 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \ |
paul@728 | 36 | | "$SHOWMAIL" \ |
paul@728 | 37 | > out1.tmp |
paul@728 | 38 | |
paul@728 | 39 | grep -q 'METHOD:REPLY' out1.tmp \ |
paul@728 | 40 | && ! grep -q '^FREEBUSY' out1.tmp \ |
paul@728 | 41 | && echo "Success" \ |
paul@728 | 42 | || echo "Failed" |
paul@728 | 43 | |
paul@728 | 44 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request.txt" 2>> $ERROR \ |
paul@728 | 45 | | "$SHOWMAIL" \ |
paul@728 | 46 | > out2.tmp |
paul@728 | 47 | |
paul@728 | 48 | grep -q 'METHOD:REPLY' out2.tmp \ |
paul@728 | 49 | && grep -q 'ATTENDEE;PARTSTAT=ACCEPTED' out2.tmp \ |
paul@728 | 50 | && echo "Success" \ |
paul@728 | 51 | || echo "Failed" |
paul@728 | 52 | |
paul@728 | 53 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \ |
paul@728 | 54 | | "$SHOWMAIL" \ |
paul@728 | 55 | > out3.tmp |
paul@728 | 56 | |
paul@728 | 57 | grep -q 'METHOD:REPLY' out3.tmp \ |
paul@728 | 58 | && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out3.tmp \ |
paul@728 | 59 | && echo "Success" \ |
paul@728 | 60 | || echo "Failed" |
paul@728 | 61 | |
paul@728 | 62 | # Try to change to an unrecognised organiser. |
paul@728 | 63 | |
paul@728 | 64 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-imposter.txt" 2>> $ERROR \ |
paul@728 | 65 | | "$SHOWMAIL" \ |
paul@728 | 66 | > out4.tmp |
paul@728 | 67 | |
paul@728 | 68 | ! grep -q 'METHOD:REPLY' out4.tmp \ |
paul@728 | 69 | && echo "Success" \ |
paul@728 | 70 | || echo "Failed" |
paul@728 | 71 | |
paul@728 | 72 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \ |
paul@728 | 73 | | "$SHOWMAIL" \ |
paul@728 | 74 | > out5.tmp |
paul@728 | 75 | |
paul@728 | 76 | grep -q 'METHOD:REPLY' out5.tmp \ |
paul@728 | 77 | && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out5.tmp \ |
paul@728 | 78 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T160000Z' out5.tmp \ |
paul@728 | 79 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T160000Z' out5.tmp \ |
paul@728 | 80 | && echo "Success" \ |
paul@728 | 81 | || echo "Failed" |
paul@728 | 82 | |
paul@728 | 83 | # Try to change to an attendee as organiser. |
paul@728 | 84 | |
paul@728 | 85 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-imposter-attendee.txt" 2>> $ERROR \ |
paul@728 | 86 | | "$SHOWMAIL" \ |
paul@728 | 87 | > out6.tmp |
paul@728 | 88 | |
paul@728 | 89 | ! grep -q 'METHOD:REPLY' out6.tmp \ |
paul@728 | 90 | && echo "Success" \ |
paul@728 | 91 | || echo "Failed" |
paul@728 | 92 | |
paul@728 | 93 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \ |
paul@728 | 94 | | "$SHOWMAIL" \ |
paul@728 | 95 | > out7.tmp |
paul@728 | 96 | |
paul@728 | 97 | grep -q 'METHOD:REPLY' out7.tmp \ |
paul@728 | 98 | && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out7.tmp \ |
paul@728 | 99 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T160000Z' out7.tmp \ |
paul@728 | 100 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T160000Z' out7.tmp \ |
paul@728 | 101 | && echo "Success" \ |
paul@728 | 102 | || echo "Failed" |
paul@728 | 103 | |
paul@728 | 104 | # Change the policy. |
paul@728 | 105 | |
paul@728 | 106 | echo 'attendee' > "$PREFS/$USER/organiser_replacement" |
paul@728 | 107 | |
paul@728 | 108 | # Try to change to an attendee as organiser. |
paul@728 | 109 | |
paul@728 | 110 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-imposter-attendee.txt" 2>> $ERROR \ |
paul@728 | 111 | | "$SHOWMAIL" \ |
paul@728 | 112 | > out8.tmp |
paul@728 | 113 | |
paul@728 | 114 | grep -q 'METHOD:REPLY' out8.tmp \ |
paul@728 | 115 | && echo "Success" \ |
paul@728 | 116 | || echo "Failed" |
paul@728 | 117 | |
paul@728 | 118 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \ |
paul@728 | 119 | | "$SHOWMAIL" \ |
paul@728 | 120 | > out9.tmp |
paul@728 | 121 | |
paul@728 | 122 | grep -q 'METHOD:REPLY' out9.tmp \ |
paul@728 | 123 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out9.tmp \ |
paul@728 | 124 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T160000Z' out9.tmp \ |
paul@728 | 125 | && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T160000Z' out9.tmp \ |
paul@728 | 126 | && echo "Success" \ |
paul@728 | 127 | || echo "Failed" |
paul@728 | 128 | |
paul@728 | 129 | # Try to change to an unrecognised organiser. |
paul@728 | 130 | |
paul@728 | 131 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-imposter.txt" 2>> $ERROR \ |
paul@728 | 132 | | "$SHOWMAIL" \ |
paul@728 | 133 | > out10.tmp |
paul@728 | 134 | |
paul@728 | 135 | ! grep -q 'METHOD:REPLY' out10.tmp \ |
paul@728 | 136 | && echo "Success" \ |
paul@728 | 137 | || echo "Failed" |
paul@728 | 138 | |
paul@728 | 139 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \ |
paul@728 | 140 | | "$SHOWMAIL" \ |
paul@728 | 141 | > out11.tmp |
paul@728 | 142 | |
paul@728 | 143 | grep -q 'METHOD:REPLY' out11.tmp \ |
paul@728 | 144 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out11.tmp \ |
paul@728 | 145 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T160000Z' out11.tmp \ |
paul@728 | 146 | && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T160000Z' out11.tmp \ |
paul@728 | 147 | && echo "Success" \ |
paul@728 | 148 | || echo "Failed" |
paul@728 | 149 | |
paul@728 | 150 | # Change the policy. |
paul@728 | 151 | |
paul@728 | 152 | echo 'any' > "$PREFS/$USER/organiser_replacement" |
paul@728 | 153 | |
paul@728 | 154 | # Try to change to an unrecognised organiser. |
paul@728 | 155 | |
paul@728 | 156 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-imposter.txt" 2>> $ERROR \ |
paul@728 | 157 | | "$SHOWMAIL" \ |
paul@728 | 158 | > out12.tmp |
paul@728 | 159 | |
paul@728 | 160 | grep -q 'METHOD:REPLY' out12.tmp \ |
paul@728 | 161 | && echo "Success" \ |
paul@728 | 162 | || echo "Failed" |
paul@728 | 163 | |
paul@728 | 164 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \ |
paul@728 | 165 | | "$SHOWMAIL" \ |
paul@728 | 166 | > out13.tmp |
paul@728 | 167 | |
paul@728 | 168 | grep -q 'METHOD:REPLY' out13.tmp \ |
paul@728 | 169 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out13.tmp \ |
paul@728 | 170 | && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T160000Z' out13.tmp \ |
paul@728 | 171 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T160000Z' out13.tmp \ |
paul@728 | 172 | && echo "Success" \ |
paul@728 | 173 | || echo "Failed" |
paul@728 | 174 | |
paul@728 | 175 | # Try to change to an attendee as organiser. |
paul@728 | 176 | |
paul@728 | 177 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-imposter-attendee.txt" 2>> $ERROR \ |
paul@728 | 178 | | "$SHOWMAIL" \ |
paul@728 | 179 | > out14.tmp |
paul@728 | 180 | |
paul@728 | 181 | grep -q 'METHOD:REPLY' out14.tmp \ |
paul@728 | 182 | && echo "Success" \ |
paul@728 | 183 | || echo "Failed" |
paul@728 | 184 | |
paul@728 | 185 | "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \ |
paul@728 | 186 | | "$SHOWMAIL" \ |
paul@728 | 187 | > out15.tmp |
paul@728 | 188 | |
paul@728 | 189 | grep -q 'METHOD:REPLY' out15.tmp \ |
paul@728 | 190 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out15.tmp \ |
paul@728 | 191 | && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T160000Z' out15.tmp \ |
paul@728 | 192 | && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T160000Z' out15.tmp \ |
paul@728 | 193 | && echo "Success" \ |
paul@728 | 194 | || echo "Failed" |