Back to index

d-push  2.0
syncmail.php
Go to the documentation of this file.
00001 <?php
00002 /***********************************************
00003 * File      :   syncmail.php
00004 * Project   :   Z-Push
00005 * Descr     :   WBXML mail entities that can be parsed
00006 *               directly (as a stream) from WBXML.
00007 *               It is automatically decoded
00008 *               according to $mapping,
00009 *               and the Sync WBXML mappings.
00010 *
00011 * Created   :   05.09.2011
00012 *
00013 * Copyright 2007 - 2011 Zarafa Deutschland GmbH
00014 *
00015 * This program is free software: you can redistribute it and/or modify
00016 * it under the terms of the GNU Affero General Public License, version 3,
00017 * as published by the Free Software Foundation with the following additional
00018 * term according to sec. 7:
00019 *
00020 * According to sec. 7 of the GNU Affero General Public License, version 3,
00021 * the terms of the AGPL are supplemented with the following terms:
00022 *
00023 * "Zarafa" is a registered trademark of Zarafa B.V.
00024 * "Z-Push" is a registered trademark of Zarafa Deutschland GmbH
00025 * The licensing of the Program under the AGPL does not imply a trademark license.
00026 * Therefore any rights, title and interest in our trademarks remain entirely with us.
00027 *
00028 * However, if you propagate an unmodified version of the Program you are
00029 * allowed to use the term "Z-Push" to indicate that you distribute the Program.
00030 * Furthermore you may use our trademarks where it is necessary to indicate
00031 * the intended purpose of a product or service provided you use it in accordance
00032 * with honest practices in industrial or commercial matters.
00033 * If you want to propagate modified versions of the Program under the name "Z-Push",
00034 * you may only do so if you have a written permission by Zarafa Deutschland GmbH
00035 * (to acquire a permission please contact Zarafa at trademark@zarafa.com).
00036 *
00037 * This program is distributed in the hope that it will be useful,
00038 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00039 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00040 * GNU Affero General Public License for more details.
00041 *
00042 * You should have received a copy of the GNU Affero General Public License
00043 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00044 *
00045 * Consult LICENSE file for details
00046 ************************************************/
00047 
00048 
00049 class SyncMail extends SyncObject {
00050     public $to;
00051     public $cc;
00052     public $from;
00053     public $subject;
00054     public $threadtopic;
00055     public $datereceived;
00056     public $displayto;
00057     public $importance;
00058     public $read;
00059     public $attachments;
00060     public $mimetruncated;
00061     public $mimedata;
00062     public $mimesize;
00063     public $bodytruncated;
00064     public $bodysize;
00065     public $body;
00066     public $messageclass;
00067     public $meetingrequest;
00068     public $reply_to;
00069 
00070     // AS 2.5 prop
00071     public $internetcpid;
00072 
00073     // AS 12.0 props
00074     public $asbody;
00075     public $asattachments;
00076     public $flag;
00077     public $contentclass;
00078     public $nativebodytype;
00079 
00080     // AS 14.0 props
00081     public $umcallerid;
00082     public $umusernotes;
00083     public $conversationid;
00084     public $conversationindex;
00085     public $lastverbexecuted; //possible values unknown, reply to sender, reply to all, forward
00086     public $lastverbexectime;
00087     public $receivedasbcc;
00088     public $sender;
00089 
00090     function SyncMail() {
00091         $mapping = array (
00092                     SYNC_POOMMAIL_TO                                    => array (  self::STREAMER_VAR      => "to",
00093                                                                                     self::STREAMER_TYPE     => self::STREAMER_TYPE_COMMA_SEPARATED,
00094                                                                                     self::STREAMER_CHECKS   => array(   self::STREAMER_CHECK_LENGTHMAX      => 32768,
00095                                                                                                                         self::STREAMER_CHECK_EMAIL        => "" )),
00096 
00097                     SYNC_POOMMAIL_CC                                    => array (  self::STREAMER_VAR      => "cc",
00098                                                                                     self::STREAMER_TYPE     => self::STREAMER_TYPE_COMMA_SEPARATED,
00099                                                                                     self::STREAMER_CHECKS   => array(   self::STREAMER_CHECK_LENGTHMAX      => 32768,
00100                                                                                                                         self::STREAMER_CHECK_EMAIL        => "" )),
00101 
00102                     SYNC_POOMMAIL_FROM                                  => array (  self::STREAMER_VAR      => "from",
00103                                                                                     self::STREAMER_CHECKS   => array(   self::STREAMER_CHECK_LENGTHMAX      => 32768,
00104                                                                                                                         self::STREAMER_CHECK_EMAIL        => "broken-from@z-push.local" )),
00105 
00106                     SYNC_POOMMAIL_SUBJECT                               => array (  self::STREAMER_VAR      => "subject"),
00107                     SYNC_POOMMAIL_THREADTOPIC                           => array (  self::STREAMER_VAR      => "threadtopic"),
00108                     SYNC_POOMMAIL_DATERECEIVED                          => array (  self::STREAMER_VAR      => "datereceived",
00109                                                                                     self::STREAMER_TYPE     => self::STREAMER_TYPE_DATE_DASHES),
00110 
00111                     SYNC_POOMMAIL_DISPLAYTO                             => array (  self::STREAMER_VAR      => "displayto"),
00112 
00113                     // Importance values
00114                     // 0 = Low
00115                     // 1 = Normal
00116                     // 2 = High
00117                     // even the default value 1 is optional, the native android client 2.2 interprets a non-existing value as 0 (low)
00118                     SYNC_POOMMAIL_IMPORTANCE                            => array (  self::STREAMER_VAR      => "importance",
00119                                                                                     self::STREAMER_CHECKS   => array(   self::STREAMER_CHECK_REQUIRED       => self::STREAMER_CHECK_SETONE,
00120                                                                                                                         self::STREAMER_CHECK_ONEVALUEOF     => array(0,1,2) )),
00121 
00122                     SYNC_POOMMAIL_READ                                  => array (  self::STREAMER_VAR      => "read",
00123                                                                                     self::STREAMER_CHECKS   => array(   self::STREAMER_CHECK_ONEVALUEOF     => array(0,1) )),
00124 
00125                     SYNC_POOMMAIL_ATTACHMENTS                           => array (  self::STREAMER_VAR      => "attachments",
00126                                                                                     self::STREAMER_TYPE     => "SyncAttachment",
00127                                                                                     self::STREAMER_ARRAY    => SYNC_POOMMAIL_ATTACHMENT),
00128 
00129                     SYNC_POOMMAIL_MIMETRUNCATED                         => array (  self::STREAMER_VAR      => "mimetruncated",
00130                                                                                     self::STREAMER_CHECKS   => array(   self::STREAMER_CHECK_ZEROORONE      => self::STREAMER_CHECK_SETZERO)),
00131 
00132                     SYNC_POOMMAIL_MIMEDATA                              => array (  self::STREAMER_VAR      => "mimedata"), //TODO mimedata should be of a type stream
00133 
00134                     SYNC_POOMMAIL_MIMESIZE                              => array (  self::STREAMER_VAR      => "mimesize",
00135                                                                                     self::STREAMER_CHECKS   => array(   self::STREAMER_CHECK_CMPHIGHER      => -1)),
00136 
00137                     SYNC_POOMMAIL_BODYTRUNCATED                         => array (  self::STREAMER_VAR      => "bodytruncated",
00138                                                                                     self::STREAMER_CHECKS   => array(   self::STREAMER_CHECK_ZEROORONE      => self::STREAMER_CHECK_SETZERO)),
00139 
00140                     SYNC_POOMMAIL_BODYSIZE                              => array (  self::STREAMER_VAR      => "bodysize",
00141                                                                                     self::STREAMER_CHECKS   => array(   self::STREAMER_CHECK_CMPHIGHER      => -1)),
00142 
00143                     SYNC_POOMMAIL_BODY                                  => array (  self::STREAMER_VAR      => "body"),
00144                     SYNC_POOMMAIL_MESSAGECLASS                          => array (  self::STREAMER_VAR      => "messageclass"),
00145                     SYNC_POOMMAIL_MEETINGREQUEST                        => array (  self::STREAMER_VAR      => "meetingrequest",
00146                                                                                     self::STREAMER_TYPE     => "SyncMeetingRequest"),
00147 
00148                     SYNC_POOMMAIL_REPLY_TO                              => array (  self::STREAMER_VAR      => "reply_to",
00149                                                                                     self::STREAMER_TYPE     => self::STREAMER_TYPE_SEMICOLON_SEPARATED,
00150                                                                                     self::STREAMER_CHECKS   => array(   self::STREAMER_CHECK_EMAIL        => "" )),
00151 
00152                 );
00153 
00154         if (Request::GetProtocolVersion() >= 2.5) {
00155             $mapping[SYNC_POOMMAIL_INTERNETCPID]                        = array (   self::STREAMER_VAR      => "internetcpid");
00156         }
00157 
00158         if (Request::GetProtocolVersion() >= 12.0) {
00159             $mapping[SYNC_AIRSYNCBASE_BODY]                             = array (   self::STREAMER_VAR      => "asbody",
00160                                                                                     self::STREAMER_TYPE     => "SyncBaseBody");
00161 
00162             $mapping[SYNC_AIRSYNCBASE_ATTACHMENTS]                      = array (   self::STREAMER_VAR      => "asattachments",
00163                                                                                     self::STREAMER_TYPE     => "SyncBaseAttachment",
00164                                                                                     self::STREAMER_ARRAY    => SYNC_AIRSYNCBASE_ATTACHMENT);
00165 
00166             $mapping[SYNC_POOMMAIL_CONTENTCLASS]                        = array (   self::STREAMER_VAR      => "contentclass",
00167                                                                                     self::STREAMER_CHECKS   => array(   self::STREAMER_CHECK_ONEVALUEOF     => array(DEFAULT_EMAIL_CONTENTCLASS) ));
00168 
00169             $mapping[SYNC_POOMMAIL_FLAG]                                = array (   self::STREAMER_VAR      => "flag",
00170                                                                                     self::STREAMER_TYPE     => "SyncMailFlags",
00171                                                                                     self::STREAMER_PROP     => self::STREAMER_TYPE_SEND_EMPTY);
00172 
00173             $mapping[SYNC_AIRSYNCBASE_NATIVEBODYTYPE]                   = array (   self::STREAMER_VAR      => "nativebodytype");
00174 
00175             //unset these properties because airsyncbase body and attachments will be used instead
00176             unset($mapping[SYNC_POOMMAIL_BODY], $mapping[SYNC_POOMMAIL_BODYTRUNCATED], $mapping[SYNC_POOMMAIL_ATTACHMENTS]);
00177         }
00178 
00179         if (Request::GetProtocolVersion() >= 14.0) {
00180             $mapping[SYNC_POOMMAIL2_UMCALLERID]                         = array (   self::STREAMER_VAR      => "umcallerid");
00181             $mapping[SYNC_POOMMAIL2_UMUSERNOTES]                        = array (   self::STREAMER_VAR      => "umusernotes");
00182             $mapping[SYNC_POOMMAIL2_CONVERSATIONID]                     = array (   self::STREAMER_VAR      => "conversationid");
00183             $mapping[SYNC_POOMMAIL2_CONVERSATIONINDEX]                  = array (   self::STREAMER_VAR      => "conversationindex");
00184             $mapping[SYNC_POOMMAIL2_LASTVERBEXECUTED]                   = array (   self::STREAMER_VAR      => "lastverbexecuted");
00185             $mapping[SYNC_POOMMAIL2_LASTVERBEXECUTIONTIME]              = array (   self::STREAMER_VAR      => "lastverbexectime");
00186             $mapping[SYNC_POOMMAIL2_RECEIVEDASBCC]                      = array (   self::STREAMER_VAR      => "receivedasbcc");
00187             $mapping[SYNC_POOMMAIL2_SENDER]                             = array (   self::STREAMER_VAR      => "sender");
00188             $mapping[SYNC_POOMMAIL_CATEGORIES]                          = array (   self::STREAMER_VAR      => "categories",
00189                                                                                     self::STREAMER_ARRAY    => SYNC_POOMMAIL_CATEGORY);
00190             //TODO bodypart, accountid, rightsmanagementlicense
00191         }
00192 
00193         parent::SyncObject($mapping);
00194     }
00195 }
00196 
00197 ?>