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