1 | <?php |
---|
2 | /*********************************************** |
---|
3 | * File : syncmail.php |
---|
4 | * Project : Z-Push |
---|
5 | * Descr : WBXML mail entities that can be parsed |
---|
6 | * directly (as a stream) from WBXML. |
---|
7 | * It is automatically decoded |
---|
8 | * according to $mapping, |
---|
9 | * and the Sync WBXML mappings. |
---|
10 | * |
---|
11 | * Created : 05.09.2011 |
---|
12 | * |
---|
13 | * Copyright 2007 - 2012 Zarafa Deutschland GmbH |
---|
14 | * |
---|
15 | * This program is free software: you can redistribute it and/or modify |
---|
16 | * it under the terms of the GNU Affero General Public License, version 3, |
---|
17 | * as published by the Free Software Foundation with the following additional |
---|
18 | * term according to sec. 7: |
---|
19 | * |
---|
20 | * According to sec. 7 of the GNU Affero General Public License, version 3, |
---|
21 | * the terms of the AGPL are supplemented with the following terms: |
---|
22 | * |
---|
23 | * "Zarafa" is a registered trademark of Zarafa B.V. |
---|
24 | * "Z-Push" is a registered trademark of Zarafa Deutschland GmbH |
---|
25 | * The licensing of the Program under the AGPL does not imply a trademark license. |
---|
26 | * Therefore any rights, title and interest in our trademarks remain entirely with us. |
---|
27 | * |
---|
28 | * However, if you propagate an unmodified version of the Program you are |
---|
29 | * allowed to use the term "Z-Push" to indicate that you distribute the Program. |
---|
30 | * Furthermore you may use our trademarks where it is necessary to indicate |
---|
31 | * the intended purpose of a product or service provided you use it in accordance |
---|
32 | * with honest practices in industrial or commercial matters. |
---|
33 | * If you want to propagate modified versions of the Program under the name "Z-Push", |
---|
34 | * you may only do so if you have a written permission by Zarafa Deutschland GmbH |
---|
35 | * (to acquire a permission please contact Zarafa at trademark@zarafa.com). |
---|
36 | * |
---|
37 | * This program is distributed in the hope that it will be useful, |
---|
38 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
39 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
40 | * GNU Affero General Public License for more details. |
---|
41 | * |
---|
42 | * You should have received a copy of the GNU Affero General Public License |
---|
43 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
44 | * |
---|
45 | * Consult LICENSE file for details |
---|
46 | ************************************************/ |
---|
47 | |
---|
48 | |
---|
49 | class SyncMail extends SyncObject { |
---|
50 | public $to; |
---|
51 | public $cc; |
---|
52 | public $from; |
---|
53 | public $subject; |
---|
54 | public $threadtopic; |
---|
55 | public $datereceived; |
---|
56 | public $displayto; |
---|
57 | public $importance; |
---|
58 | public $read; |
---|
59 | public $attachments; |
---|
60 | public $mimetruncated; |
---|
61 | public $mimedata; |
---|
62 | public $mimesize; |
---|
63 | public $bodytruncated; |
---|
64 | public $bodysize; |
---|
65 | public $body; |
---|
66 | public $messageclass; |
---|
67 | public $meetingrequest; |
---|
68 | public $reply_to; |
---|
69 | |
---|
70 | // AS 2.5 prop |
---|
71 | public $internetcpid; |
---|
72 | |
---|
73 | // AS 12.0 props |
---|
74 | public $asbody; |
---|
75 | public $asattachments; |
---|
76 | public $flag; |
---|
77 | public $contentclass; |
---|
78 | public $nativebodytype; |
---|
79 | |
---|
80 | // AS 14.0 props |
---|
81 | public $umcallerid; |
---|
82 | public $umusernotes; |
---|
83 | public $conversationid; |
---|
84 | public $conversationindex; |
---|
85 | public $lastverbexecuted; //possible values unknown, reply to sender, reply to all, forward |
---|
86 | public $lastverbexectime; |
---|
87 | public $receivedasbcc; |
---|
88 | public $sender; |
---|
89 | |
---|
90 | function SyncMail() { |
---|
91 | $mapping = array ( |
---|
92 | SYNC_POOMMAIL_TO => array ( self::STREAMER_VAR => "to", |
---|
93 | self::STREAMER_TYPE => self::STREAMER_TYPE_COMMA_SEPARATED, |
---|
94 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_LENGTHMAX => 32768, |
---|
95 | self::STREAMER_CHECK_EMAIL => "" )), |
---|
96 | |
---|
97 | SYNC_POOMMAIL_CC => array ( self::STREAMER_VAR => "cc", |
---|
98 | self::STREAMER_TYPE => self::STREAMER_TYPE_COMMA_SEPARATED, |
---|
99 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_LENGTHMAX => 32768, |
---|
100 | self::STREAMER_CHECK_EMAIL => "" )), |
---|
101 | |
---|
102 | SYNC_POOMMAIL_FROM => array ( self::STREAMER_VAR => "from", |
---|
103 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_LENGTHMAX => 32768, |
---|
104 | self::STREAMER_CHECK_EMAIL => "broken-from@z-push.local" )), |
---|
105 | |
---|
106 | SYNC_POOMMAIL_SUBJECT => array ( self::STREAMER_VAR => "subject"), |
---|
107 | SYNC_POOMMAIL_THREADTOPIC => array ( self::STREAMER_VAR => "threadtopic"), |
---|
108 | SYNC_POOMMAIL_DATERECEIVED => array ( self::STREAMER_VAR => "datereceived", |
---|
109 | self::STREAMER_TYPE => self::STREAMER_TYPE_DATE_DASHES), |
---|
110 | |
---|
111 | SYNC_POOMMAIL_DISPLAYTO => array ( self::STREAMER_VAR => "displayto"), |
---|
112 | |
---|
113 | // Importance values |
---|
114 | // 0 = Low |
---|
115 | // 1 = Normal |
---|
116 | // 2 = High |
---|
117 | // even the default value 1 is optional, the native android client 2.2 interprets a non-existing value as 0 (low) |
---|
118 | SYNC_POOMMAIL_IMPORTANCE => array ( self::STREAMER_VAR => "importance", |
---|
119 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_REQUIRED => self::STREAMER_CHECK_SETONE, |
---|
120 | self::STREAMER_CHECK_ONEVALUEOF => array(0,1,2) )), |
---|
121 | |
---|
122 | SYNC_POOMMAIL_READ => array ( self::STREAMER_VAR => "read", |
---|
123 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
124 | |
---|
125 | SYNC_POOMMAIL_ATTACHMENTS => array ( self::STREAMER_VAR => "attachments", |
---|
126 | self::STREAMER_TYPE => "SyncAttachment", |
---|
127 | self::STREAMER_ARRAY => SYNC_POOMMAIL_ATTACHMENT), |
---|
128 | |
---|
129 | SYNC_POOMMAIL_MIMETRUNCATED => array ( self::STREAMER_VAR => "mimetruncated", |
---|
130 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ZEROORONE => self::STREAMER_CHECK_SETZERO)), |
---|
131 | |
---|
132 | SYNC_POOMMAIL_MIMEDATA => array ( self::STREAMER_VAR => "mimedata"), //TODO mimedata should be of a type stream |
---|
133 | |
---|
134 | SYNC_POOMMAIL_MIMESIZE => array ( self::STREAMER_VAR => "mimesize", |
---|
135 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_CMPHIGHER => -1)), |
---|
136 | |
---|
137 | SYNC_POOMMAIL_BODYTRUNCATED => array ( self::STREAMER_VAR => "bodytruncated", |
---|
138 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ZEROORONE => self::STREAMER_CHECK_SETZERO)), |
---|
139 | |
---|
140 | SYNC_POOMMAIL_BODYSIZE => array ( self::STREAMER_VAR => "bodysize", |
---|
141 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_CMPHIGHER => -1)), |
---|
142 | |
---|
143 | SYNC_POOMMAIL_BODY => array ( self::STREAMER_VAR => "body"), |
---|
144 | SYNC_POOMMAIL_MESSAGECLASS => array ( self::STREAMER_VAR => "messageclass"), |
---|
145 | SYNC_POOMMAIL_MEETINGREQUEST => array ( self::STREAMER_VAR => "meetingrequest", |
---|
146 | self::STREAMER_TYPE => "SyncMeetingRequest"), |
---|
147 | |
---|
148 | SYNC_POOMMAIL_REPLY_TO => array ( self::STREAMER_VAR => "reply_to", |
---|
149 | self::STREAMER_TYPE => self::STREAMER_TYPE_SEMICOLON_SEPARATED, |
---|
150 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_EMAIL => "" )), |
---|
151 | |
---|
152 | ); |
---|
153 | |
---|
154 | if (Request::GetProtocolVersion() >= 2.5) { |
---|
155 | $mapping[SYNC_POOMMAIL_INTERNETCPID] = array ( self::STREAMER_VAR => "internetcpid"); |
---|
156 | } |
---|
157 | |
---|
158 | if (Request::GetProtocolVersion() >= 12.0) { |
---|
159 | $mapping[SYNC_AIRSYNCBASE_BODY] = array ( self::STREAMER_VAR => "asbody", |
---|
160 | self::STREAMER_TYPE => "SyncBaseBody"); |
---|
161 | |
---|
162 | $mapping[SYNC_AIRSYNCBASE_ATTACHMENTS] = array ( self::STREAMER_VAR => "asattachments", |
---|
163 | self::STREAMER_TYPE => "SyncBaseAttachment", |
---|
164 | self::STREAMER_ARRAY => SYNC_AIRSYNCBASE_ATTACHMENT); |
---|
165 | |
---|
166 | $mapping[SYNC_POOMMAIL_CONTENTCLASS] = array ( self::STREAMER_VAR => "contentclass", |
---|
167 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(DEFAULT_EMAIL_CONTENTCLASS) )); |
---|
168 | |
---|
169 | $mapping[SYNC_POOMMAIL_FLAG] = array ( self::STREAMER_VAR => "flag", |
---|
170 | self::STREAMER_TYPE => "SyncMailFlags", |
---|
171 | self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY); |
---|
172 | |
---|
173 | $mapping[SYNC_AIRSYNCBASE_NATIVEBODYTYPE] = array ( self::STREAMER_VAR => "nativebodytype"); |
---|
174 | |
---|
175 | //unset these properties because airsyncbase body and attachments will be used instead |
---|
176 | unset($mapping[SYNC_POOMMAIL_BODY], $mapping[SYNC_POOMMAIL_BODYTRUNCATED], $mapping[SYNC_POOMMAIL_ATTACHMENTS]); |
---|
177 | } |
---|
178 | |
---|
179 | if (Request::GetProtocolVersion() >= 14.0) { |
---|
180 | $mapping[SYNC_POOMMAIL2_UMCALLERID] = array ( self::STREAMER_VAR => "umcallerid"); |
---|
181 | $mapping[SYNC_POOMMAIL2_UMUSERNOTES] = array ( self::STREAMER_VAR => "umusernotes"); |
---|
182 | $mapping[SYNC_POOMMAIL2_CONVERSATIONID] = array ( self::STREAMER_VAR => "conversationid"); |
---|
183 | $mapping[SYNC_POOMMAIL2_CONVERSATIONINDEX] = array ( self::STREAMER_VAR => "conversationindex"); |
---|
184 | $mapping[SYNC_POOMMAIL2_LASTVERBEXECUTED] = array ( self::STREAMER_VAR => "lastverbexecuted"); |
---|
185 | $mapping[SYNC_POOMMAIL2_LASTVERBEXECUTIONTIME] = array ( self::STREAMER_VAR => "lastverbexectime"); |
---|
186 | $mapping[SYNC_POOMMAIL2_RECEIVEDASBCC] = array ( self::STREAMER_VAR => "receivedasbcc"); |
---|
187 | $mapping[SYNC_POOMMAIL2_SENDER] = array ( self::STREAMER_VAR => "sender"); |
---|
188 | $mapping[SYNC_POOMMAIL_CATEGORIES] = array ( self::STREAMER_VAR => "categories", |
---|
189 | self::STREAMER_ARRAY => SYNC_POOMMAIL_CATEGORY); |
---|
190 | //TODO bodypart, accountid, rightsmanagementlicense |
---|
191 | } |
---|
192 | |
---|
193 | parent::SyncObject($mapping); |
---|
194 | } |
---|
195 | } |
---|
196 | |
---|
197 | ?> |
---|