From dcdf4d92dbabe6452aa8b9c554d2e0aace164776 Mon Sep 17 00:00:00 2001 From: Ben Klang Date: Tue, 26 Jan 2010 11:24:50 -0500 Subject: [PATCH] Shout: move the caller ID defaulting out of the driver --- shout/lib/Driver/Sql.php | 5 ----- shout/lib/Forms/DeviceForm.php | 13 +++++++++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/shout/lib/Driver/Sql.php b/shout/lib/Driver/Sql.php index a5f5f2f76..2f5f8292a 100644 --- a/shout/lib/Driver/Sql.php +++ b/shout/lib/Driver/Sql.php @@ -152,11 +152,6 @@ class Shout_Driver_Sql extends Shout_Driver $details['alias'] = $details['name']; $details['name'] = $details['devid']; unset($details['devid']); - // Default the caller id to something sane. - if (empty($details['callerid'])) { - $details['callerid'] = sprintf('"%s" <%s>', $details['alias'], - $details['mailbox']); - } $details['mailbox'] .= '@' . $context; // Prepare the SQL query and arguments diff --git a/shout/lib/Forms/DeviceForm.php b/shout/lib/Forms/DeviceForm.php index 11d1307ea..c8d4a04a6 100644 --- a/shout/lib/Forms/DeviceForm.php +++ b/shout/lib/Forms/DeviceForm.php @@ -69,11 +69,20 @@ class DeviceDetailsForm extends Horde_Form { } } + $callerid = $this->_vars->get('callerid'); + $name = $this->_vars->get('name'); + $mailbox = $this->_vars->get('mailbox'); + + // Default the caller id to something sane. + if ($callerid) { + $callerid = sprintf('"%s" <%s>', $name, $mailbox); + } + $details = array( 'devid' => $devid, 'name' => $this->_vars->get('name'), - 'mailbox' => $this->_vars->get('mailbox'), - 'callerid' => $this->_vars->get('callerid'), + 'mailbox' => $mailbox, + 'callerid' => $callerid, 'genauthtok' => $this->_vars->get('genauthtok'), 'password' => $password, ); -- 2.11.0