function Config(&$importer, $folderid, $restrict, $syncstate, $flags, $truncation)
 {
     $this->_importer =& $importer;
     $this->_restrict = $restrict;
     $this->_syncstate = unserialize($syncstate);
     $this->_flags = $flags;
     $this->_truncation = $truncation;
     $this->_changes = array();
     $this->_step = 0;
     $cutoffdate = $this->getCutOffDate($restrict);
     if ($this->_folderid) {
         // Get the changes since the last sync
         debugLog("Initializing message diff engine");
         if (!isset($this->_syncstate) || !$this->_syncstate) {
             $this->_syncstate = array();
         }
         debugLog(count($this->_syncstate) . " messages in state");
         //do nothing if it is a dummy folder
         if ($this->_folderid != SYNC_FOLDER_TYPE_DUMMY) {
             // on ping: check if backend supports alternative PING mechanism & use it
             if ($folderid === false && $this->_flags == BACKEND_DISCARD_DATA && $this->_backend->AlterPing()) {
                 $this->_changes = $this->_backend->AlterPingChanges($this->_folderid, $this->_syncstate);
             } else {
                 // Get our lists - syncstate (old)  and msglist (new)
                 $msglist = $this->_backend->GetMessageList($this->_folderid, $cutoffdate);
                 if ($msglist === false) {
                     return false;
                 }
                 $this->_changes = GetDiff($this->_syncstate, $msglist);
             }
         }
         debugLog("Found " . count($this->_changes) . " message changes");
     } else {
         debugLog("Initializing folder diff engine");
         $folderlist = $this->_backend->GetFolderList();
         if ($folderlist === false) {
             return false;
         }
         if (!isset($this->_syncstate) || !$this->_syncstate) {
             $this->_syncstate = array();
         }
         $this->_changes = GetDiff($this->_syncstate, $folderlist);
         debugLog("Found " . count($this->_changes) . " folder changes");
     }
 }
 function Config(&$importer, $folderid, $restrict, $syncstate, $flags, $truncation)
 {
     $this->_importer =& $importer;
     $this->_restrict = $restrict;
     $this->_syncstate = unserialize($syncstate);
     $this->_flags = $flags;
     $this->_truncation = $truncation;
     $this->_changes = array();
     $this->_step = 0;
     $cutoffdate = $this->getCutOffDate($restrict);
     if ($this->_folderid) {
         // Get the changes since the last sync
         debugLog("Initializing message diff engine");
         // Get our lists - syncstate (old)  and msglist (new)
         $msglist = $this->_backend->GetMessageList($this->_folderid, $cutoffdate);
         if ($msglist === false) {
             return false;
         }
         debugLog(count($this->_syncstate) . " messages in state");
         if (!isset($this->_syncstate) || !$this->_syncstate) {
             $this->_syncstate = array();
         }
         $this->_changes = GetDiff($this->_syncstate, $msglist);
         debugLog("Found " . count($this->_changes) . " message changes");
     } else {
         debugLog("Initializing folder diff engine");
         $folderlist = $this->_backend->GetFolderList();
         if ($folderlist === false) {
             return false;
         }
         if (!isset($this->_syncstate) || !$this->_syncstate) {
             $this->_syncstate = array();
         }
         $this->_changes = GetDiff($this->_syncstate, $folderlist);
         debugLog("Found " . count($this->_changes) . " folder changes");
     }
 }