Contacts
Set up an address book on our server:
- Go to our CardDAV server
- Click the link for your name
- Create a new address book using the form at the bottom of the page
Contents
Setting up Contacts Sync (CardDAV)
Android
Follow the Andorid instructions on the Calendar page, using the DAVdroid app.
vdirsyncer
Vdirsyncer can synchronize your addressbook to a local directory containing .vcf files, which can then be manipulated by various other tools (such as Khard below) or easily scripted. It can also be used to sync your Dark Peak Calendar.
- Install vdirsyncer, check your distribution packages or install via pip: `pip install vdirsyncer`
- Create a vdirsyncer config file at `~/.vdirsyncer/config`, and add the following:
[general] status_path = ~/.vdirsyncer/status/ [pair darkpeak_contacts] a = darkpeak_contacts_local b = darkpeak_contacts_remote [storage darkpeak_contacts_local] type = filesystem path = ~/.contacts/<ADDRESSBOOK>/ fileext = .vcf [storage darkpeak_contacts_remote] type = carddav url = https://dav.darkpeak.org/addressbooks/<USERNAME>/<ADDRESSBOOK>/ username = <USERNAME> password = <PASSWORD>
- Replace <USERNAME> and <PASSWORD> in the above with your Dark Peak username and password. Replace <ADDRESSBOOK> with the name of the addressbook you want to sync (in my case 'personal').
- Run `vdirsyncer sync` - it may prompt you about creating the contacts directory
- The local contacts directory should now contain .vcf files, which can be edited/created/deleted and sync'd back to the server by running `vdirsyncer sync` again.
- You'll probably want to setup a periodic sync using cron or systemd timers. I used systemd by creating the following files:
.config/systemd/user/vdirsyncer.timer:
[Unit] Description=Run vdirsyncer hourly [Timer] OnCalendar=hourly Persistent=true [Install] WantedBy=timers.target
.config/systemd/user/vdirsyncer.service:
[Unit] Description=Sync calendars and addressbooks vis vdirsyncer After=network-online.target Wants=network-online.target [Service] ExecStart=/usr/bin/vdirsyncer sync
This will run vdirsync hourly (or immediately if it missed the last sync). You can enable the timer like any other systemd service:
$ systemctl --user enable vdirsyncer.timer $ systemctl --user start vdirsyncer.timer
You can check active timers by doing:
$ systemctl --user list-timers
Khard
Khard is an address book for the Linux console. It creates, reads, modifies and removes CardDAV address book entries at your local machine. Khard is also compatible to the email clients mutt and alot and the SIP client twinkle. It uses vdirsyncer to communicate with CardDAV servers.
- Install and configure vdirsyncer (described above)
- Install Khard via pip: `sudo pip2 install khard` (I had to use pip2 instead of pip since Python 3 is the default on Arch Linux, and khard would only install on Python 2 for me) - you might also want to check your distribution package repositories
- Add the following to `.config/khard/khard.conf`:
[addressbooks] [[<ADDRESSBOOK>]] path = ~/.contacts/<ADDRESSBOOK>/ [general] editor = /usr/bin/vim default_country = UK default_action = list show_nicknames = no
Replacing <ADDRESSBOOK> with the addressbook you setup in vdirsyncer.
The Khard README has details on configuring mail clients to work with Khard's contact list.
Importing contacts
First, check to see if your Contacts/Addressbook CardDAV client has a mechanism for copying over contacts or importing from another addressbook. Failing that, I found the easiest way to import from another CalDAV server was to setup a new sync with vdirsyncer (see instructions above), run `vdirsync sync`, then copy over the .vcf files into the vsyncdir directory for my Dark Peak calendar then remove the sync config for the old calendar.