Пример #1
0
 /**
  * Imports a change in 'read' flag
  * This can never conflict
  *
  * @param string        $id
  * @param int           $flags - read/unread
  *
  * @access public
  * @return boolean
  * @throws StatusException
  */
 public function ImportMessageReadFlag($id, $flags)
 {
     // check for conflicts
     /*
     * Checking for conflicts is correct at this point, but is a very expensive operation.
     * If the message was deleted, only an error will be shown.
     *
             $this->lazyLoadConflicts();
             if($this->memChanges->IsDeleted($id)) {
        ZLog::Write(LOGLEVEL_INFO, sprintf("ImportChangesICS->ImportMessageReadFlag('%s'): Conflict detected. Data is already deleted. Request will be ignored.", $id));
        return true;
             }
     */
     $readstate = array("sourcekey" => hex2bin($id), "flags" => $flags);
     if (!mapi_importcontentschanges_importperuserreadstatechange($this->importer, array($readstate))) {
         throw new StatusException(sprintf("ImportChangesICS->ImportMessageReadFlag('%s','%d'): Error setting read state: 0x%X", $id, $flags, mapi_last_hresult()), SYNC_STATUS_OBJECTNOTFOUND);
     }
     return true;
 }
Пример #2
0
 function ImportMessageReadFlag($id, $flags)
 {
     $readstate = array("sourcekey" => hex2bin($id), "flags" => $flags);
     $ret = mapi_importcontentschanges_importperuserreadstatechange($this->importer, array($readstate));
     if ($ret == false) {
         debugLog("Unable to set read state: " . sprintf("%x", mapi_last_hresult()));
     }
 }
Пример #3
0
 function ImportMessageReadFlag($id, $flags)
 {
     /*
      * Checking for conflicts is correct at this point, but is a very expensive operation.
      * If the message was deleted, only an error will be shown.
     $this->_lazyLoadConflicts();
     if($this->_memChanges->isDeleted($id)) {
         debugLog("Conflict detected. Data is already deleted. Request will be ignored.");
         return true;
     }
     */
     $readstate = array("sourcekey" => hex2bin($id), "flags" => $flags);
     $ret = mapi_importcontentschanges_importperuserreadstatechange($this->importer, array($readstate));
     if ($ret == false) {
         debugLog("Unable to set read state: " . sprintf("%x", mapi_last_hresult()));
     }
 }
Пример #4
0
 /**
  * Imports a change in 'read' flag
  * This can never conflict
  *
  * @param string        $id
  * @param int           $flags - read/unread
  *
  * @access public
  * @return boolean
  * @throws StatusException
  */
 public function ImportMessageReadFlag($id, $flags)
 {
     list($fsk, $sk) = Utils::SplitMessageId($id);
     // if $fsk is set, we convert it into a backend id.
     if ($fsk) {
         $fsk = ZPush::GetDeviceManager()->GetBackendIdForFolderId($fsk);
     }
     // read flag change for our current folder
     if ($this->folderidHex == $fsk || empty($fsk)) {
         // check if the message is in the current syncinterval
         if (!$this->isMessageInSyncInterval($sk)) {
             throw new StatusException(sprintf("ImportChangesICS->ImportMessageReadFlag('%s','%d'): Message is outside the sync interval. Flags not updated.", $id, $flags), SYNC_STATUS_OBJECTNOTFOUND);
         }
         // check for conflicts
         /*
         * Checking for conflicts is correct at this point, but is a very expensive operation.
         * If the message was deleted, only an error will be shown.
         *
                     $this->lazyLoadConflicts();
                     if($this->memChanges->IsDeleted($id)) {
            ZLog::Write(LOGLEVEL_INFO, sprintf("ImportChangesICS->ImportMessageReadFlag('%s'): Conflict detected. Data is already deleted. Request will be ignored.", $id));
            return true;
                     }
         */
         $readstate = array("sourcekey" => hex2bin($sk), "flags" => $flags);
         if (!mapi_importcontentschanges_importperuserreadstatechange($this->importer, array($readstate))) {
             throw new StatusException(sprintf("ImportChangesICS->ImportMessageReadFlag('%s','%d'): Error setting read state: 0x%X", $id, $flags, mapi_last_hresult()), SYNC_STATUS_OBJECTNOTFOUND);
         }
     } else {
         if (!$fsk) {
             throw new StatusException(sprintf("ImportChangesICS->ImportMessageReadFlag('%s','%d'): Error setting read state. The message is in another folder but id is unknown as no short folder id is available. Please remove your device states to fully resync your device. Operation ignored.", $id, $flags), SYNC_STATUS_OBJECTNOTFOUND);
         }
         $store = ZPush::GetBackend()->GetMAPIStoreForFolderId(ZPush::GetAdditionalSyncFolderStore($fsk), $fsk);
         $entryid = mapi_msgstore_entryidfromsourcekey($store, hex2bin($fsk), hex2bin($sk));
         $realMessage = mapi_msgstore_openentry($store, $entryid);
         $flag = 0;
         if ($flags == 0) {
             $flag |= CLEAR_READ_FLAG;
         }
         $p = mapi_message_setreadflag($realMessage, $flag);
         ZLog::Write(LOGLEVEL_DEBUG, sprintf("ImportChangesICS->ImportMessageReadFlag('%s','%d'): setting readflag on message: 0x%X", $id, $flags, mapi_last_hresult()));
     }
     return true;
 }