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 mkdir -p "$PREFS/$SENDER" 13 echo 'Europe/Oslo' > "$PREFS/$USER/TZID" 14 echo 'always' > "$PREFS/$SENDER/event_refreshing" 15 16 # Make a new event. 17 18 cat > "event_cmd.tmp" <<EOF 19 new 20 period 0 edit 20141010 10 00 00 Europe/Oslo 20141010 11 00 00 Europe/Oslo 21 rrule 22 freq monthly 1 23 selection weekday FR 2 end 24 count 3 25 end 26 attendance accept 27 attendee mailto:vincent.vole@example.com 28 summary Recurring event 29 finish 30 update event.tmp 31 publish event_self.tmp 32 UID event_uid.tmp 33 EOF 34 35 text_client "$SENDER" "event_cmd.tmp" 36 37 # Obtain the event UID. 38 39 read UID1 < "event_uid.tmp" 40 41 # Register the event at the sender. 42 43 outgoing_script "event_self.tmp" 44 45 # Expect free/busy periods for the sender. 46 47 list_script "out1f.tmp" "$SENDER" "freebusy" 48 test_freebusy '20141212T090000Z' '20141212T100000Z' "out1f.tmp" 49 50 # Present the request to the recipient. 51 52 person_script "event.tmp" "out2.tmp" 53 54 # Expect no reply because the recipient must handle the request. 55 56 is_absent 'METHOD:REPLY' "out2.tmp" && success || failed "out2.tmp" 57 58 # Expect no free/busy periods for the recipient. 59 60 list_script "out2f.tmp" "$USER" "freebusy" 61 test_freebusy_missing '20141212T090000Z' '20141212T100000Z' "out2f.tmp" 62 63 # Expect free/busy periods for the sender at the recipient. 64 65 list_script "out2fo.tmp" "$USER" "freebusy_other" "$SENDER" 66 test_freebusy '20141212T090000Z' '20141212T100000Z' "out2fo.tmp" 67 68 # Accept the invitation. 69 70 cat > "event_accept_cmd.tmp" <<EOF 71 attendance accept 72 finish 73 update event_accept.tmp 74 EOF 75 76 text_client_specific "$USER" "event_accept_cmd.tmp" "$UID1" 77 78 # Register the acceptance at the recipient. 79 80 outgoing_script "event_accept.tmp" 81 82 # Test the nature of the acceptance message. 83 84 showmail "event_accept.tmp" | is_present 'METHOD:REPLY' \ 85 && success || failed "event_accept.tmp" 86 87 # Expect free/busy periods at the recipient. 88 89 list_script "out3f.tmp" "$USER" "freebusy" 90 test_freebusy '20141212T090000Z' '20141212T100000Z' "out3f.tmp" 91 92 # Present the result to the sender. 93 94 person_script "event_accept.tmp" "out4.tmp" 95 96 # Expect free/busy periods at the sender for the recipient. 97 98 list_script "out4fo.tmp" "$SENDER" "freebusy_other" "$USER" 99 test_freebusy '20141212T090000Z' '20141212T100000Z' "out4fo.tmp" 100 101 # Attempt to add an occurrence to the event. 102 103 cat > "event_cmd2.tmp" <<EOF 104 period new 20150109 10 00 00 Europe/Oslo 20150109 11 00 00 Europe/Oslo 105 finish 106 update event_add.tmp 107 EOF 108 109 text_client_specific "$SENDER" "event_cmd2.tmp" "$UID1" 110 111 # Register the new occurrence at the sender. 112 113 outgoing_script "event_add.tmp" 114 115 # Expect free/busy periods for the event at the sender. 116 117 list_script "out4f.tmp" "$SENDER" "freebusy" 118 test_freebusy '20141212T090000Z' '20141212T100000Z' "out4f.tmp" 119 test_freebusy '20150109T090000Z' '20150109T100000Z' "out4f.tmp" 120 121 # Present the request to the recipient. 122 123 person_script "event_add.tmp" "out5.tmp" 124 125 # Expect a response demanding a refreshed event. 126 127 is_present 'METHOD:REFRESH' "out5.tmp" && success || failed "out5.tmp" 128 129 # Expect no new free/busy period for the event at the recipient. 130 131 list_script "out5f.tmp" "$USER" "freebusy" 132 test_freebusy '20141212T090000Z' '20141212T100000Z' "out5f.tmp" 133 test_freebusy_missing '20150109T090000Z' '20150109T100000Z' "out5f.tmp" 134 135 list_script "out5fo.tmp" "$USER" "freebusy_other" "$SENDER" 136 test_freebusy '20141212T090000Z' '20141212T100000Z' "out5fo.tmp" 137 test_freebusy_missing '20150109T090000Z' '20150109T100000Z' "out5fo.tmp" 138 139 # Present the refresh message to the organiser. 140 141 person_script "out5.tmp" "out6.tmp" "out6r.tmp" 142 143 # Expect a new event request from the organiser. 144 145 is_present 'METHOD:REQUEST' "out6.tmp" && success || failed "out6.tmp" 146 147 # Present the request to the recipient. 148 149 person_script "out6r.tmp" "out7.tmp" 150 151 # Expect no reply because the recipient must handle the request. 152 153 is_absent 'METHOD:REPLY' "out7.tmp" && success || failed "out7.tmp" 154 155 # Expect no new free/busy period for the event at the recipient. 156 157 list_script "out7f.tmp" "$USER" "freebusy" 158 test_freebusy '20141212T090000Z' '20141212T100000Z' "out7f.tmp" 159 test_freebusy_missing '20150109T090000Z' '20150109T100000Z' "out7f.tmp" 160 161 # Expect the new free/busy period for the sender at the recipient. 162 163 list_script "out7fo.tmp" "$USER" "freebusy_other" "$SENDER" 164 test_freebusy '20141212T090000Z' '20141212T100000Z' "out7fo.tmp" 165 test_freebusy '20150109T090000Z' '20150109T100000Z' "out7fo.tmp" 166 167 # Test acceptance and registration in the outgoing handler. 168 169 text_client_specific "$USER" "event_accept_cmd.tmp" "$UID1" 170 outgoing_script "event_accept.tmp" 171 172 # Accept the invitation. 173 174 cat > "event_accept_cmd2.tmp" <<EOF 175 attendance accept 176 finish 177 update event_accept2.tmp 178 EOF 179 180 text_client_specific "$USER" "event_accept_cmd2.tmp" "$UID1" '20150109T090000Z' 181 182 # Register the acceptance at the recipient. 183 184 outgoing_script "event_accept2.tmp" 185 186 # Test the nature of the acceptance message. 187 188 showmail "event_accept2.tmp" | is_present 'METHOD:REPLY' \ 189 && success || failed "event_accept2.tmp" 190 191 # Expect the new free/busy period at the recipient. 192 193 list_script "out9f.tmp" "$USER" "freebusy" 194 test_freebusy '20141212T090000Z' '20141212T100000Z' "out9f.tmp" 195 test_freebusy '20150109T090000Z' '20150109T100000Z' "out9f.tmp"