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