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