From 54a9c0ab8efe2e56e8044b3c3293af1b3fe55a30 Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel Date: Tue, 26 May 2009 21:30:56 +0200 Subject: [PATCH] Support handling of external pop3 accounts. --- .../Kolab/Server/Object/Kolabinetorgperson.php | 52 ++++++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabinetorgperson.php b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabinetorgperson.php index f345282cf..d12fbf0b7 100644 --- a/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabinetorgperson.php +++ b/framework/Kolab_Server/lib/Horde/Kolab/Server/Object/Kolabinetorgperson.php @@ -41,7 +41,7 @@ class Horde_Kolab_Server_Object_Kolabinetorgperson extends Horde_Kolab_Server_Ob /** How many days of the free/busy future should be calculated in advance? */ const ATTRIBUTE_FBFUTURE = 'kolabFreeBusyFuture'; - /** + /** * The home server of this person. It identifies the correct machine in a * master/slave setup. */ @@ -286,8 +286,6 @@ class Horde_Kolab_Server_Object_Kolabinetorgperson extends Horde_Kolab_Server_Ob /** * Return the filter string to retrieve this object type. * - * @static - * * @return string The filter to retrieve this object type from the server * database. */ @@ -302,6 +300,54 @@ class Horde_Kolab_Server_Object_Kolabinetorgperson extends Horde_Kolab_Server_Ob } /** + * List the external pop3 accounts of this object. + * + * @return array The data of the pop3 accounts. + */ + public function getExternalAccounts() + { + $account_uids = $this->objectsForUid($this->server, $this->uid, Horde_Kolab_Server_Object_Kolabpop3account::OBJECTCLASS_KOLABEXTERNALPOP3ACCOUNT); + if ($account_uids !== false) { + foreach ($account_uids as $account_uid) { + $account = $this->server->fetch($account_uid, 'Horde_Kolab_Server_Object_Kolabpop3account'); + $result[] = $account->toHash(); + } + } + return $result; + } + + /** + * Create/update an external pop3 accounts of this object. + * + * @param array $account The account data. + * + * @return NULL + */ + public function saveExternalAccount($account) + { + $account[Horde_Kolab_Server_Object_Kolabpop3account::ATTRIBUTE_OWNERUID] = $this->getUid(); + $object = &Horde_Kolab_Server_Object::factory('Horde_Kolab_Server_Object_Kolabpop3account', + null, $this->server, $account); + $object->save(); + } + + /** + * Delete an external account. + * + * @param string $mail The mail address of the pop3 account. + * + * @return NULL + */ + public function deleteExternalAccount($mail) + { + $account[Horde_Kolab_Server_Object_Kolabpop3account::ATTRIBUTE_OWNERUID] = $this->getUid(); + $account[Horde_Kolab_Server_Object_Kolabpop3account::ATTRIBUTE_MAIL] = $mail; + $object = &Horde_Kolab_Server_Object::factory('Horde_Kolab_Server_Object_Kolabpop3account', + null, $this->server, $account); + $object->delete(); + } + + /** * Returns the set of search operations supported by this object type. * * @return array An array of supported search operations. -- 2.11.0