Commit fc985834 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #612 in ZP/z-push from feature/ZP-744-implement-picture-for-search to develop

* commit '6974e32e':
  ZP-744 Do not send picture if the device didn't request it. Fixed requests with empty picture tag.
parents ccb848a4 6974e32e
......@@ -1322,7 +1322,7 @@ class BackendKopano implements IBackend, ISearchProvider {
if (isset($abentries[$i][PR_OFFICE_LOCATION]))
$items[$i][SYNC_GAL_OFFICE] = w2u($abentries[$i][PR_OFFICE_LOCATION]);
if (isset($abentries[$i][PR_EMS_AB_THUMBNAIL_PHOTO])) {
if ($searchpicture !== false && isset($abentries[$i][PR_EMS_AB_THUMBNAIL_PHOTO])) {
$items[$i][SYNC_GAL_PICTURE] = StringStreamWrapper::Open($abentries[$i][PR_EMS_AB_THUMBNAIL_PHOTO]);
}
}
......
......@@ -35,7 +35,7 @@ class Search extends RequestProcessor {
*/
public function Handle($commandCode) {
$searchrange = '0';
$searchpicture = new SyncResolveRecipientsPicture();
$searchpicture = false;
$cpo = new ContentParameters();
if(!self::$decoder->getElementStartTag(SYNC_SEARCH_SEARCH))
......@@ -285,6 +285,7 @@ class Search extends RequestProcessor {
}
if(self::$decoder->getElementStartTag(SYNC_SEARCH_PICTURE)) { // TODO - do something with maxsize and maxpictures in the backend
$searchpicture = new SyncResolveRecipientsPicture();
if(self::$decoder->getElementStartTag(SYNC_SEARCH_MAXSIZE)) {
$searchpicture->maxsize = self::$decoder->getElementContent();
if(!self::$decoder->getElementEndTag())
......@@ -298,10 +299,10 @@ class Search extends RequestProcessor {
}
// iOs devices send empty picture tag: <Search:Picture/>
$e = self::$decoder->peek();
if($e[EN_TYPE] == EN_TYPE_ENDTAG) {
if(!self::$decoder->getElementEndTag()) // SYNC_SEARCH_PICTURE
if (($sp = self::$decoder->getElementContent()) !== false) {
if(!self::$decoder->getElementEndTag()) {
return false;
}
}
}
......
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