diff --git a/framework/ActiveSync/lib/Horde/ActiveSync/Request/Settings.php b/framework/ActiveSync/lib/Horde/ActiveSync/Request/Settings.php
index d7477b4757e..a4003942fd7 100644
--- a/framework/ActiveSync/lib/Horde/ActiveSync/Request/Settings.php
+++ b/framework/ActiveSync/lib/Horde/ActiveSync/Request/Settings.php
@@ -72,6 +72,7 @@ class Horde_ActiveSync_Request_Settings extends Horde_ActiveSync_Request_Base
const STATUS_SUCCESS = 1;
const STATUS_ERROR = 2;
+ const STATUS_UNAVAILABLE = 4;
const OOF_STATE_ENABLED = 1;
const OOF_STATE_DISABLED = 0;
@@ -253,7 +254,7 @@ protected function _handle()
$this->_encoder->startTag(self::SETTINGS_OOF);
$this->_encoder->startTag(self::SETTINGS_STATUS);
if (!isset($result['set']['oof'])) {
- $this->_encoder->content(0);
+ $this->_encoder->content(self::OOF_STATE_DISABLED);
} else {
$this->_encoder->content($result['set']['oof']);
}
@@ -303,46 +304,49 @@ protected function _handle()
if (isset($request['get']['oof'])) {
$this->_encoder->startTag(self::SETTINGS_OOF);
$this->_encoder->startTag(self::SETTINGS_STATUS);
- $this->_encoder->content(1);
+ $this->_encoder->content($result['get']['oof']['status']);
$this->_encoder->endTag(); // end self::SETTINGS_STATUS
- $this->_encoder->startTag(self::SETTINGS_GET);
- $this->_encoder->startTag(self::SETTINGS_OOFSTATE);
- $this->_encoder->content($result['get']['oof']['oofstate']);
- $this->_encoder->endTag(); // end self::SETTINGS_OOFSTATE
- // This we maybe need later on (OOFSTATE=2). It shows that OOF
- // Messages could be send depending on Time being set in here.
- // Unfortunately cannot proof it working on my device.
- if ($result['get']['oof']['oofstate'] == 2) {
- $this->_encoder->startTag(self::SETTINGS_STARTTIME);
- $this->_encoder->content(gmdate('Y-m-d\TH:i:s.000', $result['get']['oof']['starttime']));
- $this->_encoder->endTag(); // end self::SETTINGS_STARTTIME
- $this->_encoder->startTag(self::SETTINGS_ENDTIME);
- $this->_encoder->content(gmdate('Y-m-d\TH:i:s.000', $result['get']['oof']['endtime']));
- $this->_encoder->endTag(); // end self::SETTINGS_ENDTIME
- }
- foreach($result['get']['oof']['oofmsgs'] as $oofentry) {
- $this->_encoder->startTag(self::SETTINGS_OOFMESSAGE);
- $this->_encoder->startTag($oofentry['appliesto'],false,true);
- $this->_encoder->startTag(self::SETTINGS_ENABLED);
- $this->_encoder->content($oofentry['enabled']);
- $this->_encoder->endTag(); // end self::SETTINGS_ENABLED
- $this->_encoder->startTag(self::SETTINGS_REPLYMESSAGE);
- $this->_encoder->content($oofentry['replymessage']);
- $this->_encoder->endTag(); // end self::SETTINGS_REPLYMESSAGE
- $this->_encoder->startTag(self::SETTINGS_BODYTYPE);
- switch (strtolower($oofentry['bodytype'])) {
- case 'text':
- $this->_encoder->content('Text');
- break;
- case 'HTML':
- $this->_encoder->content('HTML');
+ if ($result['get']['oof']['status'] == self::STATUS_SUCCESS) {
+ $this->_encoder->startTag(self::SETTINGS_GET);
+ $this->_encoder->startTag(self::SETTINGS_OOFSTATE);
+ $this->_encoder->content($result['get']['oof']['oofstate']);
+ $this->_encoder->endTag(); // end self::SETTINGS_OOFSTATE
+ // This we maybe need later on (OOFSTATE=2). It shows that OOF
+ // Messages could be send depending on Time being set in here.
+ // Unfortunately cannot proof it working on my device.
+ if ($result['get']['oof']['oofstate'] == 2) {
+ $this->_encoder->startTag(self::SETTINGS_STARTTIME);
+ $this->_encoder->content(gmdate('Y-m-d\TH:i:s.000', $result['get']['oof']['starttime']));
+ $this->_encoder->endTag(); // end self::SETTINGS_STARTTIME
+ $this->_encoder->startTag(self::SETTINGS_ENDTIME);
+ $this->_encoder->content(gmdate('Y-m-d\TH:i:s.000', $result['get']['oof']['endtime']));
+ $this->_encoder->endTag(); // end self::SETTINGS_ENDTIME
+ }
+ foreach($result['get']['oof']['oofmsgs'] as $oofentry) {
+ $this->_encoder->startTag(self::SETTINGS_OOFMESSAGE);
+ $this->_encoder->startTag($oofentry['appliesto'],false,true);
+ $this->_encoder->startTag(self::SETTINGS_ENABLED);
+ $this->_encoder->content($oofentry['enabled']);
+ $this->_encoder->endTag(); // end self::SETTINGS_ENABLED
+ $this->_encoder->startTag(self::SETTINGS_REPLYMESSAGE);
+ $this->_encoder->content($oofentry['replymessage']);
+ $this->_encoder->endTag(); // end self::SETTINGS_REPLYMESSAGE
+ $this->_encoder->startTag(self::SETTINGS_BODYTYPE);
+ switch (strtolower($oofentry['bodytype'])) {
+ case 'text':
+ $this->_encoder->content('Text');
+ break;
+ case 'HTML':
+ $this->_encoder->content('HTML');
+ }
+ $this->_encoder->endTag(); // end self::SETTINGS_BODYTYPE
+ $this->_encoder->endTag(); // end self::SETTINGS_OOFMESSAGE
}
- $this->_encoder->endTag(); // end self::SETTINGS_BODYTYPE
- $this->_encoder->endTag(); // end self::SETTINGS_OOFMESSAGE
+ $this->_encoder->endTag(); // end self::SETTINGS_GET
+ $this->_encoder->endTag(); // end self::SETTINGS_OOF
}
- $this->_encoder->endTag(); // end self::SETTINGS_GET
- $this->_encoder->endTag(); // end self::SETTINGS_OOF
+
}
$this->_encoder->endTag(); // end self::SETTINGS_SETTINGS
diff --git a/framework/ActiveSync/package.xml b/framework/ActiveSync/package.xml
index f29f200b543..0c7cf552d49 100644
--- a/framework/ActiveSync/package.xml
+++ b/framework/ActiveSync/package.xml
@@ -21,6 +21,7 @@
GPL-2.0
+* [mjr] Return proper status codes when OOF is unavailable (Bug #12757).
* [mjr] Fix fatal crash when conflict is detected (Thomas Jarosch <thomas.jarosch@intra2net.com>, Bug #12755)
@@ -1763,6 +1764,7 @@
2013-10-07
GPL-2.0
+* [mjr] Return proper status codes when OOF is unavailable (Bug #12757).
* [mjr] Fix fatal crash when conflict is detected (Thomas Jarosch <thomas.jarosch@intra2net.com>, Bug #12755)
diff --git a/framework/Core/lib/Horde/Core/ActiveSync/Connector.php b/framework/Core/lib/Horde/Core/ActiveSync/Connector.php
index 5be2df75d95..dbaf6d62730 100644
--- a/framework/Core/lib/Horde/Core/ActiveSync/Connector.php
+++ b/framework/Core/lib/Horde/Core/ActiveSync/Connector.php
@@ -647,20 +647,30 @@ public function horde_hasInterface($api)
/**
* Return the currently set vacation message details.
*
- * @return array The vacation rule properties.
+ * @return array|boolean The vacation rule properties or false if
+ * interface unavailable.
*/
public function filters_getVacation()
{
- return $this->_registry->filter->getVacation();
+ if ($this->horde_hasInterface('filter')) {
+ return $this->_registry->filter->getVacation();
+ } else {
+ return false;
+ }
}
/**
* Set vacation message properties.
*
* @param array $setting The vacation details.
+ *
+ * @throws Horde_Exception
*/
public function filters_setVacation(array $setting)
{
+ if (!$this->horde_hasInterface('filter')) {
+ throw new Horde_Exception('Filter interface unavailable.');
+ }
if ($setting['oofstate'] == Horde_ActiveSync_Request_Settings::OOF_STATE_ENABLED) {
// Only support a single message, the APPLIESTOINTERNAL message.
foreach ($setting['oofmsgs'] as $msg) {
diff --git a/framework/Core/lib/Horde/Core/ActiveSync/Driver.php b/framework/Core/lib/Horde/Core/ActiveSync/Driver.php
index 793a351404f..727580e24e1 100644
--- a/framework/Core/lib/Horde/Core/ActiveSync/Driver.php
+++ b/framework/Core/lib/Horde/Core/ActiveSync/Driver.php
@@ -1807,7 +1807,9 @@ public function getSettings(array $settings, $device)
foreach ($settings as $key => $setting) {
switch ($key) {
case 'oof':
- $vacation = $this->_connector->filters_getVacation();
+ if (!$vacation = $this->_connector->filters_getVacation()) {
+ return array('oof' => array('status' => Horde_ActiveSync_Request_Settings::STATUS_UNAVAILABLE));
+ }
$res['oof'] = array(
'status' => Horde_ActiveSync_Request_Settings::STATUS_SUCCESS,
'oofstate' => ($vacation['disabled']
diff --git a/framework/Core/package.xml b/framework/Core/package.xml
index 8e8fcff620b..6b3d95e8fb3 100644
--- a/framework/Core/package.xml
+++ b/framework/Core/package.xml
@@ -39,6 +39,7 @@
LGPL-2.1
+* [mjr] Do not assume that the filter API is available (Bug #12757).
* [mms] Add ability to load javascript via a HordeCore AJAX response (Request #10971).
* [mms] Add ability to expire CSS cache based on file modification time.
* [mms] Allow disabling VFS via the configuration interface.
@@ -1216,7 +1217,7 @@
Horde_ActiveSync
pear.horde.org
- 2.8.0
+ 2.8.4
3.0.0alpha1
3.0.0alpha1
@@ -3178,6 +3179,7 @@
2013-10-08
LGPL-2.1
+* [mjr] Do not assume that the filter API is available (Bug #12757).
* [mms] Add ability to load javascript via a HordeCore AJAX response (Request #10971).
* [mms] Add ability to expire CSS cache based on file modification time.
* [mms] Allow disabling VFS via the configuration interface.