Commit ae2a761c authored by Manfred Kutas's avatar Manfred Kutas

ZP-971 Don't fail when source message id is not found on move operations

to the waste basket.

Released under the Affero GNU General Public License (AGPL) version 3.
parent d25536d7
......@@ -550,18 +550,21 @@ class ImportChangesICS implements IImportChanges {
// Get the entryid of the message we're moving
$entryid = mapi_msgstore_entryidfromsourcekey($this->store, $this->folderid, hex2bin($sk));
if(!$entryid)
throw new StatusException(sprintf("ImportChangesICS->ImportMessageMove('%s','%s'): Error, unable to resolve source message id", $sk, $newfolder), SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID);
$srcmessage = false;
//open the source message
$srcmessage = mapi_msgstore_openentry($this->store, $entryid);
if (!$srcmessage) {
if ($entryid) {
//open the source message
$srcmessage = mapi_msgstore_openentry($this->store, $entryid);
}
if(!$entryid || !$srcmessage) {
$code = SYNC_MOVEITEMSSTATUS_INVALIDSOURCEID;
// if we move to the trash and the source message is not found, we can also just tell the mobile that we successfully moved to avoid errors (ZP-624)
if ($newfolder == ZPush::GetBackend()->GetWasteBasket()) {
$code = SYNC_MOVEITEMSSTATUS_SUCCESS;
}
throw new StatusException(sprintf("ImportChangesICS->ImportMessageMove('%s','%s'): Error, unable to open source message: 0x%X", $sk, $newfolder, mapi_last_hresult()), $code);
$errorCase = !$entryid ? "resolve source message id" : "open source message";
throw new StatusException(sprintf("ImportChangesICS->ImportMessageMove('%s','%s'): Error, unable to %s: 0x%X", $sk, $newfolder, $errorCase, mapi_last_hresult()), $code);
}
// check if the source message is in the current syncinterval
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment