From f996a72fd11b836a77a4b44d1262be2b625c7dbc Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Mon, 19 May 2014 10:38:00 +0200 Subject: [PATCH] [jan] Pass current vacation addresses to hook (skhorde@smail.inf.fh-bonn-rhein-sieg.de, Request #13185). --- ingo/config/hooks.php.dist | 8 +++++++- ingo/docs/CHANGES | 2 ++ ingo/lib/Storage/Vacation.php | 2 +- ingo/package.xml | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ingo/config/hooks.php.dist b/ingo/config/hooks.php.dist index acf2c96e445..fdf1f95f36a 100644 --- a/ingo/config/hooks.php.dist +++ b/ingo/config/hooks.php.dist @@ -53,13 +53,19 @@ class Ingo_Hooks * Set the default addresses used for the vacation module. * * @param string $user The username. + * @param array $value The default/current value. * * @return array A list of vacation addresses. */ -// public function vacation_addresses($user = null) +// public function vacation_addresses($user = null, $value = null) // { // // Example #1: User has 2 vacation addresses. // return array($user . '@example.com', $user . '@foobar.com'); +// +// // Example #2: Keep user-supplied values, return defaults only +// return is_array($value) && count($array) +// ? $value +// : array($user . '@example.com', $user . '@foobar.com'); // } } diff --git a/ingo/docs/CHANGES b/ingo/docs/CHANGES index 2a35c885f88..6ebc7480838 100644 --- a/ingo/docs/CHANGES +++ b/ingo/docs/CHANGES @@ -2,6 +2,8 @@ v3.2.0-git ---------- +[jan] Pass current vacation addresses to hook + (skhorde@smail.inf.fh-bonn-rhein-sieg.de, Request #13185). ------------ diff --git a/ingo/lib/Storage/Vacation.php b/ingo/lib/Storage/Vacation.php index 1a2dfcd8691..20a2145530e 100644 --- a/ingo/lib/Storage/Vacation.php +++ b/ingo/lib/Storage/Vacation.php @@ -120,7 +120,7 @@ public function getVacationAddresses() { try { return $GLOBALS['injector']->getInstance('Horde_Core_Hooks') - ->callHook('vacation_addresses', 'ingo', array(Ingo::getUser())); + ->callHook('vacation_addresses', 'ingo', array(Ingo::getUser(), $this->_addr)); } catch (Horde_Exception_HookNotSet $e) { return $this->_addr; } diff --git a/ingo/package.xml b/ingo/package.xml index 310f9319db8..7756fdd5123 100644 --- a/ingo/package.xml +++ b/ingo/package.xml @@ -33,7 +33,7 @@ ASL -* +* [jan] Pass current vacation addresses to hook (skhorde@smail.inf.fh-bonn-rhein-sieg.de, Request #13185). @@ -1420,7 +1420,7 @@ 2014-05-05 ASL -* +* [jan] Pass current vacation addresses to hook (skhorde@smail.inf.fh-bonn-rhein-sieg.de, Request #13185).