Commit b5f906b9 authored by Manfred Kutas's avatar Manfred Kutas

Merge pull request #338 in ZP/z-push from...

Merge pull request #338 in ZP/z-push from bugfix/ZP-1019-move-splitmessageid-function-to-utils to develop

* commit 'bb28568f':
  ZP-1019 Move SplitMessageId function to Utils class.
parents 2c514c06 bb28568f
......@@ -393,7 +393,7 @@ class ImportChangesICS implements IImportChanges {
// set the PR_SOURCE_KEY if available or mark it as new message
if($id) {
list(, $sk) = MAPIUtils::SplitMessageId($id);
list(, $sk) = Utils::SplitMessageId($id);
$props[PR_SOURCE_KEY] = hex2bin($sk);
// on editing an existing message, check if it is in the synchronization interval
......@@ -456,7 +456,7 @@ class ImportChangesICS implements IImportChanges {
* @return boolean
*/
public function ImportMessageDeletion($id, $asSoftDelete = false) {
list(,$sk) = MAPIUtils::SplitMessageId($id);
list(,$sk) = Utils::SplitMessageId($id);
// check if the message is in the current syncinterval
if (!$this->isMessageInSyncInterval($sk))
throw new StatusException(sprintf("ImportChangesICS->ImportMessageDeletion('%s'): Message is outside the sync interval and so far not deleted.", $id), SYNC_STATUS_OBJECTNOTFOUND);
......@@ -490,7 +490,7 @@ class ImportChangesICS implements IImportChanges {
* @throws StatusException
*/
public function ImportMessageReadFlag($id, $flags) {
list($fsk,$sk) = MAPIUtils::SplitMessageId($id);
list($fsk,$sk) = Utils::SplitMessageId($id);
// if $fsk is set, we convert it into a backend id.
if ($fsk) {
......@@ -556,7 +556,7 @@ class ImportChangesICS implements IImportChanges {
* @throws StatusException
*/
public function ImportMessageMove($id, $newfolder) {
list(,$sk) = MAPIUtils::SplitMessageId($id);
list(,$sk) = Utils::SplitMessageId($id);
if (strtolower($newfolder) == strtolower(bin2hex($this->folderid)) )
throw new StatusException(sprintf("ImportChangesICS->ImportMessageMove('%s','%s'): Error, source and destination are equal", $id, $newfolder), SYNC_MOVEITEMSSTATUS_SAMESOURCEANDDEST);
......
......@@ -624,7 +624,7 @@ class BackendKopano implements IBackend, ISearchProvider {
*/
public function Fetch($folderid, $id, $contentparameters) {
// id might be in the new longid format, so we have to split it here
list($fsk, $sk) = MAPIUtils::SplitMessageId($id);
list($fsk, $sk) = Utils::SplitMessageId($id);
// get the entry id of the message
$entryid = mapi_msgstore_entryidfromsourcekey($this->store, hex2bin($folderid), hex2bin($sk));
if(!$entryid)
......@@ -774,7 +774,7 @@ class BackendKopano implements IBackend, ISearchProvider {
*/
public function MeetingResponse($requestid, $folderid, $response) {
// Use standard meeting response code to process meeting request
list($fid, $requestid) = MAPIUtils::SplitMessageId($requestid);
list($fid, $requestid) = Utils::SplitMessageId($requestid);
$reqentryid = mapi_msgstore_entryidfromsourcekey($this->store, hex2bin($folderid), hex2bin($requestid));
if (!$reqentryid)
throw new StatusException(sprintf("BackendKopano->MeetingResponse('%s', '%s', '%s'): Error, unable to entryid of the message 0x%X", $requestid, $folderid, $response, mapi_last_hresult()), SYNC_MEETRESPSTATUS_INVALIDMEETREQ);
......
......@@ -619,20 +619,4 @@ class MAPIUtils {
}
// TODO check if we need to do this for encrypted (and signed?) message as well
}
/**
* Splits the id into folder id and message id parts. A colon in the $id indicates
* that the id has folderid:messageid format.
*
* @param string $id
*
* @access public
* @return array
*/
public static function SplitMessageId($id) {
if (strpos($id, ':') !== false) {
return explode(':', $id);
}
return array(null, $id);
}
}
......@@ -449,7 +449,7 @@ class ReplyBackImExporter implements IImportChanges, IExportChanges {
}
$message = false;
list($fsk, $sk) = MAPIUtils::SplitMessageId($id);
list($fsk, $sk) = Utils::SplitMessageId($id);
$sourcekey = hex2bin($sk);
$parentsourcekey = hex2bin(ZPush::GetDeviceManager()->GetBackendIdForFolderId($fsk));
......
......@@ -125,7 +125,7 @@ class SendMail extends RequestProcessor {
$sm->source->folderid = self::$deviceManager->GetBackendIdForFolderId($sm->source->folderid);
}
if (isset($sm->source->itemid)) {
list(, $sk) = MAPIUtils::SplitMessageId($sm->source->itemid);
list(, $sk) = Utils::SplitMessageId($sm->source->itemid);
$sm->source->itemid = $sk;
}
// replyflag and forward flags are actually only for the correct icon.
......
......@@ -1111,6 +1111,22 @@ class Utils {
ZLog::Write(LOGLEVEL_WARN, sprintf("Utils->GetFolderOriginFromId(): Unknown folder origin for folder with id '%s'", $fid));
return 'unknown';
}
/**
* Splits the id into folder id and message id parts. A colon in the $id indicates
* that the id has folderid:messageid format.
*
* @param string $id
*
* @access public
* @return array
*/
public static function SplitMessageId($id) {
if (strpos($id, ':') !== false) {
return explode(':', $id);
}
return array(null, $id);
}
}
......
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