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 USERADDRESS="vincent.vole@example.com" 8 SENDERADDRESS="paul.boddie@example.com" 9 10 mkdir -p "$PREFS/$USER" 11 echo 'Europe/Oslo' > "$PREFS/$USER/TZID" 12 echo 'share' > "$PREFS/$USER/freebusy_sharing" 13 echo 'PT60S' > "$PREFS/$USER/freebusy_offers" 14 15 # Test the recipient's initial free/busy state. 16 17 test_initial_freebusy 18 19 # Make a new event. 20 21 cat > "event_cmd.tmp" <<EOF 22 new 23 period 0 edit 20141126 16 00 00 Europe/Oslo 20141126 17 00 00 Europe/Oslo 24 attendance accept 25 attendee mailto:vincent.vole@example.com 26 summary Meeting at 4pm 27 finish 28 update event.tmp 29 publish event_self.tmp 30 UID event_uid.tmp 31 EOF 32 33 text_client "$SENDER" "event_cmd.tmp" 34 35 # Obtain the event UID. 36 37 read UID1 < "event_uid.tmp" 38 39 # Register the event at the sender. 40 41 outgoing_script "event.tmp" 42 43 # Expect free/busy periods at the sender. 44 45 list_script "out0f.tmp" "$SENDER" "freebusy" 46 test_freebusy '20141126T150000Z' '20141126T160000Z' "out0f.tmp" 47 48 # Present the request to the recipient. 49 50 person_script "event.tmp" "out1.tmp" 51 52 # Expect no reply because the recipient must handle the request. 53 54 is_absent 'METHOD:REPLY' "out1.tmp" && success || failed "out1.tmp" 55 56 # Expect no free/busy periods for the recipient. 57 58 list_script "out1f.tmp" "$USER" "freebusy" 59 test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out1f.tmp" 60 61 # Expect free/busy periods for the sender at the recipient. 62 63 list_script "out1fo.tmp" "$USER" "freebusy_other" "$SENDER" 64 test_freebusy '20141126T150000Z' '20141126T160000Z' "out1fo.tmp" 65 66 # Counter the invitation. 67 68 cat > "event_counter_cmd.tmp" <<EOF 69 period 0 edit 20141126 17 00 00 Europe/Oslo 20141126 18 00 00 Europe/Oslo 70 finish 71 update event_counter.tmp 72 EOF 73 74 text_client_specific "$USER" "event_counter_cmd.tmp" "$UID1" 75 76 # Expect a counter-proposal from the client. 77 78 showmail "event_counter.tmp" | is_present 'METHOD:COUNTER' \ 79 && success || failed "event_counter.tmp" 80 81 # Note that the invitation has only been prepared, not processed. 82 83 list_script "out2f.tmp" "$USER" "freebusy" 84 test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out2f.tmp" 85 test_freebusy_missing '20141126T160000Z' '20141126T170000Z' "out2f.tmp" 86 87 list_script "out2fo.tmp" "$USER" "freebusy_offers" 88 test_freebusy_missing '20141126T160000Z' '20141126T170000Z' "out2fo.tmp" 89 90 # Send the counter-proposal. 91 92 outgoing_script "event_counter.tmp" 93 94 # Expect no free/busy periods for the recipient. 95 96 list_script "out2f2.tmp" "$USER" "freebusy" 97 test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out2f2.tmp" 98 test_freebusy_missing '20141126T160000Z' '20141126T170000Z' "out2f2.tmp" 99 100 # Expect a free/busy offer period. 101 102 list_script "out2o2.tmp" "$USER" "freebusy_offers" 103 test_freebusy '20141126T160000Z' '20141126T170000Z' "out2o2.tmp" 104 105 # Present the response to the organiser. 106 107 person_script "event_counter.tmp" "out3.tmp" 108 109 # Expect no free/busy periods for the recipient at the sender. 110 111 list_script "out3f.tmp" "$SENDER" "freebusy_other" "$USER" 112 test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out3f.tmp" 113 test_freebusy_missing '20141126T160000Z' '20141126T170000Z' "out3f.tmp" 114 115 # Expect the original object at the sender. 116 117 list_script "out3O.tmp" "$SENDER" "object" "$UID1" 118 is_present 'DTSTART;TZID=Europe/Oslo.*:20141126T160000' "out3O.tmp" \ 119 && success || failed "out3O.tmp" 120 121 # Expect the countered object at the sender. 122 123 list_script "out3C.tmp" "$SENDER" "countered_object" "$UID1" "$USER" 124 is_present 'DTSTART;TZID=Europe/Oslo.*:20141126T170000' "out3C.tmp" \ 125 && success || failed "out3C.tmp" 126 127 # Expect a request at the sender. 128 129 list_script "out3R.tmp" "$SENDER" "requests" 130 is_present "$UID1" "out3R.tmp" && success || failed "out3R.tmp" 131 132 # Check the free/busy state of the recipient so far. 133 134 person_script "$TEMPLATES/fb-request-person-all.txt" "out4.tmp" 135 136 is_present 'METHOD:REPLY' "out4.tmp" \ 137 && is_absent '^FREEBUSY' "out4.tmp" \ 138 && success || failed "out4.tmp" 139 140 # Decline the counter-proposal. 141 # NOTE: Support this in the client. 142 143 showmail "event_counter.tmp" \ 144 | sed 's/COUNTER/DECLINECOUNTER/' \ 145 | sed "s/^From: $USERADDRESS/To: $USERADDRESS/" \ 146 | sed "s/^To: $SENDERADDRESS/From: $SENDERADDRESS/" \ 147 > "event_declinecounter.tmp" 148 149 outgoing_script "event_declinecounter.tmp" 150 151 # The countered object should be removed at the sender. 152 153 list_script "out5C.tmp" "$SENDER" "countered_object" "$UID1" "$USER" 154 is_absent "$UID1" "out5C.tmp" && success || failed "out5C.tmp" 155 156 # The request should be removed at the sender. 157 158 list_script "out5R.tmp" "$SENDER" "requests" 159 is_absent "$UID1" "out5R.tmp" && success || failed "out5R.tmp" 160 161 # Present the decline message to the recipient. 162 163 person_script "event_declinecounter.tmp" "out6.tmp" 164 165 # Expect no free/busy periods at the recipient. 166 167 list_script "out6f.tmp" "$USER" "freebusy" 168 test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out6f.tmp" 169 test_freebusy_missing '20141126T160000Z' '20141126T170000Z' "out6f.tmp" 170 171 # Expect no free/busy offers at the recipient. 172 173 list_script "out6o.tmp" "$USER" "freebusy_offers" 174 test_freebusy_missing '20141126T150000Z' '20141126T160000Z' "out6o.tmp" 175 test_freebusy_missing '20141126T160000Z' '20141126T170000Z' "out6o.tmp"