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