Skip to content

Commit

Permalink
Merge branch 'master' into imp_6_2
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Oct 11, 2013
2 parents 33dfbe8 + 22fe29e commit 50981f4
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 56 deletions.
25 changes: 24 additions & 1 deletion framework/ActiveSync/lib/Horde/ActiveSync/Collections.php
Expand Up @@ -1134,18 +1134,41 @@ public function updatePingableFlag()
* we are not PINGing.
*
* @param boolean $ping True if this is a PING request, false otherwise.
* @param array $ensure An array of UIDs that should be sent in the
* current response if possible, and not put off
* because of a MOREAVAILABLE situation.
*
* @return array The changes array.
*/
public function getCollectionChanges($ping = false)
public function getCollectionChanges($ping = false, array $ensure = array())
{
if (empty($this->_changes)) {
$this->_changes = $this->_as->state->getChanges(array('ping' => $ping));
}

if (!empty($ensure)) {
$this->_changes = $this->_reorderChanges($ensure);
}

return $this->_changes;
}

protected function _reorderChanges(array $ensure)
{
$changes = array();
foreach ($this->_changes as $change) {
if (array_search($change['id'], $ensure) !== false) {
$this->_logger->info(sprintf(
'Placing %s at beginning of changes array.', $change['id']));
array_unshift($changes, $change);
} else {
$changes[] = $change;
}
}

return $changes;
}

/**
* Return the count of the current collection's chagnes.
*
Expand Down
3 changes: 1 addition & 2 deletions framework/ActiveSync/lib/Horde/ActiveSync/Imap/Adapter.php
Expand Up @@ -375,8 +375,7 @@ public function getMessageChanges(
$mbox,
$query,
array('results' => array(Horde_Imap_Client::SEARCH_RESULTS_MATCH)));
// @todo change to $search_ret['count'] when Bug: 12682 is fixed
if ($modseq && $folder->modseq() > 0 && count($search_ret['match']->ids)) {
if ($modseq && $folder->modseq() > 0 && $search_ret['count']) {
$folder->setChanges($search_ret['match']->ids, array());
} elseif (count($search_ret['match']->ids)) {
$query = new Horde_Imap_Client_Fetch_Query();
Expand Down
78 changes: 41 additions & 37 deletions framework/ActiveSync/lib/Horde/ActiveSync/Request/Settings.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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']);
}
Expand Down Expand Up @@ -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
Expand Down
20 changes: 15 additions & 5 deletions framework/ActiveSync/lib/Horde/ActiveSync/Request/Sync.php
Expand Up @@ -459,7 +459,9 @@ protected function _handle()
}

if ($statusCode == self::STATUS_SUCCESS) {
if (!empty($collection['clientids']) || !empty($collection['fetchids']) || !empty($collection['missing'])) {
if (!empty($collection['clientids']) || !empty($collection['fetchids'])
|| !empty($collection['missing']) || !empty($collection['importfailures'])) {

$this->_encoder->startTag(Horde_ActiveSync::SYNC_REPLIES);

// Output any errors from missing messages in REMOVE requests.
Expand Down Expand Up @@ -507,18 +509,26 @@ protected function _handle()
}
}

// Output any SYNC_CHANGE failures
// Output any SYNC_MODIFY failures
$ensure_sent = array();
if (!empty($collection['importfailures'])) {
foreach ($collection['importfailures'] as $id => $reason) {
$this->_encoder->startTag(Horde_ActiveSync::SYNC_CHANGE);
$this->_encoder->startTag(Horde_ActiveSync::SYNC_MODIFY);
$this->_encoder->startTag(Horde_ActiveSync::SYNC_SERVERENTRYID);
$tihs->_encoder->content($id);
$this->_encoder->content($id);
$this->_encoder->endTag();
$this->_encoder->startTag(Horde_ActiveSync::SYNC_STATUS);
$this->_encoder->content($reason);
$this->_encoder->endTag();
$this->_encoder->endTag();
// If we have a conflict, ensure we send the new server
// data in the response, if possible. Some android
// clients require this, or never accept the response.
if ($reason == self::STATUS_CONFLICT) {
$ensure_sent[] = $id;
}
}

}

if (!empty($collection['fetchids'])) {
Expand Down Expand Up @@ -574,7 +584,7 @@ protected function _handle()
}

if (!empty($changecount)) {
$exporter->setChanges($this->_collections->getCollectionChanges(), $collection);
$exporter->setChanges($this->_collections->getCollectionChanges(false, $ensure_sent), $collection);
$this->_encoder->startTag(Horde_ActiveSync::SYNC_COMMANDS);
$cnt_collection = 0;
while ($cnt_collection < $collection['windowsize'] &&
Expand Down
6 changes: 4 additions & 2 deletions framework/ActiveSync/package.xml
Expand Up @@ -21,7 +21,8 @@
</stability>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
*
* [mjr] Return proper status codes when OOF is unavailable (Bug #12757).
* [mjr] Fix fatal crash when conflict is detected (Thomas Jarosch &lt;thomas.jarosch@intra2net.com&gt;, Bug #12755)
</notes>
<contents>
<dir baseinstalldir="/" name="/">
Expand Down Expand Up @@ -1763,7 +1764,8 @@
<date>2013-10-07</date>
<license uri="http://www.horde.org/licenses/gpl">GPL-2.0</license>
<notes>
*
* [mjr] Return proper status codes when OOF is unavailable (Bug #12757).
* [mjr] Fix fatal crash when conflict is detected (Thomas Jarosch &lt;thomas.jarosch@intra2net.com&gt;, Bug #12755)
</notes>
</release>
</changelog>
Expand Down
2 changes: 1 addition & 1 deletion framework/Core/js/calendar.js
Expand Up @@ -219,7 +219,7 @@ var Horde_Calendar =

init: function()
{
var i, link, row,
var i, link, row, tmp,
offset = this.click_week ? 1 : 0,
thead = new Element('THEAD'),
table = new Element('TABLE', { className: 'hordeCalendarPopup', cellSpacing: 0 }).insert(thead).insert(new Element('TBODY'));
Expand Down
14 changes: 12 additions & 2 deletions framework/Core/lib/Horde/Core/ActiveSync/Connector.php
Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion framework/Core/lib/Horde/Core/ActiveSync/Driver.php
Expand Up @@ -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']
Expand Down
6 changes: 6 additions & 0 deletions framework/Core/lib/Horde/Core/Factory/ActiveSyncBackend.php
Expand Up @@ -12,6 +12,12 @@ public function create(Horde_Injector $injector)
// Backend driver and dependencies
$params = array('registry' => $registry);
$adapter_params = array('factory' => new Horde_Core_ActiveSync_Imap_Factory());

// Force emailsync to off if we don't have a mail API.
if (!$registry->hasInterface('mail')) {
$conf['activesync']['emailsync'] = false;
}

$driver_params = array(
'connector' => new Horde_Core_ActiveSync_Connector($params),
'imap' => !empty($conf['activesync']['emailsync'])
Expand Down
4 changes: 3 additions & 1 deletion framework/Core/package.xml
Expand Up @@ -39,6 +39,7 @@
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [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.
Expand Down Expand Up @@ -1216,7 +1217,7 @@
<package>
<name>Horde_ActiveSync</name>
<channel>pear.horde.org</channel>
<min>2.8.0</min>
<min>2.8.4</min>
<max>3.0.0alpha1</max>
<exclude>3.0.0alpha1</exclude>
</package>
Expand Down Expand Up @@ -3178,6 +3179,7 @@
<date>2013-10-08</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [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.
Expand Down
2 changes: 1 addition & 1 deletion framework/Imap_Client/lib/Horde/Imap/Client/Socket.php
Expand Up @@ -423,8 +423,8 @@ protected function _login()
// XOAUTH2
if (isset($auth['XOAUTH2']) && $this->getParam('xoauth2_token')) {
$auth_mech[] = 'XOAUTH2';
unset($auth['XOAUTH2']);
}
unset($auth['XOAUTH2']);

// 'PLAIN' authentication always exists if under TLS. Use it over
// all over authentication methods.
Expand Down
19 changes: 16 additions & 3 deletions framework/Imap_Client/package.xml
Expand Up @@ -10,9 +10,9 @@
<email>slusarz@horde.org</email>
<active>yes</active>
</lead>
<date>2013-10-09</date>
<date>2013-10-11</date>
<version>
<release>2.15.5</release>
<release>2.15.6</release>
<api>2.15.0</api>
</version>
<stability>
Expand Down Expand Up @@ -2028,7 +2028,20 @@
<stability>
<release>stable</release>
<api>stable</api></stability>
<date>2013-10-09</date>
<date>2013-10-11</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [mms] Explicitly reject XOAUTH2 as a authentication mechanism if it is not configured in the client (Bug #12756).
</notes>
</release>
<release>
<version>
<release>2.15.6</release>
<api>2.15.0</api></version>
<stability>
<release>stable</release>
<api>stable</api></stability>
<date>2013-10-11</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
*
Expand Down

0 comments on commit 50981f4

Please sign in to comment.