Move (and implement) the set/getDeviceRWStatus methods to the state object
authorMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 31 Mar 2010 18:36:27 +0000 (14:36 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 31 Mar 2010 18:36:27 +0000 (14:36 -0400)
framework/ActiveSync/lib/Horde/ActiveSync/Driver/Base.php
framework/ActiveSync/lib/Horde/ActiveSync/Request/Provision.php
framework/ActiveSync/lib/Horde/ActiveSync/State/Base.php
framework/ActiveSync/lib/Horde/ActiveSync/State/File.php

index 5af6015..e2a1336 100644 (file)
@@ -523,34 +523,6 @@ abstract class Horde_ActiveSync_Driver_Base
     }
 
     /**
-     * Return a device wipe status
-     *
-     * @param string $user
-     * @param string $pass
-     * @param string $devid
-     * @return int
-     */
-    public function getDeviceRWStatus($devid)
-    {
-        return false;
-    }
-
-    /**
-     * Set a new rw status for the device
-     *
-     * @param string $user
-     * @param string $pass
-     * @param string $devid
-     * @param string $status
-     *
-     * @return boolean
-     */
-    public function setDeviceRWStatus($devid, $status)
-    {
-        return false;
-    }
-
-    /**
      *
      * @return unknown_type
      */
index 5324de3..dd6260e 100644 (file)
@@ -194,12 +194,12 @@ class Horde_ActiveSync_Request_Provision extends Horde_ActiveSync_Request_Base
         }
         $this->_encoder->endTag();//policy
         $this->_encoder->endTag(); //policies
-        $rwstatus = $this->_driver->getDeviceRWStatus($this->_devId);
+        $rwstatus = $state->getDeviceRWStatus($this->_devId);
 
         //wipe data if status is pending or wiped
         if ($rwstatus == self::RWSTATUS_PENDING || $rwstatus == self::RWSTATUS_WIPED) {
             $this->_encoder->startTag(SYNC_PROVISION_REMOTEWIPE, false, true);
-            $this->_driver->setDeviceRWStatus($this->_devId, self::RWSTATUS_WIPED);
+            $state->setDeviceRWStatus($this->_devId, self::RWSTATUS_WIPED);
             //$rwstatus = SYNC_PROVISION_RWSTATUS_WIPED;
         }
 
index 7b27362..c55c803 100644 (file)
@@ -204,6 +204,26 @@ abstract class Horde_ActiveSync_State_Base
     abstract public function setPolicyKey($devId, $key);
 
     /**
+     * Return a device remotewipe status
+     *
+     * @param string $devId  The device id
+     *
+     * @return int
+     */
+    abstract public function getDeviceRWStatus($devId);
+
+
+    /**
+     * Set a new remotewipe status for the device
+     *
+     * @param string $devid
+     * @param string $status
+     *
+     * @return boolean
+     */
+    abstract public function setDeviceRWStatus($devid, $status);
+
+    /**
      * Obtain the device object.
      *
      * @param string $devId
index b430658..bdeb277 100644 (file)
@@ -533,6 +533,34 @@ class Horde_ActiveSync_State_File extends Horde_ActiveSync_State_Base
     }
 
     /**
+     * Return a device wipe status
+     *
+     * @param string $devId
+     *
+     * @return integer
+     */
+    public function getDeviceRWStatus($devId)
+    {
+        $info = $this->getDeviceInfo($devId);
+        return $info['rwstatus'];
+    }
+
+    /**
+     * Set a new remotewipe status for the device
+     *
+     * @param string $devId
+     * @param integer $status
+     *
+     * @return boolean
+     */
+    public function setDeviceRWStatus($devId, $status)
+    {
+        $info = $this->getDeviceInfo($devId);
+        $info['rwstatus'] = $status;
+        $this->setDeviceInfo($devId, $info);
+    }
+
+    /**
      * Get list of server changes
      *
      * @param integer $flags