Skip to content

Commit

Permalink
Don't include the AirSyncBaseBody element if we have no body.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Jan 15, 2018
1 parent 31c1288 commit a280306
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions lib/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -1352,25 +1352,27 @@ public function toASTask(array $options = array())

/* Notes and Title */
if ($options['protocolversion'] >= Horde_ActiveSync::VERSION_TWELVE) {
$bp = $options['bodyprefs'];
$body = new Horde_ActiveSync_Message_AirSyncBaseBody();
$body->type = Horde_ActiveSync::BODYPREF_TYPE_PLAIN;
if (isset($bp[Horde_ActiveSync::BODYPREF_TYPE_PLAIN]['truncationsize'])) {
$truncation = $bp[Horde_ActiveSync::BODYPREF_TYPE_PLAIN]['truncationsize'];
} elseif (isset($bp[Horde_ActiveSync::BODYPREF_TYPE_HTML])) {
$truncation = $bp[Horde_ActiveSync::BODYPREF_TYPE_HTML]['truncationsize'];
$this->desc = Horde_Text_Filter::filter($this->desc, 'Text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO));
} else {
$truncation = false;
}
if ($truncation && Horde_String::length($this->desc) > $truncation) {
$body->data = Horde_String::substr($this->desc, 0, $truncation);
$body->truncated = 1;
} else {
$body->data = $this->desc;
if (!empty($this->desc)) {
$bp = $options['bodyprefs'];
$body = new Horde_ActiveSync_Message_AirSyncBaseBody();
$body->type = Horde_ActiveSync::BODYPREF_TYPE_PLAIN;
if (isset($bp[Horde_ActiveSync::BODYPREF_TYPE_PLAIN]['truncationsize'])) {
$truncation = $bp[Horde_ActiveSync::BODYPREF_TYPE_PLAIN]['truncationsize'];
} elseif (isset($bp[Horde_ActiveSync::BODYPREF_TYPE_HTML])) {
$truncation = $bp[Horde_ActiveSync::BODYPREF_TYPE_HTML]['truncationsize'];
$this->desc = Horde_Text_Filter::filter($this->desc, 'Text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO));
} else {
$truncation = false;
}
if ($truncation && Horde_String::length($this->desc) > $truncation) {
$body->data = Horde_String::substr($this->desc, 0, $truncation);
$body->truncated = 1;
} else {
$body->data = $this->desc;
}
$body->estimateddatasize = Horde_String::length($this->desc);
$message->airsyncbasebody = $body;
}
$body->estimateddatasize = Horde_String::length($this->desc);
$message->airsyncbasebody = $body;
} else {
$message->body = $this->desc;
}
Expand Down

0 comments on commit a280306

Please sign in to comment.