accept &$links by reference
[squirrelmail.git] / functions / abook_local_file.php
index e9986c6e403082a9fc325958e8e710fc04c2f70f..4b2b9a751407b608cab107ec1fa4bbb7dc77dede 100644 (file)
@@ -512,7 +512,15 @@ class abook_local_file extends addressbook_backend {
             // i18n: don't use html formating in translation
             return $this->set_error(sprintf(_("User \"%s\" does not exist"),$alias));
         }
-
+        
+        /* If the alias changed, see if the new alias exists */
+        if (strtolower($alias) != strtolower($userdata['nickname'])) {
+            $ret = $this->lookup($userdata['nickname']);
+            if (!empty($ret)) {
+                return $this->set_error(sprintf(_("User \"%s\" already exists"), $userdata['nickname']));
+            }
+        }
+        
         /* Lock the file to make sure we're the only process working
          * on it. */
         if(!$this->lock()) {
@@ -571,5 +579,4 @@ class abook_local_file extends addressbook_backend {
         }
         return $value;
     }
-
-} /* End of class abook_local_file */
+}