1 | <?php |
---|
2 | /*********************************************** |
---|
3 | * File : meetingresponse.php |
---|
4 | * Project : Z-Push |
---|
5 | * Descr : Provides the MEETINGRESPONSE command |
---|
6 | * |
---|
7 | * Created : 16.02.2012 |
---|
8 | * |
---|
9 | * Copyright 2007 - 2012 Zarafa Deutschland GmbH |
---|
10 | * |
---|
11 | * This program is free software: you can redistribute it and/or modify |
---|
12 | * it under the terms of the GNU Affero General Public License, version 3, |
---|
13 | * as published by the Free Software Foundation with the following additional |
---|
14 | * term according to sec. 7: |
---|
15 | * |
---|
16 | * According to sec. 7 of the GNU Affero General Public License, version 3, |
---|
17 | * the terms of the AGPL are supplemented with the following terms: |
---|
18 | * |
---|
19 | * "Zarafa" is a registered trademark of Zarafa B.V. |
---|
20 | * "Z-Push" is a registered trademark of Zarafa Deutschland GmbH |
---|
21 | * The licensing of the Program under the AGPL does not imply a trademark license. |
---|
22 | * Therefore any rights, title and interest in our trademarks remain entirely with us. |
---|
23 | * |
---|
24 | * However, if you propagate an unmodified version of the Program you are |
---|
25 | * allowed to use the term "Z-Push" to indicate that you distribute the Program. |
---|
26 | * Furthermore you may use our trademarks where it is necessary to indicate |
---|
27 | * the intended purpose of a product or service provided you use it in accordance |
---|
28 | * with honest practices in industrial or commercial matters. |
---|
29 | * If you want to propagate modified versions of the Program under the name "Z-Push", |
---|
30 | * you may only do so if you have a written permission by Zarafa Deutschland GmbH |
---|
31 | * (to acquire a permission please contact Zarafa at trademark@zarafa.com). |
---|
32 | * |
---|
33 | * This program is distributed in the hope that it will be useful, |
---|
34 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
35 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
36 | * GNU Affero General Public License for more details. |
---|
37 | * |
---|
38 | * You should have received a copy of the GNU Affero General Public License |
---|
39 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
40 | * |
---|
41 | * Consult LICENSE file for details |
---|
42 | ************************************************/ |
---|
43 | |
---|
44 | class MeetingResponse extends RequestProcessor { |
---|
45 | |
---|
46 | /** |
---|
47 | * Handles the MeetingResponse command |
---|
48 | * |
---|
49 | * @param int $commandCode |
---|
50 | * |
---|
51 | * @access public |
---|
52 | * @return boolean |
---|
53 | */ |
---|
54 | public function Handle($commandCode) { |
---|
55 | $requests = Array(); |
---|
56 | |
---|
57 | if(!self::$decoder->getElementStartTag(SYNC_MEETINGRESPONSE_MEETINGRESPONSE)) |
---|
58 | return false; |
---|
59 | |
---|
60 | while(self::$decoder->getElementStartTag(SYNC_MEETINGRESPONSE_REQUEST)) { |
---|
61 | $req = Array(); |
---|
62 | while(1) { |
---|
63 | if(self::$decoder->getElementStartTag(SYNC_MEETINGRESPONSE_USERRESPONSE)) { |
---|
64 | $req["response"] = self::$decoder->getElementContent(); |
---|
65 | if(!self::$decoder->getElementEndTag()) |
---|
66 | return false; |
---|
67 | } |
---|
68 | |
---|
69 | if(self::$decoder->getElementStartTag(SYNC_MEETINGRESPONSE_FOLDERID)) { |
---|
70 | $req["folderid"] = self::$decoder->getElementContent(); |
---|
71 | if(!self::$decoder->getElementEndTag()) |
---|
72 | return false; |
---|
73 | } |
---|
74 | |
---|
75 | if(self::$decoder->getElementStartTag(SYNC_MEETINGRESPONSE_REQUESTID)) { |
---|
76 | $req["requestid"] = self::$decoder->getElementContent(); |
---|
77 | if(!self::$decoder->getElementEndTag()) |
---|
78 | return false; |
---|
79 | } |
---|
80 | |
---|
81 | $e = self::$decoder->peek(); |
---|
82 | if($e[EN_TYPE] == EN_TYPE_ENDTAG) { |
---|
83 | self::$decoder->getElementEndTag(); |
---|
84 | break; |
---|
85 | } |
---|
86 | } |
---|
87 | array_push($requests, $req); |
---|
88 | } |
---|
89 | |
---|
90 | if(!self::$decoder->getElementEndTag()) |
---|
91 | return false; |
---|
92 | |
---|
93 | // output the error code, plus the ID of the calendar item that was generated by the |
---|
94 | // accept of the meeting response |
---|
95 | self::$encoder->StartWBXML(); |
---|
96 | self::$encoder->startTag(SYNC_MEETINGRESPONSE_MEETINGRESPONSE); |
---|
97 | |
---|
98 | foreach($requests as $req) { |
---|
99 | $status = SYNC_MEETRESPSTATUS_SUCCESS; |
---|
100 | |
---|
101 | try { |
---|
102 | $calendarid = self::$backend->MeetingResponse($req["requestid"], $req["folderid"], $req["response"]); |
---|
103 | if ($calendarid === false) |
---|
104 | throw new StatusException("HandleMeetingResponse() not possible", SYNC_MEETRESPSTATUS_SERVERERROR); |
---|
105 | } |
---|
106 | catch (StatusException $stex) { |
---|
107 | $status = $stex->getCode(); |
---|
108 | } |
---|
109 | |
---|
110 | self::$encoder->startTag(SYNC_MEETINGRESPONSE_RESULT); |
---|
111 | self::$encoder->startTag(SYNC_MEETINGRESPONSE_REQUESTID); |
---|
112 | self::$encoder->content($req["requestid"]); |
---|
113 | self::$encoder->endTag(); |
---|
114 | |
---|
115 | self::$encoder->startTag(SYNC_MEETINGRESPONSE_STATUS); |
---|
116 | self::$encoder->content($status); |
---|
117 | self::$encoder->endTag(); |
---|
118 | |
---|
119 | if($status == SYNC_MEETRESPSTATUS_SUCCESS && !empty($calendarid)) { |
---|
120 | self::$encoder->startTag(SYNC_MEETINGRESPONSE_CALENDARID); |
---|
121 | self::$encoder->content($calendarid); |
---|
122 | self::$encoder->endTag(); |
---|
123 | } |
---|
124 | self::$encoder->endTag(); |
---|
125 | self::$topCollector->AnnounceInformation(sprintf("Operation status %d", $status), true); |
---|
126 | } |
---|
127 | self::$encoder->endTag(); |
---|
128 | |
---|
129 | return true; |
---|
130 | } |
---|
131 | } |
---|
132 | ?> |
---|