"Fossies" - the Fresh Open Source Software Archive

Member "z-push/streamimporter.php" (2 Aug 2013, 26751 Bytes) of package /linux/www/old/group-e_z-push_v3.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "streamimporter.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 /***********************************************
    3 * File      :   streamimporter.php
    4 * Project   :   Z-Push
    5 * Descr     :   Stream import classes
    6 *
    7 * Created   :   01.10.2007
    8 *
    9 * � Zarafa Deutschland GmbH, www.zarafaserver.de
   10 * This file is distributed under GPL v2.
   11 * Consult LICENSE file for details
   12 ************************************************/
   13 
   14 // We don't support caching changes for messages
   15 class ImportContentsChangesStream {
   16     var $_encoder;
   17     var $_type;
   18     var $_seenObjects;
   19     var $_deletedObjects;
   20     var $_optiontype;
   21     var $_onlyoption;
   22     var $_lastObjectStatus;
   23     var $_readids;
   24     var $_flagids;
   25     var $_msginfos;
   26 
   27     function ImportContentsChangesStream(&$encoder, $type, $ids, &$msginfos) {
   28         $this->_encoder = &$encoder;
   29         $this->_type = $type;
   30         $this->_seenObjects = array();
   31         $this->_deletedObjects = array();
   32         $this->_readids = $ids['readids'];
   33         $this->_flagids = $ids['flagids'];
   34         if (!is_array($msginfos)) $this->_msginfos = array();
   35         else $this->_msginfos = $msginfos;
   36     }
   37 
   38     function ImportMessageChange($id, $message) {
   39 //  debugLog("Class of this message: ".strtolower(get_class($message)) . " Expected Class ".$this->_type . " Option Type ".$this->_optiontype);
   40 //  debugLog("HERE ImportMessageChange ".$this->_optiontype);
   41 
   42         $class = strtolower(get_class($message));
   43         if( $class != $this->_type) {
   44             $this->_lastObjectStatus = -1;
   45             return true; // ignore other types
   46         }
   47 
   48         // prevent sending the same object twice in one request
   49         if (in_array($id, $this->_seenObjects)) {
   50             debugLog("Object $id discarded! Object already sent in this request. Flags=".$message->flags);
   51             $this->_lastObjectStatus = -1;
   52             return true;
   53         }
   54 
   55         // prevent sending changes for objects that delete information was sent prior the change details arrived
   56         if (in_array($id, $this->_deletedObjects)) {
   57             debugLog("Object $id discarded! Object deleted prior change submission.");
   58             $this->_lastObjectStatus = -1;
   59             return true;
   60         } 
   61 
   62         debugLog("ImportMessageChange: Object $id Class ".strtolower(get_class($message))." Flags=".$message->flags);
   63         switch($class) {
   64             case 'syncnote'         :
   65                 $md5msg = array('messageclass'              => (isset($message->messageclass)           ? $message->messageclass            : ''),
   66                                 'subject'                   => (isset($message->subject)                ? $message->subject                 : ''),
   67                                 'categories'                => (isset($message->categories)             ? $message->categories              : ''),
   68                                 'body'                      => (isset($message->md5body)                ? $message->md5body                 : ""),
   69                                 'lastmodifieddate'          => (isset($message->lastmodifieddate)       ? $message->lastmodifieddate        : ""),
   70                                 );
   71                 $md5flags = array();
   72                 break;
   73             case 'synctask'         :
   74                 $md5msg = array('complete'                  => (isset($message->complete)               ? $message->complete                : ''),
   75                                 'datecompleted'             => (isset($message->datecompleted)          ? $message->datecompleted           : ''),
   76                                 'duedate'                   => (isset($message->duedate)                ? $message->duedate                 : ''),
   77                                 'utcduedate'                => (isset($message->utcduedate)             ? $message->utcduedate              : ''),
   78                                 'importance'                => (isset($message->importance)             ? $message->importance              : ''),
   79                                 'recurrence'                => (isset($message->recurrence)             ? $message->recurrence              : ''),
   80                                 'regenerate'                => (isset($message->regenerate)             ? $message->regenerate              : ''),
   81                                 'deadoccur'                 => (isset($message->deadoccur)              ? $message->deadoccur               : ''),
   82                                 'reminderset'               => (isset($message->reminderset)            ? $message->reminderset             : ''),
   83                                 'remindertime'              => (isset($message->remindertime)           ? $message->remindertime            : ''),
   84                                 'sensitivity'               => (isset($message->sensitivity)            ? $message->sensitivity             : ''),
   85                                 'startdate'                 => (isset($message->startdate)              ? $message->startdate               : ''),
   86                                 'utcstartdate'              => (isset($message->utcstartdate)           ? $message->utcstartdate            : ''),
   87                                 'subject'                   => (isset($message->subject)                ? $message->subject                 : ''),
   88                                 'categories'                => (isset($message->categories)             ? $message->categories              : ''),
   89                                 'body'                      => (isset($message->md5body)                ? $message->md5body                 : ""),
   90                                 );
   91                 $md5flags = array();
   92                 break;
   93             case 'syncappointment'  :
   94                 $md5msg = array('timezone'                  => (isset($message->timezone)               ? $message->timezone                : ''),
   95                                 'dtstamp'                   => (isset($message->dtstamp)                ? $message->dtstamp                 : ''),
   96                                 'starttime'                 => (isset($message->starttime)              ? $message->starttime               : ''),
   97                                 'subject'                   => (isset($message->subject)                ? $message->subject                 : ''),
   98                                 'uid'                       => (isset($message->uid)                    ? $message->uid                     : ''),
   99                                 'organizername'             => (isset($message->organizername)          ? $message->organizername           : ''),
  100                                 'organizeremail'            => (isset($message->organizeremail)         ? $message->organizeremail          : ''),
  101                                 'location'                  => (isset($message->location)               ? $message->location                : ''),
  102                                 'endtime'                   => (isset($message->endtime)                ? $message->endtime                 : ''),
  103                                 'recurrence'                => (isset($message->recurrence)             ? $message->recurrence              : ''),
  104                                 'sensitivity'               => (isset($message->sensitivity)            ? $message->sensitivity             : ''),
  105                                 'busystatus'                => (isset($message->busystatus)             ? $message->busystatus              : ''),
  106                                 'alldayevent'               => (isset($message->alldayevent)            ? $message->alldayevent             : ''),
  107                                 'reminder'                  => (isset($message->reminder)               ? $message->reminder                : ''),
  108                                 'meetingstatus'             => (isset($message->meetingstatus)          ? $message->meetingstatus           : ''),
  109                                 'attendees'                 => (isset($message->attendees)              ? $message->attendees               : ''),
  110                                 'exceptions'                => (isset($message->exceptions)             ? $message->exceptions              : ''),
  111                                 'deleted'                   => (isset($message->deleted)                ? $message->deleted                 : ''),
  112                                 'exceptionstarttime'        => (isset($message->exceptionsstarttime)    ? $message->exceptionsstarttime     : ''),
  113                                 'categories'                => (isset($message->categories)             ? $message->categories              : ''),
  114                                 'body'                      => (isset($message->md5body)                ? $message->md5body                 : ""),
  115                             );
  116                 $md5flags = array();
  117                 break;
  118             case 'synccontact'      :
  119                 $md5msg = array('anniversary'               => (isset($message->anniversary)            ? $message->anniversary             : ''),
  120                                 'assistentname'             => (isset($message->assistentname)          ? $message->assistentname           : ''),
  121                                 'assistnamephonenumber'     => (isset($message->assistnamephonenumber)  ? $message->assistnamephonenumber   : ''),
  122                                 'birthday'                  => (isset($message->birthday)               ? $message->birthday                : ''),
  123                                 'business2phonenumber'      => (isset($message->business2phonenumber)   ? $message->business2phonenumber    : ''),
  124                                 'businesscity'              => (isset($message->businesscity)           ? $message->businesscity            : ''),
  125                                 'businesscountry'           => (isset($message->businesscountry)        ? $message->businesscountry         : ''),
  126                                 'businesspostalcode'        => (isset($message->businesspostalcode)     ? $message->businesspostalcode      : ''),
  127                                 'businessstate'             => (isset($message->businessstate)          ? $message->businessstate           : ''),
  128                                 'businessstreet'            => (isset($message->businessstreet)         ? $message->businessstreet          : ''),
  129                                 'businessfaxnumber'         => (isset($message->businessfaxnumber)      ? $message->businessfaxnumber       : ''),
  130                                 'businessphonenumber'       => (isset($message->businessphonenumber)    ? $message->businessphonenumber     : ''),
  131                                 'carphonenumber'            => (isset($message->carphonenumber)         ? $message->carphonenumber          : ''),
  132                                 'children'                  => (isset($message->children)               ? $message->children                : ''),
  133                                 'companyname'               => (isset($message->companyname)            ? $message->companyname             : ''),
  134                                 'department'                => (isset($message->department)             ? $message->department              : ''),
  135                                 'email1address'             => (isset($message->email1address)          ? $message->email1address           : ''),
  136                                 'email2address'             => (isset($message->email2address)          ? $message->email2address           : ''),
  137                                 'email3address'             => (isset($message->email3address)          ? $message->email3address           : ''),
  138                                 'fileas'                    => (isset($message->fileas)                 ? $message->fileas                  : ''),
  139                                 'firstname'                 => (isset($message->firstname)              ? $message->firstname               : ''),
  140                                 'home2phonenumber'          => (isset($message->home2phonenumber)       ? $message->home2phonenumber        : ''),
  141                                 'homecity'                  => (isset($message->homecity)               ? $message->homecity                : ''),
  142                                 'homecountry'               => (isset($message->homecountry)            ? $message->homecountry             : ''),
  143                                 'homepostalcode'            => (isset($message->homepostalcode)         ? $message->homepostalcode          : ''),
  144                                 'homestate'                 => (isset($message->homestate)              ? $message->homestate               : ''),
  145                                 'homestreet'                => (isset($message->homestreet)             ? $message->homestreet              : ''),
  146                                 'homefaxnumber'             => (isset($message->homefaxnumber)          ? $message->homefaxnumber           : ''),
  147                                 'homephonenumber'           => (isset($message->homephonenumber)        ? $message->homephonenumber         : ''),
  148                                 'jobtitle'                  => (isset($message->jobtitle)               ? $message->jobtitle                : ''),
  149                                 'lastname'                  => (isset($message->lastname)               ? $message->lastname                : ''),
  150                                 'middlename'                => (isset($message->middlename)             ? $message->middlename              : ''),
  151                                 'mobilephonenumber'         => (isset($message->mobilephonenumber)      ? $message->mobilephonenumber       : ''),
  152                                 'officelocation'            => (isset($message->officelocation)         ? $message->officelocation          : ''),
  153                                 'othercity'                 => (isset($message->othercity)              ? $message->othercity               : ''),
  154                                 'othercountry'              => (isset($message->othercountry)           ? $message->othercountry            : ''),
  155                                 'otherpostalcode'           => (isset($message->otherpostalcode)        ? $message->otherpostalcode         : ''),
  156                                 'otherstate'                => (isset($message->otherstate)             ? $message->otherstate              : ''),
  157                                 'otherstreet'               => (isset($message->otherstreet)            ? $message->otherstreet             : ''),
  158                                 'pagernumber'               => (isset($message->pagernumber)            ? $message->pagernumber             : ''),
  159                                 'radiophonenumber'          => (isset($message->radiophonenumber)       ? $message->radiophonenumber        : ''),
  160                                 'spouse'                    => (isset($message->spouse)                 ? $message->spouse                  : ''),
  161                                 'suffix'                    => (isset($message->suffix)                 ? $message->suffix                  : ''),
  162                                 'title'                     => (isset($message->title)                  ? $message->title                   : ''),
  163                                 'webpage'                   => (isset($message->webpage)                ? $message->webpage                 : ''),
  164                                 'yomicompanyname'           => (isset($message->yomicompanyname)        ? $message->yomicompanyname         : ''),
  165                                 'yomifirstname'             => (isset($message->yomifirstname)          ? $message->yomifirstname           : ''),
  166                                 'yomilastname'              => (isset($message->yomilastname)           ? $message->yomilastname            : ''),
  167                                 'picture'                   => (isset($message->picture)                ? $message->picture                 : ''),
  168                                 'customerid'                => (isset($message->customerid)             ? $message->customerid              : ''),
  169                                 'governmentid'              => (isset($message->governmentid)           ? $message->governmentid            : ''),
  170                                 'imaddress'                 => (isset($message->imaddress)              ? $message->imaddress               : ''),
  171                                 'imaddress2'                => (isset($message->imaddress2)             ? $message->imaddress2              : ''),
  172                                 'imaddress3'                => (isset($message->imaddress3)             ? $message->imaddress3              : ''),
  173                                 'managername'               => (isset($message->managername)            ? $message->managername             : ''),
  174                                 'companymainphone'          => (isset($message->companymainphone)       ? $message->companymainphone        : ''),
  175                                 'accountname'               => (isset($message->accountname)            ? $message->accountname             : ''),
  176                                 'nickname'                  => (isset($message->nickname)               ? $message->nickname                : ''),
  177                                 'mms'                       => (isset($message->mms)                    ? $message->mms                     : ''),
  178                                 'categories'                => (isset($message->categories)             ? $message->categories              : ''),
  179                                 'body'                      => (isset($message->md5body)                ? $message->md5body                 : ""),
  180                             );
  181                 $md5flags = array();
  182                 break;
  183             case 'syncsms'          :
  184                 debugLog(bin2hex($message->to));
  185                 debugLog(bin2hex($message->from));
  186                 debugLog(bin2hex($message->cc));
  187                 debugLog(bin2hex($message->airsyncbasebody->data));
  188                 $md5msg = array('datereceived'              => (isset($message->datereceived)           ? strval($message->datereceived)                : ''),
  189                                 'importance'                => (isset($message->importance)             ? strval($message->importance)                  : ''),
  190                                 'messageclass'              => (isset($message->messageclass)           ? strval($message->messageclass)                : ''),
  191                                 'to'                        => (isset($message->to)                     ? strval($message->to)                          : ''),
  192                                 'cc'                        => (isset($message->cc)                     ? strval($message->cc)                          : ''),
  193                                 'from'                      => (isset($message->from)                   ? strval($message->from)                        : ''),
  194                                 'internetcpid'              => (isset($message->internetcpid)           ? strval($message->internetcpid)                : ''),
  195 //                              'conversationid'            => (isset($message->conversationid)         ? bin2hex($message->conversationid)     : ''),
  196 //                              'conversationindex'         => (isset($message->conversationindex)      ? bin2hex($message->conversationindex)  : ''),
  197                                 'body'                      => (isset($message->airsyncbasebody->data)  ? strval($message->airsyncbasebody->data)       : ''),
  198                                 );
  199                 $md5flags = array('flagstatus'      => (isset($message->poommailflag->flagstatus)       ? $message->poommailflag->flagstatus        : ''),
  200                                   'flagtype'        => (isset($message->poommailflag->flagtype)         ? $message->poommailflag->flagtype          : ''),
  201                                   'startdate'       => (isset($message->poommailflag->startdate)        ? $message->poommailflag->startdate         : ''),
  202                                   'utcstartdate'    => (isset($message->poommailflag->utcstartdate)     ? $message->poommailflag->utcstartdate      : ''),
  203                                   'duedate'         => (isset($message->poommailflag->duedate)          ? $message->poommailflag->duedate           : ''),
  204                                   'utcduedate'      => (isset($message->poommailflag->utcduedate)       ? $message->poommailflag->utcduedate        : ''),
  205                                   'datecomplete'    => (isset($message->poommailflag->datecompleted)    ? $message->poommailflag->datecompleted     : ''),
  206                                   'reminderset'     => (isset($message->poommailflag->reminderset)      ? $message->poommailflag->reminderset       : ''),
  207                                   'subject'         => (isset($message->poommailflag->subject)          ? $message->poommailflag->subject           : ''),
  208                                   'ordinaldate'     => (isset($message->poommailflag->ordinaldate)      ? $message->poommailflag->ordinaldate       : ''),
  209                                   'subordinaldate'  => (isset($message->poommailflag->subordinaldate)   ? $message->poommailflag->subordinaldate    : ''),
  210                                   'completetime'    => (isset($message->poommailflag->completetime)     ? $message->poommailflag->completetime      : ''),
  211                                   );
  212                 break;
  213             case 'syncmail'         :
  214                 $md5msg = array('datereceived'              => (isset($message->datereceived)           ? $message->datereceived            : ''),
  215                                 'displayto'                 => (isset($message->displayto)              ? $message->displayto               : ''),
  216                                 'importance'                => (isset($message->importance)             ? $message->importance              : ''),
  217                                 'messageclass'              => (isset($message->messageclass)           ? $message->messageclass            : ''),
  218                                 'subject'                   => (isset($message->subject)                ? $message->subject                 : ''),
  219                                 'to'                        => (isset($message->to)                     ? $message->to                      : ''),
  220                                 'cc'                        => (isset($message->cc)                     ? $message->cc                      : ''),
  221                                 'from'                      => (isset($message->from)                   ? $message->from                    : ''),
  222                                 'reply_to'                  => (isset($message->reply_to)               ? $message->reply_to                : ''),
  223                                 'threadtopic'               => (isset($message->threadtopic)            ? $message->threadtopic             : ''),
  224                                 'attachments'               => (isset($message->attachments)            ? $message->attachments             : ''),
  225                                 'airsyncbaseattachments'    => (isset($message->airsyncbaseattachments) ? $message->airsyncbaseattachments  : ''),
  226                                 'displayname'               => (isset($message->displayname)            ? $message->displayname             : ''),
  227                                 'internetcpid'              => (isset($message->internetcpid)           ? $message->internetcpid            : ''),
  228                                 'meetingrequest'            => (isset($message->meetingrequest)         ? $message->meetingrequest          : ''),
  229                                 'umcallerid'                => (isset($message->umcallerid)             ? $message->umcallerid              : ''),
  230                                 'umusernotes'               => (isset($message->umusernotes)            ? $message->umusernotes             : ''),
  231 //                              'conversationid'            => (isset($message->conversationid)         ? bin2hex($message->conversationid)             : ''),
  232 //                              'conversationindex'         => (isset($message->conversationindex)      ? bin2hex($message->conversationindex)      : ''),
  233                                 'lastverbexecutiontime'     => (isset($message->lastverbexecutiontime)  ? $message->lastverbexecutiontime   : ''),
  234                                 'lastverbexecuted'          => (isset($message->lastverbexecuted)       ? $message->lastverbexecuted        : ''),
  235                                 'receivedasbcc'             => (isset($message->receivedasbcc)          ? $message->receivedasbcc           : ''),
  236                                 'sender'                    => (isset($message->sender)                 ? $message->sender                  : ''),
  237                                 'body'                      => (isset($message->md5body)                ? $message->md5body                 : ""),
  238                                 );
  239 //      debugLog(print_r($md5msg,true));
  240                 $md5flags = array('flagstatus'      => (isset($message->poommailflag->flagstatus)       ? $message->poommailflag->flagstatus        : ''),
  241                                   'flagtype'        => (isset($message->poommailflag->flagtype)         ? $message->poommailflag->flagtype          : ''),
  242                                   'startdate'       => (isset($message->poommailflag->startdate)        ? $message->poommailflag->startdate         : ''),
  243                                   'utcstartdate'    => (isset($message->poommailflag->utcstartdate)     ? $message->poommailflag->utcstartdate      : ''),
  244                                   'duedate'         => (isset($message->poommailflag->duedate)          ? $message->poommailflag->duedate           : ''),
  245                                   'utcduedate'      => (isset($message->poommailflag->utcduedate)       ? $message->poommailflag->utcduedate        : ''),
  246                                   'datecomplete'    => (isset($message->poommailflag->datecompleted)    ? $message->poommailflag->datecompleted     : ''),
  247                                   'reminderset'     => (isset($message->poommailflag->reminderset)      ? $message->poommailflag->reminderset       : ''),
  248                                   'subject'         => (isset($message->poommailflag->subject)          ? $message->poommailflag->subject           : ''),
  249                                   'ordinaldate'     => (isset($message->poommailflag->ordinaldate)      ? $message->poommailflag->ordinaldate       : ''),
  250                                   'subordinaldate'  => (isset($message->poommailflag->subordinaldate)   ? $message->poommailflag->subordinaldate    : ''),
  251                                   'completetime'    => (isset($message->poommailflag->completetime)     ? $message->poommailflag->completetime      : ''),
  252                                   );
  253                 break;
  254             default                 :
  255                 $md5msg = array();
  256                 $md5flags = array();
  257                 break;
  258         }
  259         $msginfo['md5msg'] = md5(serialize($md5msg));
  260         $msginfo['md5flags'] = md5(serialize($md5flags));
  261         $msginfo['read'] = (isset($message->read) ? $message->read : '');
  262         $msginfo['class'] = $class;
  263 /*      if ($message->flags === false || $message->flags === SYNC_NEWMESSAGE) {
  264             if (isset($this->_msginfos[$id])) 
  265                 unset($this->_msginfos[$id]);
  266         }
  267 */
  268         unset($md5msg);
  269         unset($md5flags);
  270 
  271         if (isset($this->_msginfos[$id]) &&
  272             $this->_msginfos[$id]['md5msg'] == $msginfo['md5msg'] &&
  273             $this->_msginfos[$id]['md5flags'] == $msginfo['md5flags'] &&
  274             $this->_msginfos[$id]['read'] == $msginfo['read']) {
  275             debugLog("ImportMessageChange: Discarding change since read,  md5 sums for flags and message didn't change");
  276             $this->_lastObjectStatus = -1;
  277             return true;
  278         } 
  279 
  280         $this->_seenObjects[] = $id;
  281 
  282         if (!isset($this->_msginfos[$id]) && ($message->flags === false || $message->flags === SYNC_NEWMESSAGE)) 
  283             $this->_encoder->startTag(SYNC_ADD);
  284         else
  285             $this->_encoder->startTag(SYNC_MODIFY);
  286 
  287         if (isset($this->_msginfos[$id])) {
  288             if ($this->_msginfos[$id]['md5msg'] != $msginfo['md5msg']) debugLog("ImportMessageChange: Whole message changed");
  289             if ($this->_msginfos[$id]['md5flags'] != $msginfo['md5flags']) debugLog("ImportMessageChange: MD5 Flags changes ".$msginfo['md5flags']." vs ".$this->_msginfos[$id]['md5flags']);
  290             if ($this->_msginfos[$id]['read'] != $msginfo['read']) debugLog("ImportMessageChange: Read change");
  291         } else {
  292             debugLog("ImportMessageChange: Seems to be new message, no entry in msginfos");
  293         }
  294 
  295         if ($class == 'syncsms') {
  296             $this->_encoder->startTag(SYNC_FOLDERTYPE);
  297             $this->_encoder->content("SMS");
  298             $this->_encoder->endTag();
  299         }
  300         $this->_encoder->startTag(SYNC_SERVERENTRYID);
  301         $this->_encoder->content($id);
  302         $this->_encoder->endTag();
  303         $this->_encoder->startTag(SYNC_DATA);
  304 
  305         //debugLog('MsgInfo Stored'.print_r($this->_msginfos[$id],1));
  306         //debugLog('MsgInfo New'.print_r($msginfo,1));
  307 
  308 
  309        if (((isset($this->_msginfos[$id]) && $this->_msginfos[$id]['md5msg'] != $msginfo['md5msg']) ||
  310               !isset($this->_msginfos[$id])) && !isset($this->_readids[$id]) && !isset($this->_flagids[$id])) {
  311             $message->encode($this->_encoder);
  312         } else {
  313             /*
  314              * change mthaler@endo7.com : only if message has a read property;
  315              */
  316             if (isset($message->read) && ((isset($this->_msginfos[$id]) && $this->_msginfos[$id]['read'] != $msginfo['read']) || isset($this->_readids[$id]))) {
  317                 $this->_encoder->startTag(SYNC_POOMMAIL_READ);
  318                 $this->_encoder->content($message->read);
  319                 $this->_encoder->endTag();
  320                 unset($this->_readids[$id]);
  321             }
  322             /*
  323              * change mthaler@endo7.com : only if message has a poommailflag property;
  324              */
  325             if (isset($message->poommailflag) && ((isset($this->_msginfos[$id]) && $this->_msginfos[$id]['md5flags'] != $msginfo['md5flags']) || isset($this->_flagids[$id]))) {
  326                 if ($message->poommailflag->flagstatus == 0 || $message->poommailflag->flagstatus == "") {
  327                     $this->_encoder->startTag(SYNC_POOMMAIL_FLAG,false,true);
  328                 } else {
  329                     $this->_encoder->startTag(SYNC_POOMMAIL_FLAG);
  330                     $message->poommailflag->encode($this->_encoder);
  331                     $this->_encoder->endTag();
  332                 }
  333                 unset($this->_flagids[$id]);
  334             }
  335         }
  336 
  337 
  338 
  339         
  340 /*        if (!in_array($id, $this->_readids) && !in_array($id, $this->_flagids)) {
  341             $message->encode($this->_encoder);
  342     } else {
  343             if (in_array($id, $this->_readids)) {
  344         $this->_encoder->startTag(SYNC_POOMMAIL_READ);
  345             $this->_encoder->content($message->read);
  346             $this->_encoder->endTag();
  347         }
  348         if (in_array($id, $this->_flagids)) {
  349         if ($message->poommailflag->flagstatus == 0 || $message->poommailflag->flagstatus == "") {
  350             $this->_encoder->startTag(SYNC_POOMMAIL_FLAG,false,true);
  351         } else {
  352             $this->_encoder->startTag(SYNC_POOMMAIL_FLAG);
  353                 $message->poommailflag->encode($this->_encoder);
  354                 $this->_encoder->endTag();
  355         }
  356         }
  357         }
  358 */
  359         $this->_encoder->endTag();
  360         $this->_encoder->endTag();
  361 
  362         $this->_lastObjectStatus = 1;
  363         $this->_msginfos[$id] = $msginfo;
  364         return true;
  365     }
  366 
  367     function ImportMessageDeletion($id) {
  368 //  debugLog("HERE ImportMessageDeletion ".$this->_optiontype);
  369 
  370     // prevent sending changes for objects that delete information was sent already
  371         if (in_array($id, $this->_deletedObjects)) {
  372             debugLog("Object $id discarded! Object already deleted.");
  373             $this->_lastObjectStatus = -1;
  374             return true;
  375         } 
  376         $this->_deletedObjects[] = $id;
  377         if (isset($this->_msginfos[$id])) {
  378             if (isset($this->_msginfos[$id]['class']) &&
  379                 $this->_type != $this->_msginfos[$id]['class']) {
  380                 debugLog("Object $id Optiontype and type not matching class stored in msginfo, discarding");
  381                 $this->_lastObjectStatus = -1;
  382                 return true;
  383             }
  384         } else {
  385             debugLog("Delete for Object $id should be exported but object is not in sync with client, discarding");
  386             $this->_lastObjectStatus = -1;
  387             return true;
  388         }
  389         $this->_encoder->startTag(SYNC_REMOVE);
  390         if ($this->_msginfos[$id]['class'] == "syncsms") {
  391             $this->_encoder->startTag(SYNC_FOLDERTYPE);
  392             $this->_encoder->content("SMS");
  393             $this->_encoder->endTag();
  394         }
  395         $this->_encoder->startTag(SYNC_SERVERENTRYID);
  396         $this->_encoder->content($id);
  397         $this->_encoder->endTag();
  398         $this->_encoder->endTag();
  399 
  400         $this->_lastObjectStatus = 1;
  401         unset($this->_msginfos[$id]);
  402         return true;
  403     }
  404 
  405     function ImportMessageReadFlag($id, $flags) {
  406         debugLog("HERE ImportMessageReadFlag ".$this->_type);
  407         // prevent sending readflags for objects that delete information was sentbefore
  408         if (in_array($id, $this->_deletedObjects)) {
  409             debugLog("Object $id discarded! Object got deleted prior the readflag set request arrived.");
  410             $this->_lastObjectStatus = -1;
  411             return true;
  412         }
  413         if($this->_type != "syncmail") {
  414             $this->_lastObjectStatus = -1;
  415             return true;
  416         }
  417         if (isset($this->_msginfos[$id])) {
  418             if (isset($this->_msginfos[$id]['class']) &&
  419                 $this->_type != $this->_msginfos[$id]['class']) {
  420                 debugLog("Object $id Optiontype and type not matching class stored in msginfo, discarding");
  421                 $this->_lastObjectStatus = -1;
  422                 return true;
  423             }
  424             if (isset($this->_msginfos[$id])) $this->_msginfos[$id]['read'] = $flags;
  425         } else {
  426             debugLog("Object $id is not in sync with client, discarding");
  427             $this->_lastObjectStatus = -1;
  428             return true;
  429         }
  430         $this->_encoder->startTag(SYNC_MODIFY);
  431         if ($this->_msginfos[$id]['class'] == "syncsms") {
  432             $this->_encoder->startTag(SYNC_FOLDERTYPE);
  433             $this->_encoder->content("SMS");
  434             $this->_encoder->endTag();
  435         }
  436         $this->_encoder->startTag(SYNC_SERVERENTRYID);
  437         $this->_encoder->content($id);
  438         $this->_encoder->endTag();
  439         $this->_encoder->startTag(SYNC_DATA);
  440         $this->_encoder->startTag(SYNC_POOMMAIL_READ);
  441         $this->_encoder->content($flags);
  442         $this->_encoder->endTag();
  443         $this->_encoder->endTag();
  444         $this->_encoder->endTag();
  445 
  446         $this->_lastObjectStatus = 1;
  447         return true;
  448     }
  449 
  450     function ImportMessageMove($message) {
  451         debugLog("HERE ImportMessageMove ".$this->_type);
  452         return true;
  453     }
  454 };
  455 
  456 class ImportHierarchyChangesStream {
  457 
  458     function ImportHierarchyChangesStream() {
  459         return true;
  460     }
  461 
  462     function ImportFolderChange($folder) {
  463         return true;
  464     }
  465 
  466     function ImportFolderDeletion($folder) {
  467         return true;
  468     }
  469 };
  470 
  471 ?>