Paul's changes
[squirrelmail.git] / functions / addressbook.php
index 18c2dd6812ecd155dcee163667c0e4f81de58393..0e2a44aa421c83bed06383cc2c56cbaab2d19cca 100644 (file)
@@ -201,6 +201,26 @@ class AddressBook {
     }
 
 
+    /*
+     * This function takes a $row array as returned by the addressbook 
+     * search and returns an e-mail address with the full name or
+     * nickname optionally prepended.
+     */
+
+    function full_address($row) {
+        global $addrsrch_fullname, $datadir, $user;
+
+        if (($prefix = getPref($datadir, $user, 'addrsrch_fullname') or
+            isset($addrsrch_fullname) and $prefix = $addrsrch_fullname)
+            and $prefix !== 'noprefix') {
+            $name = ($prefix === 'nickname') ? $row['nickname']
+                : $row['name'];
+            return $name . ' <' . trim($row['email']) . '>';
+        } else {
+            return trim($row['email']);
+        }
+    }
+
     /*
         Return a list of addresses matching expression in
         all backends of a given type.
@@ -525,4 +545,4 @@ function alistcmp($a,$b) {
     return (strtolower($a['name']) > strtolower($b['name'])) ? 1 : -1;
 }
 
-?>
\ No newline at end of file
+?>