diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2012-04-13 10:46:51 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2012-04-13 10:46:51 +0000 |
| commit | 1c258a2b0a0e57a3482cd7b11740d8cd56277b23 (patch) | |
| tree | e57efd7967aa9521cada0decf519c45900798902 /roundcubemail | |
| parent | b5152fe2f7ab75495b8cff0d2d192e16a9d6c6f8 (diff) | |
- Import contacts to default addressbook
git-svn-id: https://svn.roundcube.net/trunk@6077 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail')
| -rw-r--r-- | roundcubemail/plugins/vcard_attachments/package.xml | 2 | ||||
| -rw-r--r-- | roundcubemail/plugins/vcard_attachments/vcard_attachments.php | 27 |
2 files changed, 28 insertions, 1 deletions
diff --git a/roundcubemail/plugins/vcard_attachments/package.xml b/roundcubemail/plugins/vcard_attachments/package.xml index 06d043ffd..cf94ef378 100644 --- a/roundcubemail/plugins/vcard_attachments/package.xml +++ b/roundcubemail/plugins/vcard_attachments/package.xml @@ -34,6 +34,8 @@ - Fixed doble urlencoding of vcard identifier - Fixed encoding when default charset is different than vcard charset - Improved vcards import to work as addressbook::import procedure (with validation and autofix) +- Support IDNA +- Import contacts to default addressbook </notes> <contents> <dir baseinstalldir="/" name="/"> diff --git a/roundcubemail/plugins/vcard_attachments/vcard_attachments.php b/roundcubemail/plugins/vcard_attachments/vcard_attachments.php index c9f843f2b..1400cd581 100644 --- a/roundcubemail/plugins/vcard_attachments/vcard_attachments.php +++ b/roundcubemail/plugins/vcard_attachments/vcard_attachments.php @@ -128,7 +128,7 @@ class vcard_attachments extends rcube_plugin if ($part && ($vcards = rcube_vcard::import($part)) && ($vcard = $vcards[$index]) && $vcard->displayname && $vcard->email ) { - $CONTACTS = $rcmail->get_address_book(null, true); + $CONTACTS = $this->get_address_book(); $email = $vcard->email[0]; $contact = $vcard->get_assoc(); $valid = true; @@ -195,4 +195,29 @@ class vcard_attachments extends rcube_plugin ) ); } + + /** + * Getter for default (writable) addressbook + */ + private function get_address_book() + { + if ($this->abook) { + return $this->abook; + } + + $rcmail = rcmail::get_instance(); + $abook = $rcmail->config->get('default_addressbook'); + + // Get configured addressbook + $CONTACTS = $rcmail->get_address_book($abook, true); + + // Get first writeable addressbook if the configured doesn't exist + // This can happen when user deleted the addressbook (e.g. Kolab folder) + if ($abook === null || $abook === '' || !is_object($CONTACTS)) { + $source = reset($rcmail->get_address_sources(true)); + $CONTACTS = $rcmail->get_address_book($source['id'], true); + } + + return $this->abook = $CONTACTS; + } } |
