carddav-plugin


CardDAV support for Roundcube

downloaded

carddav plugin
CardDAV is an address book client/server protocol designed to allow users to access and share contact data on a server. Our carddav/carddav_plus plugins (using graviox carddav as base code) stores contacts in Roundcube’s database and syncs with the backend CardDAV server (SabreDAV in our case) providing great synchronization speed and performance. You can read / add / delete / edit CardDAV contacts (vCards), take advantage of the autocomplete contacts function within the compose window in Roundcube, search for all CardDAV contacts within the addressbook and keep contacts synchronized with automatic synchronizations and/or manual synchronizations between automatic intervals. Even when CardDAV is not new, we are one of the first ones to support this protocol by a webmail client!

Plugin Requirements


- SabreDAV, DAVical or any other server application that supports CardDAV protocol
- PHP cURL
- carddav_plus (optional) for advanced features

carddav plugin features

    1. Roundcube Contacts Synchronization
    2. Roundcube Contacts Groups support
    3. Automatic Addressbook – Automatically Collect new addresses (carddav_plus required)
    4. Add new contacts to selected CardDAV addressbook (carddav_plus required)
    5. Use automatically collected addresses for autocompletion (carddav_plus required)
    6. Connect/Add Remote CardDAV (carddav_plus required)
carddav Contact Properties Support
    name, firstname, surname, middlename, email, photo.
carddav_plus plugin is required for users to add CardDAV connections. Also, advanced features such as Automated Addressbook support are only available with carddav_plus.
carddav_plus Contact Properties Support
    name, firstname, surname, middlename, email, photo, nickname, jobtitle, organization, department, phone, address, street, locality, zipcode, region, country, website, im (instant messageing), notes.

Installation


carddav/cardav_plus plugins can be downloaded from Plugin Manager Center. Upload the carddav/cardav_plus plugins folders downloaded from our mirror servers ( after you’ve un-zipped it ) into your Roundcube’s plugins folder and proceed to configure the plugin as usual.

There is a bug in Roundcube 0.8.5 (and newer). Organisation fields of vcards created by iPhone are not sync’ed. To correct this issue, replace ./program/include/rcube_vcard.php with one of these files.

Please note that carddav plugin requires additional tables in your Roundcube database. Look for the SQL script included with this plugin.

Configure ‘carddav’ plugin


  • make a copy of config.inc.php.dist file in its same directory and rename the new file to config.inc.php
  • edit the new created config file …/plugins/carddav/config.inc.php:

Sample config.inc.php configuration:

$rcmail_config['db_table_collected_contacts'] = 'collected_contacts';

/* Is automatic_addressbook enabled or disabled by default for users? */
$rcmail_config['use_auto_abook'] = true;

/* Should automatic_addressbook be used for completion by default? */
$rcmail_config['use_auto_abook_for_completion'] = true;

/* Show database addressbook even if they are empty */
$rcmail_config['show_empty_database_addressbooks'] = false;

/* CardDAV database tables */
$rcmail_config['db_table_carddav_server'] = 'carddav_server';
$rcmail_config['db_table_carddav_contacts'] = 'carddav_contacts';

/* Debug (extended logging) */
$rcmail_config['carddav_debug'] = false;

/* Prevent users from editing defaults */
$rcmail_config['carddav_protect'] = false;

/* Max CardDAVs */
$rcmail_config['max_carddavs'] = 5;

/* Sync CardDAVs every (x) minutes automatically (0 = on login only) */
$rcmail_config['sync_carddavs_interval'] = 5;

/* Default CardDAV addressbooks
   placeholders: %u = $_SESSiON['username'], %p = $_SESSION['password']
*/
$rcmail_config['def_carddavs'] = array(
  'Work' => array(
                   'user' => '%u',
                   'pass' => '%p',
                   'url' => 'http://dav.mydomain.ltd/addressbooks/%u/work',
                   'auth' => 'detect',
                   'readonly' => false,
                 ),
  'Personal' => array(
                   'user' => '%u',
                   'pass' => '%p',
                   'url' => 'http://dav.mydomain.ltd/addressbooks/%u/personal',
                   'auth' => 'detect',
                   'readonly' => false,
                 ),
  'Family' => array(
                   'user' => '%u',
                   'pass' => '%p',
                   'url' => 'http://dav.mydomain.ltd/addressbooks/%u/family',
                   'auth' => 'detect',
                   'readonly' => false,
                 ),
);

As usual, there are configuration options above that can be adjusted to meet your environment’s needs.

Configure Sabredav backend server


Make sure Sabredav server is up and running. Verify that the index.php file has the correct information to communicate with the database:

...
$dbtype        = 'mysql';
$dbhost        = 'localhost';
$dbname        = 'sabredav';
$dbuser        = 'root';
$dbpass        = 'pass';
$realm         = 'SabreDAV';
$admin         = 'user@domain.ltd';
...

Check plugin_manager configuration


Please, make sure carddav settings are present in your plugin_manager configuration …/plugins/plugin_manager/config.inc.php

...
  'carddav' => array(
       'label_name' => 'carddav.pluginname',
       'label_description' => 'carddav.plugindescription',
       'uninstall_request' => array(
         'action' => 'plugin.carddav_uninstall',
         'method' => 'post'
       ),
       'reload' => true,
       'active' => true
     ),
    'carddav_plus' => array(
       'protected' => true,
       'active' => true
     ),
...

As usual, you do not need to register this plugin in …/config/main.inc.php if you are running our plugin_manager plugin. Your carddav plugin should be working by now.

Google Contacts


Carddav/carddav_plus plugin conveniently adds support to access your Google Contacts and synchronize them in both directions.

carddav plugin

As a security precaution, Google prevents an application from accessing your account if it’s the first time they’ve seen this application sign in to your account, or if it’s attempting to sign in from a new location not previously approved.

Please note that your Google account will be blocked if you attempt to connect to it several times without granting access ahead of time. To allow a new application to access your account (your Roundcube webmail account in this case), follow the “Grant access to your Google Account” link provided as shown in the screenshot above. Follow Google’s instructions (which is only a two steps procedure) and you will be able to sign in using the application you want to authorize access to your account within the next ten minutes.

carddav plugin

Ready to authorize your application? Awesome! To access Google Contacts, browse to Settings -> Address Book and fill out the “Google Contacts” section as shown in the screenshot above. Save changes.

Working with Address Book


With carddav/carddav_plus there are two local addressbooks (Personal(local) and Collected(local)). When using carddav server addressbooks then Personal(local) and Collected(local) addressbooks are hidden automatically if these addressbooks happen to be empty. Users can configure which AddressBooks to use on their own accounts by browsing to Settings -> Address Book.

Connecting to Remote CardDAV Servers


Carddav plugin also allows users to connect to remote CardDAV servers from within their webmail account by browsing to Settings -> CardDAV Settings as shown below:

carddav plugin

Click the “add button”, give your new CardDAV Address Book a Category name, enter the URL to connect to the remote CardDAV server and the credentials to access it (username & password). There are additional options you may want to explore such as making the new CardDAV “read-only” as well as using the Autocomplete feature (enable by default) to include the new CardDAV contacts when composing e-mails.

Happy Roundcubing!