cypht-org / cypht

Cypht: Lightweight Open Source webmail aggregator [PHP, JS]
http://cypht.org
GNU Lesser General Public License v2.1
977 stars 153 forks source link

CardDAV and CalDAV Support #120

Open chlarsen opened 7 years ago

chlarsen commented 7 years ago

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 commented 7 years ago

I will look into it. Thanks for the suggestion!

dhuyvetter commented 7 years ago

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

NodokaMurmevent commented 7 years ago

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

chlarsen commented 7 years ago

As there is already a integration of GMail contacts, this may be not all too painful to achieve. And, yes, Cypht is coming in leaps and bounds - thanks Jason! C.

conspacer commented 7 years ago

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

renaudallard commented 7 years ago

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 commented 7 years ago

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

Yamakasi commented 6 years ago

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 commented 5 years ago

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

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 commented 5 years ago

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 commented 5 years ago

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

jasonmunro commented 5 years ago

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

omocinteractive commented 5 years ago

image 065

jasonmunro commented 5 years ago

@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 commented 5 years ago

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

jasonmunro commented 5 years ago

@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 commented 5 years ago

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

jasonmunro commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

... 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 commented 5 years ago

[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: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 commented 5 years ago

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

jasonmunro commented 5 years ago

@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 commented 5 years ago

<?xml version="1.0"?>

/remote.php/dav/addressbooks/users/admin/default/ /remote.php/dav/principals/users/admin/ HTTP/1.1 200 OK /remote.php/dav/addressbooks/users/admin/default/C71ABC0D-0D80-1001-51CF-1CDB11301831.vcf /remote.php/dav/principals/users/admin/ HTTP/1.1 200 OK ...
jasonmunro commented 5 years ago

@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 commented 5 years ago

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 commented 4 years ago

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. https://github.com/jasonmunro/cypht/issues/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 commented 4 years ago

Related: https://github.com/jasonmunro/cypht/issues/12

marclaporte commented 2 years ago

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

marclaporte commented 2 years ago

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 commented 1 year ago

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

ElvisAns commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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)