1 #!/bin/sh 2 3 . "`dirname \"$0\"`/common.sh" 4 5 USER1="mailto:vincent.vole@example.com" 6 USER2="mailto:harvey.horse@example.com" 7 SENDER="mailto:paul.boddie@example.com" 8 9 mkdir -p "$PREFS/$USER1" 10 echo 'Europe/Oslo' > "$PREFS/$USER1/TZID" 11 echo 'share' > "$PREFS/$USER1/freebusy_sharing" 12 13 mkdir -p "$PREFS/$USER2" 14 echo 'Europe/Oslo' > "$PREFS/$USER2/TZID" 15 echo 'share' > "$PREFS/$USER2/freebusy_sharing" 16 17 mkdir -p "$PREFS/$SENDER" 18 echo 'Europe/Oslo' > "$PREFS/$SENDER/TZID" 19 20 # Test the recipient's initial free/busy state. 21 22 test_initial_freebusy 23 test_initial_freebusy_limited 24 25 # Make a new event. 26 27 cat > "event_cmd.tmp" <<EOF 28 new 29 period 0 edit 20141010 10 00 00 Europe/Oslo 20141010 11 00 00 Europe/Oslo 30 period new 20141011 10 00 00 Europe/Oslo 20141011 11 00 00 Europe/Oslo 31 attendance accept 32 attendee mailto:vincent.vole@example.com 33 attendee mailto:harvey.horse@example.com 34 summary Recurring event 35 finish 36 update event.tmp 37 publish event_self.tmp 38 UID event_uid.tmp 39 EOF 40 41 text_client "$SENDER" "event_cmd.tmp" 42 43 # Obtain the event UID. 44 45 read UID1 < "event_uid.tmp" 46 47 # Register the event at the sender. 48 49 outgoing_script "event_self.tmp" 50 51 # Expect free/busy periods at the sender. 52 53 list_script "out1f.tmp" "$SENDER" "freebusy" 54 test_freebusy '20141011T080000Z' '20141011T090000Z' "out1f.tmp" 55 56 # There should be an event created by the sender. 57 58 list_script "out1O.tmp" "$SENDER" "object" "$UID1" 59 is_present "$UID1" "out1O.tmp" && success || failed "out1O.tmp" 60 61 # Present the event to the recipients. 62 63 person_script "event.tmp" "out2.tmp" 64 65 # Expect no reply because the recipients must handle the request. 66 67 is_absent 'METHOD:REPLY' "out2.tmp" && success || failed "out2.tmp" 68 69 # Expect no free/busy periods for the recipients. 70 71 list_script "out2f1.tmp" "$USER1" "freebusy" 72 test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out2f1.tmp" 73 74 list_script "out2f2.tmp" "$USER2" "freebusy" 75 test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out2f2.tmp" 76 77 # Expect free/busy periods for the sender at the recipients. 78 79 list_script "out2fo1.tmp" "$USER1" "freebusy_other" "$SENDER" 80 test_freebusy '20141011T080000Z' '20141011T090000Z' "out2fo1.tmp" 81 82 list_script "out2fo2.tmp" "$USER2" "freebusy_other" "$SENDER" 83 test_freebusy '20141011T080000Z' '20141011T090000Z' "out2fo2.tmp" 84 85 # There should be an event created by the sender. 86 87 list_script "out2O1.tmp" "$USER1" "object" "$UID1" 88 is_present "$UID1" "out2O1.tmp" && success || failed "out2O1.tmp" 89 90 list_script "out2O2.tmp" "$USER1" "object" "$UID1" 91 is_present "$UID1" "out2O2.tmp" && success || failed "out2O2.tmp" 92 93 # Accept the invitation. 94 95 cat > "event_accept1_cmd.tmp" <<EOF 96 attendance accept 97 finish 98 update event_accept1.tmp 99 EOF 100 101 sed 's/event_accept1.tmp/event_accept2.tmp/' "event_accept1_cmd.tmp" \ 102 > "event_accept2_cmd.tmp" 103 104 text_client_specific "$USER1" "event_accept1_cmd.tmp" "$UID1" 105 text_client_specific "$USER2" "event_accept2_cmd.tmp" "$UID1" 106 107 # Register the acceptance at the recipients. 108 109 outgoing_script "event_accept1.tmp" 110 outgoing_script "event_accept2.tmp" 111 112 # Expect free/busy periods at the recipients. 113 114 list_script "out3f1.tmp" "$USER1" "freebusy" 115 test_freebusy '20141011T080000Z' '20141011T090000Z' "out3f1.tmp" 116 117 list_script "out3f2.tmp" "$USER2" "freebusy" 118 test_freebusy '20141011T080000Z' '20141011T090000Z' "out3f2.tmp" 119 120 # Test registration in the incoming handler. 121 122 person_script "event_accept1.tmp" "out4i1.tmp" 123 list_script "out4f1.tmp" "$SENDER" "freebusy_other" "$USER1" 124 test_freebusy '20141011T080000Z' '20141011T090000Z' "out4f1.tmp" 125 list_script "out4f2v1.tmp" "$SENDER" "freebusy_other" "$USER2" 126 test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out4f2v1.tmp" 127 128 person_script "event_accept2.tmp" "out4i2.tmp" 129 list_script "out4f2v2.tmp" "$SENDER" "freebusy_other" "$USER1" 130 test_freebusy '20141011T080000Z' '20141011T090000Z' "out4f2v2.tmp" 131 132 # Decline the invitation to the recurrence for the first user. 133 134 cat > "event_decline1_cmd.tmp" <<EOF 135 attendance decline 136 finish 137 update event_decline1.tmp 138 EOF 139 140 text_client_specific "$USER1" "event_decline1_cmd.tmp" "$UID1" '20141011T080000Z' 141 142 # Register the rejection at the user. 143 144 outgoing_script "event_decline1.tmp" 145 146 # Expect only one free/busy period at the user. 147 148 list_script "out5s.tmp" "$USER1" "freebusy" 149 test_freebusy '20141010T080000Z' '20141010T090000Z' "out5s.tmp" 150 test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out5s.tmp" 151 152 # There should be a recurrence created by the user. 153 154 list_script "out5O.tmp" "$USER1" "object" "$UID1" 155 is_present "$UID1" "out5O.tmp" && success || failed "out5O.tmp" 156 157 list_script "out5R.tmp" "$USER1" "recurrence" "$UID1" '20141011T080000Z' 158 is_present "$UID1" "out5R.tmp" && success || failed "out5R.tmp" 159 160 # Register the rejection at the sender. 161 162 person_script "event_decline1.tmp" "out6.tmp" 163 164 # Expect two free/busy periods for the sender. 165 166 list_script "out6f.tmp" "$SENDER" "freebusy" 167 have_occurrences "$UID1" 2 "out6f.tmp" && success || failed "out6f.tmp" 168 test_freebusy '20141010T080000Z' '20141010T090000Z' "out6f.tmp" 169 test_freebusy '20141011T080000Z' '20141011T090000Z' "out6f.tmp" 170 171 # Expect one free/busy period for the first user at the sender. 172 173 list_script "out6o1.tmp" "$SENDER" "freebusy_other" "$USER1" 174 test_freebusy '20141010T080000Z' '20141010T090000Z' "out6o1.tmp" 175 test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out6o1.tmp" 176 177 # Expect two free/busy periods for the second user at the sender. 178 179 list_script "out6o2.tmp" "$SENDER" "freebusy_other" "$USER2" 180 have_occurrences "$UID1" 2 "out6o2.tmp" && success || failed "out6o2.tmp" 181 test_freebusy '20141010T080000Z' '20141010T090000Z' "out6o2.tmp" 182 test_freebusy '20141011T080000Z' '20141011T090000Z' "out6o2.tmp" 183 184 # There should be a recurrence created by the user. 185 186 list_script "out6O.tmp" "$SENDER" "object" "$UID1" 187 is_present "$UID1" "out6O.tmp" && success || failed "out6O.tmp" 188 189 list_script "out6R.tmp" "$SENDER" "recurrence" "$UID1" '20141011T080000Z' 190 is_present "$UID1" "out6R.tmp" && success || failed "out6R.tmp" 191 192 # This should cause the organiser to tell the second user about the recurrence. 193 194 is_present 'METHOD:REQUEST' "out6.tmp" && success || failed "out6.tmp" 195 196 # Present the update to the second user. 197 198 person_script "out6.tmp" "out62.tmp" 199 200 # There should be a recurrence created by the first user at the second user. 201 202 list_script "out6O2.tmp" "$USER2" "object" "$UID1" 203 is_present "$UID1" "out6O2.tmp" && success || failed "out6O2.tmp" 204 205 list_script "out6R2.tmp" "$USER2" "recurrence" "$UID1" '20141011T080000Z' 206 is_present "$UID1" "out6R2.tmp" && success || failed "out6R2.tmp" 207 208 # The second user's schedule should remain unchanged. 209 # NOTE: The nature of the periods might need to change, with the recurrence 210 # NOTE: taking over the affected period. 211 212 list_script "out6f2.tmp" "$USER2" "freebusy" 213 have_occurrences "$UID1" 2 "out6f2.tmp" && success || failed "out6f2.tmp" 214 test_freebusy '20141010T080000Z' '20141010T090000Z' "out6f2.tmp" 215 test_freebusy '20141011T080000Z' '20141011T090000Z' "out6f2.tmp" 216 217 # Accept the invitation for the recurrence at the first user. 218 219 sed 's/event_accept1.tmp/event_accept1r.tmp/' "event_accept1_cmd.tmp" \ 220 > "event_accept1r_cmd.tmp" 221 222 text_client_specific "$USER1" "event_accept1r_cmd.tmp" "$UID1" '20141011T080000Z' 223 224 # Register acceptance in the outgoing handler. 225 226 outgoing_script "event_accept1r.tmp" 227 228 # Expect both periods in the user's free/busy collection. 229 230 list_script "out7f.tmp" "$USER1" "freebusy" 231 have_occurrences "$UID1" 2 "out7f.tmp" && success || failed "out7f.tmp" 232 test_freebusy '20141010T080000Z' '20141010T090000Z' "out7f.tmp" 233 test_freebusy '20141011T080000Z' '20141011T090000Z' "out7f.tmp" 234 235 # There should still be a recurrence created by the user. 236 237 list_script "out7O.tmp" "$USER1" "object" "$UID1" 238 is_present "$UID1" "out7O.tmp" && success || failed "out7O.tmp" 239 240 list_script "out7R.tmp" "$USER1" "recurrence" "$UID1" '20141011T080000Z' 241 is_present "$UID1" "out7R.tmp" && success || failed "out7R.tmp" 242 243 # Register the acceptance at the sender. 244 245 person_script "event_accept1r.tmp" "out8.tmp" 246 247 # Expect both periods in the sender's free/busy collection. 248 249 list_script "out8f.tmp" "$SENDER" "freebusy" 250 have_occurrences "$UID1" 2 "out8f.tmp" && success || failed "out8f.tmp" 251 test_freebusy '20141010T080000Z' '20141010T090000Z' "out8f.tmp" 252 test_freebusy '20141011T080000Z' '20141011T090000Z' "out8f.tmp" 253 254 # Expect both periods for the first user at the sender. 255 256 list_script "out8o1.tmp" "$SENDER" "freebusy_other" "$USER1" 257 have_occurrences "$UID1" 2 "out8o1.tmp" && success || failed "out8o1.tmp" 258 test_freebusy '20141010T080000Z' '20141010T090000Z' "out8o1.tmp" 259 test_freebusy '20141011T080000Z' '20141011T090000Z' "out8o1.tmp" 260 261 # The second user should not have been affected. 262 263 list_script "out8o2.tmp" "$SENDER" "freebusy_other" "$USER2" 264 have_occurrences "$UID1" 2 "out8o2.tmp" && success || failed "out8o2.tmp" 265 test_freebusy '20141010T080000Z' '20141010T090000Z' "out8o2.tmp" 266 test_freebusy '20141011T080000Z' '20141011T090000Z' "out8o2.tmp" 267 268 # There should be a recurrence created by the user. 269 270 list_script "out8O.tmp" "$SENDER" "object" "$UID1" 271 is_present "$UID1" "out8O.tmp" && success || failed "out8O.tmp" 272 273 list_script "out8R.tmp" "$SENDER" "recurrence" "$UID1" '20141011T080000Z' 274 is_present "$UID1" "out8R.tmp" && success || failed "out8R.tmp" 275 276 # Test recurrence declining in the outgoing handler. 277 # Now the second user declines the parent event. 278 279 sed 's/event_decline1.tmp/event_decline2.tmp/' "event_decline1_cmd.tmp" \ 280 > "event_decline2_cmd.tmp" 281 282 text_client_specific "$USER2" "event_decline2_cmd.tmp" "$UID1" 283 284 # Register acceptance in the outgoing handler. 285 286 outgoing_script "event_decline2.tmp" 287 288 # Expect only the recurrence period for the second user. 289 290 list_script "out9s.tmp" "$USER2" "freebusy" 291 have_occurrences "$UID1" 1 "out9s.tmp" && success || failed "out9s.tmp" 292 test_freebusy_missing '20141010T080000Z' '20141010T090000Z' "out9s.tmp" 293 test_freebusy '20141011T080000Z' '20141011T090000Z' "out9s.tmp" 294 295 # Test declining in the incoming handler. 296 297 person_script "event_decline2.tmp" "out10.tmp" 298 299 # Expect periods for the organiser as before. 300 301 list_script "out10f.tmp" "$SENDER" "freebusy" 302 have_occurrences "$UID1" 2 "out10f.tmp" && success || failed "out10f.tmp" 303 test_freebusy '20141010T080000Z' '20141010T090000Z' "out10f.tmp" 304 test_freebusy '20141011T080000Z' '20141011T090000Z' "out10f.tmp" 305 306 # Expect only the recurrence period for the second user at the organiser. 307 308 list_script "out10o2.tmp" "$SENDER" "freebusy_other" "$USER2" 309 have_occurrences "$UID1" 1 "out10o2.tmp" && success || failed "out10o2.tmp" 310 test_freebusy_missing '20141010T080000Z' '20141010T090000Z' "out10o2.tmp" 311 test_freebusy '20141011T080000Z' '20141011T090000Z' "out10o2.tmp"