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 # Present a free/busy request for all periods to the recipient. 13 14 person_script "$TEMPLATES/fb-request-person-all.txt" "out0.tmp" 15 16 # Expect a reply with no periods. 17 18 is_present 'METHOD:REPLY' "out0.tmp" \ 19 && is_absent '^FREEBUSY' "out0.tmp" \ 20 && success || failed "out0.tmp" 21 22 # Present a free/busy request for periods of interest to the recipient. 23 24 person_script "$TEMPLATES/fb-request-person.txt" "out1.tmp" 25 26 # Expect a reply with no periods. 27 28 is_present 'METHOD:REPLY' "out1.tmp" \ 29 && is_absent '^FREEBUSY' "out1.tmp" \ 30 && success || failed "out1.tmp" 31 32 # Make a new event. 33 34 cat > "event_cmd.tmp" <<EOF 35 new 36 period 0 edit 20141126 16 00 00 Europe/Oslo 20141126 17 00 00 Europe/Oslo 37 attendance accept 38 attendee mailto:vincent.vole@example.com 39 summary Meeting at 4pm 40 finish 41 update event.tmp 42 publish event_self.tmp 43 UID event_uid.tmp 44 EOF 45 46 text_client "$SENDER" "event_cmd.tmp" 47 48 # Obtain the event UID. 49 50 read UID1 < "event_uid.tmp" 51 52 # Register the event at the sender. 53 54 outgoing_script "event_self.tmp" 55 56 # Present the event to the recipient. 57 58 person_script "event.tmp" "out2.tmp" 59 60 # Expect no reply because the recipient must handle the request. 61 62 is_absent 'METHOD:REPLY' "out2.tmp" && success || failed "out2.tmp" 63 64 # Expect no free/busy periods for the recipient. 65 66 list_script "out2f.tmp" "$USER" "freebusy" 67 test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out2f.tmp" 68 69 # Expect free/busy periods for the sender at the recipient. 70 71 list_script "out2fo.tmp" "$USER" "freebusy_other" "$SENDER" 72 test_freebusy '20141126T150000Z' '20141126T160000Z' "out2fo.tmp" 73 74 # Accept the invitation. 75 76 cat > "event_accept_cmd.tmp" <<EOF 77 attendance accept 78 finish 79 update event_accept.tmp 80 EOF 81 82 text_client_specific "$USER" "event_accept_cmd.tmp" "$UID1" 83 84 # Register the acceptance at the recipient. 85 86 outgoing_script "event_accept.tmp" 87 88 # Expect free/busy periods at the recipient. 89 90 list_script "out3f.tmp" "$USER" "freebusy" 91 test_freebusy '20141126T150000Z' '20141126T160000Z' "out3f.tmp" 92 93 # Make another event at the same time. 94 95 sed \ 96 's/summary Meeting at 4pm/summary A conflicting meeting at 4pm/;'\ 97 's/update event.tmp/update event_conflicting.tmp/;'\ 98 's/UID event_uid.tmp/UID event_conflicting_uid.tmp/' "event_cmd.tmp" \ 99 > "event_conflicting_cmd.tmp" 100 101 text_client "$SENDER" "event_conflicting_cmd.tmp" 102 103 # Obtain the event UID. 104 105 read UID2 < "event_conflicting_uid.tmp" 106 107 # Present the event to the recipient. 108 109 person_script "event_conflicting.tmp" "out4.tmp" 110 111 # Expect no reply because the recipient must handle the request. 112 113 is_absent 'METHOD:REPLY' "out4.tmp" && success || failed "out4.tmp" 114 115 # Expect no free/busy periods for the recipient for this event. 116 117 list_script "out4f.tmp" "$USER" "freebusy" 118 is_absent "$UID2" "out4f.tmp" && success || failed "out4f.tmp" 119 120 # Expect free/busy periods for the sender at the recipient for this event. 121 122 list_script "out4fo.tmp" "$USER" "freebusy_other" "$SENDER" 123 is_present "$UID2" "out4fo.tmp" && success || failed "out4fo.tmp" 124 125 # Decline the invitation. 126 127 cat > "event_decline_cmd.tmp" <<EOF 128 attendance decline 129 finish 130 update event_decline.tmp 131 EOF 132 133 text_client_specific "$USER" "event_decline_cmd.tmp" "$UID2" 134 135 # Register the rejection at the recipient. 136 137 outgoing_script "event_decline.tmp" 138 139 # Expect free/busy periods only for the original event, not the last one. 140 141 list_script "out5f.tmp" "$USER" "freebusy" 142 is_present "$UID1" "out5f.tmp" \ 143 && is_absent "$UID2" "out5f.tmp" \ 144 && success || failed "out5f.tmp" 145 146 # Cancel the event for a recipient. 147 148 cat > "event_cancel_cmd.tmp" <<EOF 149 attendee mailto:vincent.vole@example.com remove 150 finish 151 cancel event_cancel.tmp 152 EOF 153 154 text_client_specific "$SENDER" "event_cancel_cmd.tmp" "$UID1" 155 156 # Present the cancellation to the recipient. 157 158 person_script "event_cancel.tmp" "out6.tmp" 159 160 # Expect no reply because the recipient must handle the request. 161 162 is_absent 'METHOD:REPLY' "out6.tmp" && success || failed "out6.tmp" 163 164 # Expect no free/busy periods for the recipient. 165 166 list_script "out6f.tmp" "$USER" "freebusy" 167 is_absent "$UID1" "out6f.tmp" && success || failed "out6f.tmp" 168 169 # Expect free/busy periods for the sender at the recipient for this event since 170 # only the recipient was uninvited. 171 172 list_script "out6fo.tmp" "$USER" "freebusy_other" "$SENDER" 173 is_present "$UID1" "out6fo.tmp" && success || failed "out6fo.tmp" 174 175 # Cancel the event for all recipients. 176 177 cat > "event_cancel_all_cmd.tmp" <<EOF 178 finish 179 cancel event_cancel_all.tmp 180 EOF 181 182 text_client_specific "$SENDER" "event_cancel_all_cmd.tmp" "$UID1" 183 184 # Present the cancellation to the recipient. 185 186 person_script "event_cancel_all.tmp" "out7.tmp" 187 188 # Expect no reply because the recipient must handle the request. 189 190 is_absent 'METHOD:REPLY' "out7.tmp" && success || failed "out7.tmp" 191 192 # Expect no free/busy periods for the recipient. 193 194 list_script "out7f.tmp" "$USER" "freebusy" 195 is_absent "$UID1" "out7f.tmp" && success || failed "out7f.tmp" 196 197 # Expect no free/busy periods for the sender at the recipient for this event. 198 199 list_script "out7fo.tmp" "$USER" "freebusy_other" "$SENDER" 200 is_absent "$UID1" "out7fo.tmp" && success || failed "out7fo.tmp" 201 202 # Create a message from another sender that is largely a copy of the original 203 # event trying to organise the event using someone else's identity. 204 205 sed \ 206 's/summary Meeting at 4pm/summary A spoofed meeting at 4pm/;'\ 207 's/update event.tmp/update event_spoofed.tmp/;'\ 208 's/UID event_uid.tmp/UID event_spoofed_uid.tmp/' "event_cmd.tmp" \ 209 > "event_spoofed_cmd.tmp" 210 211 text_client "$SENDER" "event_spoofed_cmd.tmp" 212 213 # Obtain the event UID. 214 215 read UID3 < "event_spoofed_uid.tmp" 216 217 sed 's/From: paul.boddie/From: harvey.horse/' "event_spoofed.tmp" \ 218 > "event_spoofed_ready.tmp" 219 220 # Present the event to the recipient. 221 222 person_script "event_spoofed_ready.tmp" "out8.tmp" 223 224 # Expect no reply because the recipient must handle the request. 225 226 is_absent 'METHOD:REPLY' "out8.tmp" && success || failed "out8.tmp" 227 228 # Expect no free/busy periods for the recipient. 229 230 list_script "out8f.tmp" "$USER" "freebusy" 231 is_absent "$UID3" "out8f.tmp" && success || failed "out8f.tmp" 232 233 # Expect no free/busy periods for the sender at the recipient. 234 235 list_script "out8fo.tmp" "$USER" "freebusy_other" "$SENDER" 236 is_absent "$UID3" "out8fo.tmp" && success || failed "out8fo.tmp"