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