1 #!/bin/sh 2 3 . "`dirname \"$0\"`/common.sh" 4 5 USER="mailto:vincent.vole@example.com" 6 SENDER="mailto:paul.boddie@example.com" 7 8 mkdir -p "$PREFS/$USER" 9 echo 'Europe/Oslo' > "$PREFS/$USER/TZID" 10 echo 'share' > "$PREFS/$USER/freebusy_sharing" 11 echo 'PT60S' > "$PREFS/$USER/freebusy_offers" 12 13 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \ 14 | "$SHOWMAIL" \ 15 > out0.tmp 16 17 grep -q 'METHOD:REPLY' out0.tmp \ 18 && ! grep -q '^FREEBUSY' out0.tmp \ 19 && echo "Success" \ 20 || echo "Failed" 21 22 # Attempt to schedule an event. 23 24 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person.txt" 2>> $ERROR 25 26 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \ 27 > out0f.tmp 28 29 grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out0f.tmp" \ 30 && echo "Success" \ 31 || echo "Failed" 32 33 # Present the request to the recipient. 34 35 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person.txt" 2>> $ERROR \ 36 | "$SHOWMAIL" \ 37 > out1.tmp 38 39 ! grep -q 'METHOD:REPLY' out1.tmp \ 40 && echo "Success" \ 41 || echo "Failed" 42 43 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 44 > out1f.tmp 45 46 ! grep -q "event6@example.com" "out1f.tmp" \ 47 && echo "Success" \ 48 || echo "Failed" 49 50 ! [ -e "$FBOTHERFILE" ] \ 51 || ! grep -q "event6@example.com" "$FBOTHERFILE" \ 52 && echo "Success" \ 53 || echo "Failed" 54 55 # Counter the invitation. 56 57 "$COUNTER_SCRIPT" $COUNTER_ARGS "$USER" 20141126T170000 20141126T180000 "event6@example.com" 2>> $ERROR \ 58 | tee out2r.tmp \ 59 | "$SHOWMAIL" \ 60 > out2.tmp 61 62 # Note that the invitation has only been prepared, not processed. 63 64 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 65 > out2f.tmp 66 67 ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out2f.tmp" \ 68 && ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "out2f.tmp" \ 69 && echo "Success" \ 70 || echo "Failed" 71 72 grep -q 'METHOD:COUNTER' out2.tmp \ 73 && grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T170000' out2.tmp \ 74 && echo "Success" \ 75 || echo "Failed" 76 77 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \ 78 > out2o.tmp 79 80 ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "out2o.tmp" \ 81 && echo "Success" \ 82 || echo "Failed" 83 84 # Send the counter-proposal. 85 86 "$OUTGOING_SCRIPT" $ARGS < out2r.tmp 2>> $ERROR 87 88 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 89 > out2f2.tmp 90 91 ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out2f2.tmp" \ 92 && ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "out2f2.tmp" \ 93 && echo "Success" \ 94 || echo "Failed" 95 96 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \ 97 > out2o2.tmp 98 99 grep -q "^20141126T160000Z${TAB}20141126T170000Z" "out2o2.tmp" \ 100 && echo "Success" \ 101 || echo "Failed" 102 103 # Present the response to the organiser. 104 105 "$PERSON_SCRIPT" $ARGS < out2r.tmp 2>> $ERROR \ 106 | tee out3r.tmp \ 107 | "$SHOWMAIL" \ 108 > out3.tmp 109 110 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER" \ 111 > out3f.tmp 112 113 ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out3f.tmp" \ 114 && ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "out3f.tmp" \ 115 && echo "Success" \ 116 || echo "Failed" 117 118 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "object" "event6@example.com" \ 119 > out3O.tmp 120 121 grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T160000' "out3O.tmp" \ 122 && echo "Success" \ 123 || echo "Failed" 124 125 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "countered_object" "event6@example.com" "$USER" \ 126 > out3C.tmp 127 128 grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T170000' "out3C.tmp" \ 129 && echo "Success" \ 130 || echo "Failed" 131 132 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "requests" \ 133 > out3R.tmp 134 135 grep -q 'event6@example.com' "out3R.tmp" \ 136 && echo "Success" \ 137 || echo "Failed" 138 139 # Check the free/busy state of the recipient so far. 140 141 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \ 142 | "$SHOWMAIL" \ 143 > out4.tmp 144 145 grep -q 'METHOD:REPLY' out4.tmp \ 146 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out4.tmp \ 147 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T160000Z/20141126T170000Z' out4.tmp \ 148 && echo "Success" \ 149 || echo "Failed" 150 151 # Decline the counter-proposal. 152 153 sed 's/COUNTER/DECLINECOUNTER/' < out2.tmp \ 154 | sed 's/^From: calendar/To: vincent.vole/' \ 155 | sed 's/^To: paul.boddie/From: paul.boddie/' \ 156 > out5.tmp 157 158 "$OUTGOING_SCRIPT" $ARGS < out5.tmp 2>> $ERROR 159 160 "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "countered_object" "event6@example.com" "$USER" \ 161 > out5C.tmp 162 163 ! grep -q 'event6@example.com' "out5C.tmp" \ 164 && echo "Success" \ 165 || echo "Failed" 166 167 "$LIST_SCRIPT" $LIST_ARGS "$USER" "requests" \ 168 > out5R.tmp 169 170 ! grep -q 'event6@example.com' "out5R.tmp" \ 171 && echo "Success" \ 172 || echo "Failed" 173 174 "$PERSON_SCRIPT" $ARGS < out5.tmp 2>> $ERROR \ 175 | "$SHOWMAIL" \ 176 > out6.tmp 177 178 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \ 179 > out6f.tmp 180 181 ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out6f.tmp" \ 182 && ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "out6f.tmp" \ 183 && echo "Success" \ 184 || echo "Failed" 185 186 "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \ 187 > out6o.tmp 188 189 ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out6o.tmp" \ 190 && ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "out6o.tmp" \ 191 && echo "Success" \ 192 || echo "Failed"