Skip to content

Commit

Permalink
Fix BC break due to MessageBodyData fixes.
Browse files Browse the repository at this point in the history
Possible fix for Bug 13768
  • Loading branch information
mrubinsk committed Dec 24, 2014
1 parent c7c7430 commit 53b5dcc
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion framework/ActiveSync/lib/Horde/ActiveSync/Imap/Adapter.php
Expand Up @@ -967,7 +967,7 @@ protected function _buildMailMessage(
$eas_message->importance = $this->_getEASImportance($priority);

// Get the body data.
$mbd = $imap_message->getMessageBodyData($options);
$mbd = $imap_message->getMessageBodyDataObject($options);

if ($version == Horde_ActiveSync::VERSION_TWOFIVE) {
$eas_message->body = $mbd->plain['body']->stream;
Expand Down
25 changes: 25 additions & 0 deletions framework/ActiveSync/lib/Horde/ActiveSync/Imap/Message.php
Expand Up @@ -207,6 +207,31 @@ public function getStructure()
* @throws Horde_ActiveSync_Exception, Horde_Exception_NotFound
*/
public function getMessageBodyData(array $options = array())
{
$mbd = $this->getMessageBodyDataObject($options);

return $mbd->toArray();
}

/**
* Returns the main text body of the message suitable for sending over
* EAS response.
*
* @param array $options An options array containgin:
* - bodyprefs: (array) Bodypref settings
* DEFAULT: none (No bodyprefs used).
* - mimesupport: (integer) Indicates if MIME is supported or not.
* Possible values: 0 - Not supported 1 - Only S/MIME or
* 2 - All MIME.
* DEFAULT: 0 (No MIME support)
* - protocolversion: (float) The EAS protocol we are supporting.
* DEFAULT 2.5
*
* @return Horde_ActiveSync_Imap_MessageBodyData The result.
*
* @throws Horde_ActiveSync_Exception, Horde_Exception_NotFound
*/
public function getMessageBodyDataObject(array $options = array())
{
$mbd = new Horde_ActiveSync_Imap_MessageBodyData(
array(
Expand Down
19 changes: 19 additions & 0 deletions framework/ActiveSync/lib/Horde/ActiveSync/Imap/MessageBodyData.php
Expand Up @@ -568,4 +568,23 @@ protected function _validateBodyData($data)
return $data;
}

/**
* Return the body data in array format. Needed for BC.
*
* @return array
* @todo remove in H6.
*/
public function toArray()
{
$result = array();
if ($this->plain) {
$result['plain'] = $this->_plain;
}
if ($this->html) {
$result['html'] = $this->_html;
}

return $result;
}

}

0 comments on commit 53b5dcc

Please sign in to comment.