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
mrubinsk committed Nov 15, 2013
2 parents 9af73ea + aa87351 commit b673fc1
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 10 deletions.
13 changes: 13 additions & 0 deletions framework/ActiveSync/lib/Horde/ActiveSync.php
Expand Up @@ -770,6 +770,8 @@ public function handleRequest($cmd, $devId)
$this->_device->needsVersionUpdate($this->getSupportedVersions());

// @TODO: Remove is_callable check (and extra else clause) for H6.
// Combine this with the modifyDevice callback? Allow $device
// to be modified here?
if (is_callable(array($this->_driver, 'createDeviceCallback'))) {
$callback_ret = $this->_driver->createDeviceCallback($this->_device);
if ($callback_ret !== true) {
Expand All @@ -784,6 +786,10 @@ public function handleRequest($cmd, $devId)
throw new Horde_ActiveSync_Exception($msg);
}
} else {
// Give the driver a chance to modify device properties.
if (is_callable(array($this->_driver, 'modifyDeviceCallback'))) {
$this->_device = $this->_driver->modifyDeviceCallback($this->_device);
}
$this->_device->save();
}
} else {
Expand All @@ -792,13 +798,19 @@ public function handleRequest($cmd, $devId)
} else {
$this->_device = $this->_state->loadDeviceInfo($devId, $this->_driver->getUser());
$this->_device->version = $version;

// Check this here so we only need to save the device object once.
if ($this->_device->properties['version'] < $this->_maxVersion &&
$this->_device->needsVersionUpdate($this->getSupportedVersions())) {

$needMsRp = true;
}

// Give the driver a chance to modify device properties.
if (is_callable(array($this->_driver, 'modifyDeviceCallback'))) {
$this->_device = $this->_driver->modifyDeviceCallback($this->_device);
}

$this->_device->save();

if (is_callable(array($this->_driver, 'deviceCallback'))) {
Expand Down Expand Up @@ -857,6 +869,7 @@ public function handleRequest($cmd, $devId)
header("X-MS-RP: ". $this->getSupportedVersions());
}

$this->_driver->setDevice($this->_device);
$class = 'Horde_ActiveSync_Request_' . basename($cmd);
if (class_exists($class)) {
$request = new $class($this);
Expand Down
25 changes: 17 additions & 8 deletions framework/ActiveSync/lib/Horde/ActiveSync/Device.php
Expand Up @@ -31,20 +31,29 @@
* @property string user The userid for the current device account.
* @property array supported The SUPPORTED data sent from this device.
* @property string policykey The current policykey, if provisioned.
* @property array properties The device properties, sent in DEVICEINFO.
* @property array properties The device properties, sent in DEVICEINFO,
* along with any custom properties set.
* @property string announcedVersion The most last EAS supported versions
* announced to the device.
*
*/
class Horde_ActiveSync_Device
{
const MODEL = 'Settings:Model';
const IMEI = 'Settings:IMEI';
const NAME = 'Settings:FriendlyName';
const OS = 'Settings:OS';
const OS_LANGUAGE = 'Settings:OSLanguage';
const PHONE_NUMBER = 'Settings:PhoneNumber';
const VERSION = 'version';
const MODEL = 'Settings:Model';
const IMEI = 'Settings:IMEI';
const NAME = 'Settings:FriendlyName';
const OS = 'Settings:OS';
const OS_LANGUAGE = 'Settings:OSLanguage';
const PHONE_NUMBER = 'Settings:PhoneNumber';
const VERSION = 'version';
const MULTIPLEX = 'multiplex';

// Bitwise constants for flagging device must use multiplexed collections.
// @since 2.9.0
const MULTIPLEX_CONTACTS = 1;
const MULTIPLEX_CALENDAR = 2;
const MULTIPLEX_TASKS = 4;
const MULTIPLEX_NOTES = 8;

/**
* Device properties.
Expand Down
18 changes: 18 additions & 0 deletions framework/ActiveSync/lib/Horde/ActiveSync/Driver/Base.php
Expand Up @@ -77,6 +77,14 @@ abstract class Horde_ActiveSync_Driver_Base
*/
protected $_state;

/**
* The device object
*
* @var Horde_ActiveSync_Device
* @since 2.12.0
*/
protected $_device;

/**
* Temporary serverid to uid map. Used when creating the hierarchy
* for the first time
Expand Down Expand Up @@ -275,6 +283,16 @@ public function addDefaultBodyPrefTruncation(array $bodyprefs)
return $bodyprefs;
}

/**
* Set the currently connected device
*
* @param Horde_ActiveSync_Device $device The device object.
*/
public function setDevice(Horde_ActiveSync_Device $device)
{
$this->_device = $device;
}

/**
* Build a EAS style FB string. Essentially, each digit represents 1/2 hour.
* The values are as follows:
Expand Down
2 changes: 1 addition & 1 deletion framework/ActiveSync/lib/Horde/ActiveSync/State/Base.php
Expand Up @@ -373,7 +373,7 @@ public function getFolderUidForBackendId($serverid)
*
* @param array $options An options array:
* - ping: (boolean) Only detect if there is a change, do not build
* any messages.
* any messages.
* DEFAULT: false (Build full change array).
*
* @return array An array of hashes describing each change:
Expand Down
2 changes: 1 addition & 1 deletion kronolith/lib/Api.php
Expand Up @@ -943,7 +943,7 @@ public function delete($uid, $recurrenceId = null)
if (empty($event)) {
$ownerCalendars = Kronolith::listInternalCalendars(true, Horde_Perms::DELETE);
foreach ($events as $ev) {
if ($GLOBALS['registry']->isAdmin() || isset($ownerCalendars[$ev->calendar])) {
if (isset($ownerCalendars[$ev->calendar])) {
$kronolith_driver->open($ev->calendar);
$event = $ev;
break;
Expand Down

0 comments on commit b673fc1

Please sign in to comment.