From 53b5dcc05f180fb91932ea1c2664bb4d3035746e Mon Sep 17 00:00:00 2001 From: Michael J Rubinsky Date: Tue, 23 Dec 2014 19:18:50 -0500 Subject: [PATCH] Fix BC break due to MessageBodyData fixes. Possible fix for Bug 13768 --- .../lib/Horde/ActiveSync/Imap/Adapter.php | 2 +- .../lib/Horde/ActiveSync/Imap/Message.php | 25 +++++++++++++++++++ .../Horde/ActiveSync/Imap/MessageBodyData.php | 19 ++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/framework/ActiveSync/lib/Horde/ActiveSync/Imap/Adapter.php b/framework/ActiveSync/lib/Horde/ActiveSync/Imap/Adapter.php index 4d5612b657c..8937890b4a9 100644 --- a/framework/ActiveSync/lib/Horde/ActiveSync/Imap/Adapter.php +++ b/framework/ActiveSync/lib/Horde/ActiveSync/Imap/Adapter.php @@ -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; diff --git a/framework/ActiveSync/lib/Horde/ActiveSync/Imap/Message.php b/framework/ActiveSync/lib/Horde/ActiveSync/Imap/Message.php index 47ca135c7b5..6884775c566 100644 --- a/framework/ActiveSync/lib/Horde/ActiveSync/Imap/Message.php +++ b/framework/ActiveSync/lib/Horde/ActiveSync/Imap/Message.php @@ -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( diff --git a/framework/ActiveSync/lib/Horde/ActiveSync/Imap/MessageBodyData.php b/framework/ActiveSync/lib/Horde/ActiveSync/Imap/MessageBodyData.php index 129da62d7ec..ed6b3d2611c 100644 --- a/framework/ActiveSync/lib/Horde/ActiveSync/Imap/MessageBodyData.php +++ b/framework/ActiveSync/lib/Horde/ActiveSync/Imap/MessageBodyData.php @@ -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; + } + } \ No newline at end of file