From 692011df7fbba1c096802922da99a6c8a883d556 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Thu, 27 Nov 2014 06:24:42 -0500
Subject: [PATCH] Extend list_emails() to optionally return only default identity

---
 program/lib/Roundcube/rcube_user.php |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/program/lib/Roundcube/rcube_user.php b/program/lib/Roundcube/rcube_user.php
index 68156b1..77c58dd 100644
--- a/program/lib/Roundcube/rcube_user.php
+++ b/program/lib/Roundcube/rcube_user.php
@@ -240,9 +240,11 @@
     /**
      * Return a list of all user emails (from identities)
      *
+     * @param bool Return only default identity
+     *
      * @return array List of emails (identity_id, name, email)
      */
-    function list_emails()
+    function list_emails($default = false)
     {
         if ($this->emails === null) {
             $this->emails = array();
@@ -259,7 +261,7 @@
             }
         }
 
-        return $this->emails;
+        return $default ? $this->emails[0] : $this->emails;
     }
 
     /**

--
Gitblit v1.9.1