content disposition rfc
[squirrelmail.git] / functions / identity.php
index 3cf24538c53d935e596e7c826a6cb05159273b5c..b3538c69386b539b7efa135a8b6a799c2897613d 100644 (file)
@@ -3,15 +3,16 @@
 /**
  * identity.php
  *
- * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Copyright (c) 1999-2005 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This contains utility functions for dealing with multiple identities
  *
- * $Id$
- *
+ * @version $Id$
+ * @package squirrelmail
  */
 
+/** Used to simplify includes */
 if (!defined('SM_PATH')) {
     define('SM_PATH','../');
 }
@@ -21,24 +22,28 @@ include_once(SM_PATH . 'include/load_prefs.php');
 /**
 * Returns an array of all the identities.
 * Array is keyed: full_name, reply_to, email_address, index, signature
+* @return array full_name,reply_to,email_address,index,signature
 */
 function get_identities() {
 
-    global $username, $data_dir;
+    global $username, $data_dir, $domain;
+
+    $em = getPref($data_dir,$username,'email_address');
+    if ( ! $em )  $em = $username.'@'.$domain;
 
-    $num_ids = getPref($data_dir,$username,'identities');
     $identities = array();
     /* We always have this one, even if the user doesn't use multiple identities */
-    $identities['default'] = array('full_name' => getPref($data_dir,$username,'full_name'),
-        'email_address' => getPref($data_dir,$username,'email_address'),
+    $identities[] = array('full_name' => getPref($data_dir,$username,'full_name'),
+        'email_address' => $em,
         'reply_to' => getPref($data_dir,$username,'reply_to'),
         'signature' => getSig($data_dir,$username,'g'),
         'index' => 0 );
 
+    $num_ids = getPref($data_dir,$username,'identities');
     /* If there are any others, add them to the array */
     if (!empty($num_ids) && $num_ids > 1) {
         for ($i=1;$i<$num_ids;$i++) {
-            $identities[$i] = array('full_name' => getPref($data_dir,$username,'full_name' . $i),
+            $identities[] = array('full_name' => getPref($data_dir,$username,'full_name' . $i),
             'email_address' => getPref($data_dir,$username,'email_address' . $i),
             'reply_to' => getPref($data_dir,$username,'reply_to' . $i),
             'signature' => getSig($data_dir,$username,$i),