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 12 mkdir -p "$PREFS/$SENDER" 13 echo 'Europe/Oslo' > "$PREFS/$SENDER/TZID" 14 15 # Test the recipient's initial free/busy state. 16 17 test_initial_freebusy 18 test_initial_freebusy_limited 19 20 # Make a new event. 21 22 cat > "event_cmd.tmp" <<EOF 23 new 24 period 0 edit 20141010 10 00 00 Europe/Oslo 20141010 11 00 00 Europe/Oslo 25 rrule 26 freq monthly 1 27 selection weekday FR 2 end 28 count 3 29 end 30 attendance accept 31 attendee mailto:vincent.vole@example.com 32 summary Recurring event 33 finish 34 update event.tmp 35 publish event_self.tmp 36 UID event_uid.tmp 37 EOF 38 39 text_client "$SENDER" "event_cmd.tmp" 40 41 # Obtain the event UID. 42 43 read UID1 < "event_uid.tmp" 44 45 # Register the event at the sender. 46 47 outgoing_script "event_self.tmp" 48 49 # Expect free/busy periods for the sender. 50 51 list_script "out1f.tmp" "$SENDER" "freebusy" 52 test_freebusy '20141212T090000Z' '20141212T100000Z' "out1f.tmp" 53 54 # Present the request to the recipient. 55 56 person_script "event.tmp" "out2.tmp" 57 58 # Expect no reply because the recipient must handle the request. 59 60 is_absent 'METHOD:REPLY' "out2.tmp" && success || failed "out2.tmp" 61 62 # Expect no free/busy periods for the recipient. 63 64 list_script "out2f.tmp" "$USER" "freebusy" 65 test_freebusy_missing '20141212T090000Z' '20141212T100000Z' "out2f.tmp" 66 67 # Expect free/busy periods for the sender at the recipient. 68 69 list_script "out2fo.tmp" "$USER" "freebusy_other" "$SENDER" 70 test_freebusy '20141212T090000Z' '20141212T100000Z' "out2fo.tmp" 71 72 # Accept the invitation. 73 74 cat > "event_accept_cmd.tmp" <<EOF 75 attendance accept 76 finish 77 update event_accept.tmp 78 EOF 79 80 text_client_specific "$USER" "event_accept_cmd.tmp" "$UID1" 81 82 # Register the acceptance at the recipient. 83 84 outgoing_script "event_accept.tmp" 85 86 # Expect free/busy periods at the recipient. 87 88 list_script "out2f2.tmp" "$USER" "freebusy" 89 test_freebusy '20141212T090000Z' '20141212T100000Z' "out2f2.tmp" 90 91 # Cancel a recurrence of the event. 92 93 cat > "event_cancel_cmd.tmp" <<EOF 94 period 1 cancel 95 finish 96 update event_cancel.tmp 97 EOF 98 99 text_client_specific "$SENDER" "event_cancel_cmd.tmp" "$UID1" 100 101 # Register the cancellation at the sender. 102 103 outgoing_script "event_cancel.tmp" 104 105 # Expect only two periods at the sender. 106 107 list_script "out3s.tmp" "$SENDER" "freebusy" 108 test_freebusy_missing '20141114T090000Z' '20141114T100000Z' "out3s.tmp" 109 have_occurrences "$UID1" 2 "out3s.tmp" && success || failed "out3s.tmp" 110 111 # Register the cancellation at the recipient. 112 113 person_script "event_cancel.tmp" "out4.tmp" 114 115 # Expect no reply from the recipient. 116 117 is_absent 'METHOD:REPLY' "out4.tmp" && success || failed "out4.tmp" 118 119 # Expect only two periods at the recipient. 120 121 list_script "out4f.tmp" "$USER" "freebusy" 122 test_freebusy_missing '20141114T090000Z' '20141114T100000Z' "out4f.tmp" 123 have_occurrences "$UID1" 2 "out4f.tmp" && success || failed "out4f.tmp" 124 125 # Expect only two periods for the sender at the recipient. 126 127 list_script "out4fo.tmp" "$USER" "freebusy_other" "$SENDER" 128 test_freebusy_missing '20141114T090000Z' '20141114T100000Z' "out4fo.tmp" 129 have_occurrences "$UID1" 2 "out4fo.tmp" && success || failed "out4fo.tmp" 130 131 # Reschedule the first period 132 133 cat > "event_reschedule_cmd.tmp" <<EOF 134 period 0 edit 20141011 10 00 00 Europe/Oslo 20141011 11 00 00 Europe/Oslo 135 finish 136 update event_reschedule.tmp 137 EOF 138 139 text_client_specific "$SENDER" "event_reschedule_cmd.tmp" "$UID1" 140 141 # Register the rescheduling at the sender. 142 143 outgoing_script "event_reschedule.tmp" 144 145 # Expect a change in the first period at the sender. 146 147 list_script "out4s.tmp" "$SENDER" "freebusy" 148 test_freebusy_missing '20141010T080000Z' '20141010T090000Z' "out4s.tmp" 149 test_freebusy '20141011T080000Z' '20141011T090000Z' "out4s.tmp" 150 151 # Register the rescheduling at the recipient. 152 153 person_script "event_reschedule.tmp" "out5.tmp" 154 155 # Expect no reply from the recipient. 156 157 is_absent 'METHOD:REPLY' "out5.tmp" && success || failed "out5.tmp" 158 159 # Expect no change in the first period at the recipient. 160 161 list_script "out5f.tmp" "$USER" "freebusy" 162 test_freebusy '20141010T080000Z' '20141010T090000Z' "out5f.tmp" 163 test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out5f.tmp" 164 165 # Expect a change in the first period for the sender at the recipient. 166 167 list_script "out5fo.tmp" "$USER" "freebusy_other" "$SENDER" 168 test_freebusy_missing '20141010T080000Z' '20141010T090000Z' "out5fo.tmp" 169 test_freebusy '20141011T080000Z' '20141011T090000Z' "out5fo.tmp" 170 171 # Accept the rescheduling. 172 173 cat > "event_accept2_cmd.tmp" <<EOF 174 attendance accept 175 finish 176 update event_accept2.tmp 177 EOF 178 179 text_client_specific "$USER" "event_accept2_cmd.tmp" "$UID1" '20141010T080000Z' 180 181 # Register the acceptance at the recipient. 182 183 outgoing_script "event_accept2.tmp" 184 185 # Expect a change in the first period at the recipient. 186 187 list_script "out6f.tmp" "$USER" "freebusy" 188 test_freebusy_missing '20141010T080000Z' '20141010T090000Z' "out6f.tmp" 189 test_freebusy '20141011T080000Z' '20141011T090000Z' "out6f.tmp" 190 191 # Prepare a complete cancellation. 192 193 cat > "event_cancel_all_cmd.tmp" <<EOF 194 cancel 195 finish 196 cancel event_cancel_all.tmp 197 EOF 198 199 text_client_specific "$SENDER" "event_cancel_all_cmd.tmp" "$UID1" 200 201 # Register the cancellation at the sender. 202 203 outgoing_script "event_cancel_all.tmp" 204 205 # Expect no periods at the sender. 206 207 list_script "out7s.tmp" "$SENDER" "freebusy" 208 have_occurrences "$UID1" 0 "out7s.tmp" && success || failed "out7s.tmp" 209 210 # Register the cancellation at the recipient. 211 212 person_script "event_cancel_all.tmp" "out7.tmp" 213 214 # Expect no reply from the recipient. 215 216 is_absent 'METHOD:REPLY' "out7.tmp" && success || failed "out7.tmp" 217 218 # Expect no periods at the recipient. 219 220 list_script "out7f.tmp" "$USER" "freebusy" 221 have_occurrences "$UID1" 0 "out7f.tmp" && success || failed "out7f.tmp" 222 223 # Expect no periods for the sender at the recipient. 224 225 list_script "out7fo.tmp" "$USER" "freebusy_other" "$SENDER" 226 have_occurrences "$UID1" 0 "out7fo.tmp" && success || failed "out7fo.tmp" 227 228 # Switch time zones. 229 230 echo 'Europe/Mariehamn' > "$PREFS/$USER/TZID" 231 232 # Register the event at the sender. 233 234 outgoing_script "event_self.tmp" 235 236 # Expect free/busy periods for the sender. 237 238 list_script "out8f.tmp" "$SENDER" "freebusy" 239 test_freebusy '20141212T090000Z' '20141212T100000Z' "out8f.tmp" 240 241 # Present the request to the recipient. 242 243 person_script "event.tmp" "out9.tmp" 244 245 # Expect no reply because the recipient must handle the request. 246 247 is_absent 'METHOD:REPLY' "out9.tmp" && success || failed "out9.tmp" 248 249 # Expect no free/busy periods for the recipient. 250 251 list_script "out9f.tmp" "$USER" "freebusy" 252 test_freebusy_missing '20141212T090000Z' '20141212T100000Z' "out9f.tmp" 253 254 # Expect free/busy periods for the sender at the recipient. 255 256 list_script "out9fo.tmp" "$USER" "freebusy_other" "$SENDER" 257 test_freebusy '20141212T090000Z' '20141212T100000Z' "out9fo.tmp" 258 259 text_client_specific "$USER" "event_accept_cmd.tmp" "$UID1" 260 261 # Register the acceptance at the recipient. 262 263 outgoing_script "event_accept.tmp" 264 265 # Expect free/busy periods at the recipient. 266 267 list_script "out9f2.tmp" "$USER" "freebusy" 268 test_freebusy '20141212T090000Z' '20141212T100000Z' "out9f2.tmp" 269 270 # Cancel the event. 271 272 outgoing_script "event_cancel_all.tmp" 273 274 # Expect no periods at the sender. 275 276 list_script "out10s.tmp" "$SENDER" "freebusy" 277 have_occurrences "$UID1" 0 "out10s.tmp" && success || failed "out10s.tmp" 278 279 # Register the cancellation at the recipient. 280 281 person_script "event_cancel_all.tmp" "out10.tmp" 282 283 # Expect no reply from the recipient. 284 285 is_absent 'METHOD:REPLY' "out10.tmp" && success || failed "out10.tmp" 286 287 # Expect no periods at the recipient. 288 289 list_script "out10f.tmp" "$USER" "freebusy" 290 have_occurrences "$UID1" 0 "out10f.tmp" && success || failed "out10f.tmp" 291 292 # Expect no periods for the sender at the recipient. 293 294 list_script "out10fo.tmp" "$USER" "freebusy_other" "$SENDER" 295 have_occurrences "$UID1" 0 "out10fo.tmp" && success || failed "out10fo.tmp" 296 297 # Test floating dates. Here, the outgoing interpretation is different because 298 # the sender is in a different time zone. 299 300 cat > "event_floating_cmd.tmp" <<EOF 301 new 302 period 0 edit 20141010 - 20141010 - 303 rrule 304 freq monthly 1 305 selection weekday FR 2 end 306 count 3 307 end 308 attendee mailto:vincent.vole@example.com 309 summary Recurring event 310 list 311 finish 312 update event_floating.tmp 313 publish event_floating_self.tmp 314 UID event_floating_uid.tmp 315 EOF 316 317 text_client "$SENDER" "event_floating_cmd.tmp" 318 319 # Obtain the event UID. 320 321 read UID2 < "event_floating_uid.tmp" 322 323 # Register the event at the sender. 324 325 outgoing_script "event_floating_self.tmp" 326 327 # Expect free/busy periods for the sender. 328 329 list_script "out11s.tmp" "$SENDER" "freebusy" 330 test_freebusy '20141211T230000Z' '20141212T230000Z' "out11s.tmp" 331 332 # Present the request to the recipient. 333 334 person_script "event_floating.tmp" "out11.tmp" 335 336 # Expect no reply because the recipient must handle the request. 337 338 is_absent 'METHOD:REPLY' "out11.tmp" && success || failed "out11.tmp" 339 340 # Expect no free/busy periods for the recipient (in either time zone). 341 342 list_script "out11f.tmp" "$USER" "freebusy" 343 test_freebusy_missing '20141211T220000Z' '20141212T220000Z' "out11f.tmp" 344 test_freebusy_missing '20141211T230000Z' '20141212T230000Z' "out11f.tmp" 345 346 # Expect no free/busy periods for the sender at the recipient. 347 # The organiser is not attending. 348 349 list_script "out11fo.tmp" "$USER" "freebusy_other" "$SENDER" 350 test_freebusy_missing '20141211T220000Z' '20141212T220000Z' "out11fo.tmp" 351 test_freebusy_missing '20141211T230000Z' '20141212T230000Z' "out11fo.tmp" 352 353 # Accept the invitation. 354 355 text_client_specific "$USER" "event_accept_cmd.tmp" "$UID2" 356 357 # Register the acceptance at the recipient. 358 359 outgoing_script "event_accept.tmp" 360 361 # Expect free/busy periods at the recipient (in the appropriate time zone). 362 363 list_script "out12f.tmp" "$USER" "freebusy" 364 test_freebusy '20141211T220000Z' '20141212T220000Z' "out12f.tmp" 365 test_freebusy_missing '20141211T230000Z' '20141212T230000Z' "out12f.tmp"