Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CardDAV and CalDAV Support #120

Open
chlarsen opened this issue Sep 27, 2016 · 34 comments
Open

CardDAV and CalDAV Support #120

chlarsen opened this issue Sep 27, 2016 · 34 comments
Assignees
Labels
calendar calendar module set contacts contacts module set enhancement suggest an improvement help wanted we would love your help new module set requires a new module set

Comments

@chlarsen
Copy link

Dear Jason,
As CardDAV and CalDAV are pretty much standard among mobile devices (see the great DAVDroid app), it may be good to star thinking about CardDAV support for the addressbook (as a module) and CalDAV support for the calendar (again, as a module).
This would allow easy interaction with other applications, too.
Nothing urgent, just a thought. :-)
Thanks so much!
Chris

@jasonmunro jasonmunro added enhancement suggest an improvement calendar calendar module set contacts contacts module set labels Sep 27, 2016
@jasonmunro jasonmunro self-assigned this Sep 27, 2016
@jasonmunro
Copy link
Member

I will look into it. Thanks for the suggestion!

@dhuyvetter
Copy link

Would be nice to be able to integrate OwnCloud, which supports CardDAV and CalDAV.

@NodokaMurmevent
Copy link

caldav + cardav it's a must have ! i desperately search a web-mail how integrate this.

@chlarsen
Copy link
Author

chlarsen commented Oct 25, 2016 via email

@conspacer
Copy link

+1 for CardDAV and CalDAV modules. Additionally it could be a module for OwnCloud/NextCloud with checkboxes for those different options.

@renaudallard
Copy link

My comment won't probably help, but it seems other projects use the sabredav client to connect to caldav/carddav servers. Maybe you could get inspiration from there.

@jasonmunro
Copy link
Member

@renaudallard I appreciate the feedback, I will check sabredav out. Thanks again!

@Yamakasi
Copy link

I don't know if this is still something too look at but I have investigated most of them in the past and the most flexible solution was SQL based:

http://sabre.io/baikal/
https://github.com/sabre-io/Baikal

This was in the past on it's own domain bailkal-server.com

@jasonmunro
Copy link
Member

FWIW, I have started on some low level support for WebDav related protocols:

  • Added a webdav_formats lib that can parse iCal and vCard formats
  • Updated the API lib to better support XML based protocols and custom HTTP methods like PROPFIND

At first I'm hoping to support read-only CardDav sources for contacts as that (I think) will be the easiest to integrate to get started :)

@jasonmunro jasonmunro added the new module set requires a new module set label Sep 25, 2018
@jasonmunro
Copy link
Member

Initial CardDav contact support is pushed to the master branch! I used Radicale to test against, and the Sabredav docs to figure out the discovery flow. I'm sure there will be compatibility issues but it's a start!

@omocinteractive
Copy link

It's a bug? I can configure the CardDav Addressbooks (PW/Username), but a can't see 'Addressbooks' on navigation.

@jasonmunro
Copy link
Member

@omocinteractive CardDav addresses should be visible on the Contacts page from the Main menu.

@omocinteractive
Copy link

image 065

@jasonmunro
Copy link
Member

@omocinteractive you need to enable both the contacts and carddav_contacts module sets in your hm3.ini file, and re-run the config gen script. The contacts module is a generic module that all the other contacts sources use (carddav, ldap, local, gmail).

@omocinteractive
Copy link

... so? There is no different ...
image 066

@jasonmunro
Copy link
Member

@omocinteractive The module set you need is is "contacts", not "local_contacts". Local contacts is another contact source backend.

https://github.com/jasonmunro/cypht/blob/master/hm3.sample.ini#L520-L525

@omocinteractive
Copy link

omocinteractive commented Nov 12, 2018

... ah, okay. Now, 'contacts' is visible ;) But no contacts. I will have a look into the logfile later ...

@jasonmunro
Copy link
Member

jasonmunro commented Nov 12, 2018

I'm not terribly surprised. I have only done very limited testing with this. I will add some additional debugging to the flow because right now it's not very obvious where things fail. Thanks for trying it out!

@jasonmunro
Copy link
Member

@omocinteractive Just pushed a bunch of carddav related debugging to the master branch. If you run Cypht in debug mode, and access the contacts page, you should get a bunch of carddav related debug statements in your PHP log.

@omocinteractive
Copy link

... okay, in the moment i get this:

stderr: ), referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490563 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: Array, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490622 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: (, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490636 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [0] => Including site module set lib.php, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490648 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [1] => Using Hm_DB_Session with Hm_Auth_DB, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490660 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [2] => Using DB user configuration, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490672 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [3] => Using sapi: cgi-fcgi, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490683 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [4] => Request type: AJAX, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490694 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [5] => Request path: /mail-debug/, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490705 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [6] => TLS request: 1, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490712 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [7] => Mobile request: 0, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490719 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [8] => Page ID: ajax_imap_unread, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490725 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [9] => Memcached enabled but not supported by PHP, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490732 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [10] => CACHE backend using: noop, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490739 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [11] => Connecting to dsn: mysql:host=127.0.0.1;dbname=domain_tld, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490745 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [12] => LOGGED IN, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490752 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [13] => CACHE: saving "imap4" using noop, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490778 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [14] => PHP version 7.0.32, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490785 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [15] => Zend version 3.0.0, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490791 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [16] => Peak Memory: 6144, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490797 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [17] => PID: 30938, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490804 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: [18] => Included files: 59, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:15:46.490810 2018] [fcgid:warn] [pid 29211] [client 79.197.27.211:32856] mod_fcgid: stderr: ), referer: https://www.domain.tld/mail-debug/?page=contacts

@omocinteractive
Copy link

[Mon Nov 12 21:23:38.391804 2018] [fcgid:warn] [pid 29591] [client 79.197.27.211:33394] mod_fcgid: stderr: [13] => CARDDAV: Sending discover XML: <d:propfind xmlns:d="DAV:"><d:prop><d:current-user-principal /></d:prop></d:propfind>, referer: https://www.domain.tld/mail-debug/?page=contacts
[Mon Nov 12 21:23:38.391806 2018] [fcgid:warn] [pid 29591] [client 79.197.27.211:33394] mod_fcgid: stderr: [14] => CARDDAV: No principal path discovered, referer: https://www.domain.tld/mail-debug/?page=contacts

@omocinteractive
Copy link

... but no problem, no stress ;) I set some other debug-points on the fast, but i have to sleep. Good night!

@jasonmunro
Copy link
Member

jasonmunro commented Nov 14, 2018

@omocinteractive so this is the first step in the discover process. We take the url setup in the carddav_contacts.ini file, and send a PROPFIND request that should return XML defining the url path of the authenticated user. Then we use that to find the url of the addressbook(s), then finally we get the address vcards and parse them.

My guess here is that our XML parsing is not working properly and not finding the first url path we need. There should be another debug entry when this happens like:

CARDDAV: find for "path" failed in xml: "xml"

where "path" is the xpath we are using to search the xml, and "xml" is what your carddav server responded with. To troubleshoot this further, I need to see the xml that is returned here. Thanks!

@omocinteractive
Copy link

<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
<d:response>
<d:href>/remote.php/dav/addressbooks/users/admin/default/</d:href>
<d:propstat>
<d:prop>
<d:current-user-principal>
<d:href>/remote.php/dav/principals/users/admin/</d:href>
</d:current-user-principal>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
<d:response>
<d:href>/remote.php/dav/addressbooks/users/admin/default/C71ABC0D-0D80-1001-51CF-1CDB11301831.vcf</d:href>
<d:propstat>
<d:prop>
<d:current-user-principal>
<d:href>/remote.php/dav/principals/users/admin/</d:href>
</d:current-user-principal>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
...

@jasonmunro
Copy link
Member

@omocinteractive that was very helpful, thanks for the follow up. Our XML parsing was failing us. I just pushed a fix to the master branch that properly handles this response, and I think it might get the carddav module set working. If you can retest with the latest that would be great. Thanks!

@jasonmunro
Copy link
Member

Preliminary support for add/update/delete of carddav contacts is pushed to master. The edit form only supports a single E-mail, phone number, and display name for now, however the code is smart enough to maintain the other existing fields of the contact on update (they are not lost). Along with this update are a few other contacts related fixes and clean-ups.

@marclaporte
Copy link
Member

CalDAV and CardDAV are not yet supported by Cypht but here is some relevant info:

Tiki Wiki CMS Groupware now bundles Cypht, getting it via Packagist:
https://dev.tiki.org/Cypht-integration
https://packagist.org/packages/jason-munro/cypht

Also, CalDAV and CardDAV support has been added to Tiki via SabreDAV:
https://doc.tiki.org/CalDAV
https://doc.tiki.org/CardDAV
https://doc.tiki.org/SabreDAV
https://packagist.org/packages/sabre/dav (2.7 million installs!)

These additions are quite new so still a little rough around the edges :-) But we are committed to progressively improve the integration, and the components.

Additionally, Jason has gracefully accepted to change the license from GPL to LGPL to facilitate usage by the Tiki community.
#333

This has a nice side-effect that code can easily be shared between the 2 projects. Thus, the Tiki CalDAV/CardDAV code could be ported to Cypht.

These are the big picture goals:
https://dev.tiki.org/Email-as-a-first-class-citizen

We are looking for developers and testers. Please join us:
https://gitter.im/cypht-org/community

Thanks!

@dumblob
Copy link
Member

dumblob commented Apr 29, 2020

Related: #12

@marclaporte
Copy link
Member

Initial support for contacts from a CardDav server (read-only)
https://github.com/jasonmunro/cypht/tree/master/modules/carddav_contacts

@marclaporte
Copy link
Member

https://packagist.org/packages/sabre/dav is now at 6.3 million installs, and would make sense to have read and write CalDAV and CardDAV.

@undergroundwires
Copy link

I've started experimenting with this great project. Looking forward for CalDAV support.

@ElvisAns
Copy link
Member

image 065

Should CardDav have its own page? Or we will have to see its effect as a contact backend?

I am confused about how this integration was made.

@marclaporte
Copy link
Member

Status report on this task:

I understand https://github.com/cypht-org/cypht/tree/master/modules/carddav_contacts is functional (last commit seemed to make user happy)

For https://github.com/cypht-org/cypht/tree/master/modules/calendar some work is needed. Any volunteers?

I use Cypht within Tiki so I'd rather focus my energies there, and have nice features like https://doc.tiki.org/Calendar-Invitations-by-email

And more calendar features are on the way, like more flexible recurrence, and appointment slots.

But I understand and support that some will want a better calendar in standalone Cypht (And I encourage that)

@marclaporte
Copy link
Member

The Tiki calendar is getting: CalDAV scheduling, free-busy, iTip and appointment slots:
https://gitlab.com/tikiwiki/tiki/-/merge_requests/3534

Cypht is well integrated within Tiki (like Roundcube within Kolab)

@marclaporte marclaporte added the help wanted we would love your help label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
calendar calendar module set contacts contacts module set enhancement suggest an improvement help wanted we would love your help new module set requires a new module set
Projects
None yet
Development

No branches or pull requests