1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
12: 13: 14: 15: 16:
17:
18: define("SYNC_MEETINGRESPONSE_CALENDARID","MeetingResponse:CalendarId");
19: define("SYNC_MEETINGRESPONSE_FOLDERID","MeetingResponse:FolderId");
20: define("SYNC_MEETINGRESPONSE_MEETINGRESPONSE","MeetingResponse:MeetingResponse");
21: define("SYNC_MEETINGRESPONSE_REQUESTID","MeetingResponse:RequestId");
22: define("SYNC_MEETINGRESPONSE_REQUEST","MeetingResponse:Request");
23: define("SYNC_MEETINGRESPONSE_RESULT","MeetingResponse:Result");
24: define("SYNC_MEETINGRESPONSE_STATUS","MeetingResponse:Status");
25: define("SYNC_MEETINGRESPONSE_USERRESPONSE","MeetingResponse:UserResponse");
26: define("SYNC_MEETINGRESPONSE_VERSION","MeetingResponse:Version");
27:
28: class Horde_ActiveSync_Request_MeetingResponse extends Horde_ActiveSync_Request_Base
29: {
30: 31: 32: 33: 34:
35: public function handle()
36: {
37: $requests = Array();
38: if (!$this->_decoder->getElementStartTag(SYNC_MEETINGRESPONSE_MEETINGRESPONSE)) {
39: return false;
40: }
41:
42: while ($this->_decoder->getElementStartTag(SYNC_MEETINGRESPONSE_REQUEST)) {
43: $req = Array();
44:
45: if ($this->_decoder->getElementStartTag(SYNC_MEETINGRESPONSE_USERRESPONSE)) {
46: $req['response'] = $this->_decoder->getElementContent();
47: if (!$this->_decoder->getElementEndTag()) {
48: return false;
49: }
50: }
51:
52: if ($this->_decoder->getElementStartTag(SYNC_MEETINGRESPONSE_FOLDERID)) {
53: $req['folderid'] = $this->_decoder->getElementContent();
54: if (!$this->_decoder->getElementEndTag()) {
55: return false;
56: }
57: }
58:
59: if ($this->_decoder->getElementStartTag(SYNC_MEETINGRESPONSE_REQUESTID)) {
60: $req['requestid'] = $this->_decoder->getElementContent();
61: if (!$this->_decoder->getElementEndTag()) {
62: return false;
63: }
64: }
65:
66: if (!$this->_decoder->getElementEndTag()) {
67: return false;
68: }
69:
70: array_push($requests, $req);
71: }
72:
73: if (!$this->_decoder->getElementEndTag()) {
74: return false;
75: }
76:
77:
78:
79: $this->_encoder->StartWBXML();
80: $this->_encoder->startTag(SYNC_MEETINGRESPONSE_MEETINGRESPONSE);
81:
82: foreach ($requests as $req) {
83: $calendarid = '';
84: $ok = $this->_driver->meetingResponse($req['requestid'], $req['folderid'], $req['response'], $calendarid);
85: $this->_encoder->startTag(SYNC_MEETINGRESPONSE_RESULT);
86: $this->_encoder->startTag(SYNC_MEETINGRESPONSE_REQUESTID);
87: $this->_encoder->content($req['requestid']);
88: $this->_encoder->endTag();
89: $this->_encoder->startTag(SYNC_MEETINGRESPONSE_STATUS);
90: $this->_encoder->content($ok ? 1 : 2);
91: $this->_encoder->endTag();
92: if ($ok) {
93: $this->_encoder->startTag(SYNC_MEETINGRESPONSE_CALENDARID);
94: $this->_encoder->content($calendarid);
95: $this->_encoder->endTag();
96: }
97: $this->_encoder->endTag();
98: }
99:
100: $this->_encoder->endTag();
101:
102: return true;
103: }
104: }