Shout: move the caller ID defaulting out of the driver
authorBen Klang <ben@alkaloid.net>
Tue, 26 Jan 2010 16:24:50 +0000 (11:24 -0500)
committerBen Klang <ben@alkaloid.net>
Tue, 26 Jan 2010 16:24:50 +0000 (11:24 -0500)
shout/lib/Driver/Sql.php
shout/lib/Forms/DeviceForm.php

index a5f5f2f..2f5f829 100644 (file)
@@ -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
index 11d1307..c8d4a04 100644 (file)
@@ -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,
         );