Commit bca74a9c authored by Sebastian Kummer's avatar Sebastian Kummer

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

Merge pull request #125 in ZP/z-push from bugfix/ZP-815-categories-on-emails-are-not-synchronized-updated to develop

* commit '12ea24fc':
  ZP-815 Remove categories if mobile does not submit them.
  ZP-815 Fixed StreamImporter to include categories when streaming an email update, added categories instance variable to SyncMail, added categories to MAPIProvider->GetEmailMapping(), implementing setting categories for emails.
parents ec5b650b 12ea24fc
...@@ -186,6 +186,7 @@ class MAPIMapping { ...@@ -186,6 +186,7 @@ class MAPIMapping {
"nativebodytype" => PR_NATIVE_BODY_INFO, "nativebodytype" => PR_NATIVE_BODY_INFO,
"lastverbexecuted" => PR_LAST_VERB_EXECUTED, "lastverbexecuted" => PR_LAST_VERB_EXECUTED,
"lastverbexectime" => PR_LAST_VERB_EXECUTION_TIME, "lastverbexectime" => PR_LAST_VERB_EXECUTION_TIME,
"categories" => "PT_MV_STRING8:PS_PUBLIC_STRINGS:Keywords",
); );
} }
......
...@@ -1053,6 +1053,11 @@ class MAPIProvider { ...@@ -1053,6 +1053,11 @@ class MAPIProvider {
* @param SyncMail $message * @param SyncMail $message
*/ */
private function setEmail($mapimessage, $message) { private function setEmail($mapimessage, $message) {
// update categories
if (!isset($message->categories)) $message->categories = array();
$emailmap = MAPIMapping::GetEmailMapping();
$this->setPropsInMAPI($mapimessage, $message, array("categories" => $emailmap["categories"]));
$flagmapping = MAPIMapping::GetMailFlagsMapping(); $flagmapping = MAPIMapping::GetMailFlagsMapping();
$flagprops = MAPIMapping::GetMailFlagsProperties(); $flagprops = MAPIMapping::GetMailFlagsProperties();
$flagprops = array_merge($this->getPropIdsFromStrings($flagmapping), $this->getPropIdsFromStrings($flagprops)); $flagprops = array_merge($this->getPropIdsFromStrings($flagmapping), $this->getPropIdsFromStrings($flagprops));
......
...@@ -111,20 +111,23 @@ class ImportChangesStream implements IImportChanges { ...@@ -111,20 +111,23 @@ class ImportChangesStream implements IImportChanges {
if ($message->flags === false || $message->flags === SYNC_NEWMESSAGE) if ($message->flags === false || $message->flags === SYNC_NEWMESSAGE)
$this->encoder->startTag(SYNC_ADD); $this->encoder->startTag(SYNC_ADD);
else { else {
// on update of an SyncEmail we only export the flags // on update of an SyncEmail we only export the flags and categories
if($message instanceof SyncMail && isset($message->flag) && $message->flag instanceof SyncMailFlags) { if($message instanceof SyncMail && ((isset($message->flag) && $message->flag instanceof SyncMailFlags) || isset($message->categories))) {
$newmessage = new SyncMail(); $newmessage = new SyncMail();
$newmessage->read = $message->read; $newmessage->read = $message->read;
$newmessage->flag = $message->flag; if (isset($message->flag)) $newmessage->flag = $message->flag;
if (isset($message->lastverbexectime)) $newmessage->lastverbexectime = $message->lastverbexectime; if (isset($message->lastverbexectime)) $newmessage->lastverbexectime = $message->lastverbexectime;
if (isset($message->lastverbexecuted)) $newmessage->lastverbexecuted = $message->lastverbexecuted; if (isset($message->lastverbexecuted)) $newmessage->lastverbexecuted = $message->lastverbexecuted;
if (isset($message->categories)) $newmessage->categories = $message->categories;
$message = $newmessage; $message = $newmessage;
unset($newmessage); unset($newmessage);
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ImportChangesStream->ImportMessageChange('%s'): SyncMail message updated. Message content is striped, only flags are streamed.", $id)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("ImportChangesStream->ImportMessageChange('%s'): SyncMail message updated. Message content is striped, only flags/categories are streamed.", $id));
} }
$this->encoder->startTag(SYNC_MODIFY); $this->encoder->startTag(SYNC_MODIFY);
} }
// TAG: SYNC_ADD / SYNC_MODIFY
$this->encoder->startTag(SYNC_SERVERENTRYID); $this->encoder->startTag(SYNC_SERVERENTRYID);
$this->encoder->content($id); $this->encoder->content($id);
$this->encoder->endTag(); $this->encoder->endTag();
......
...@@ -86,6 +86,7 @@ class SyncMail extends SyncObject { ...@@ -86,6 +86,7 @@ class SyncMail extends SyncObject {
public $lastverbexectime; public $lastverbexectime;
public $receivedasbcc; public $receivedasbcc;
public $sender; public $sender;
public $categories;
function SyncMail() { function SyncMail() {
$mapping = array ( $mapping = array (
......
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