Mailing List Archive

Problems with external bind
Hi all,


I'm having some trouble setting up a binding to an external calendar (.ics file
served over HTTPS) with Davical 1.1.5 (from jessie-backports).

(This has worked in the past BTW with an older version of Davical (from
jessie) and a manually added external bind.)

Following the [wiki](https://wiki.davical.org/index.php/External_Bind), I set
the refresh interval, and then added the bind via the davical web interface.
The external calendar and a binding show up in the interface, and the calendar
shows up in my caldav client.

## First problem

However, no events show up in the client (even though there are events when
you download the external calendar manually). Also the web interface page on
the external collection states that there are 0 items in the collection.

Looking at the code, I think this happens because `collection.modified` is
NULL, and the query that looks up if the calendar needs to be updated does not
account for that possibility. [https://gitlab.com/davical-project/davical/blob/master/inc/external-fetch.php#L114]

After manually setting `collection.modified` to a date far in the past and
syncing my caldav client, indeed the logs indicate that the external resource
is updated, and Davical's web interface now says that there is a nonzero
number of events in the collection.

So this is solved for now, but I guess this problem will reappear for any new
external bind. Maybe the query just needs an `OR collection.modified IS NULL`?

Also, from the logs it seems that two or more instances of the external
updating function are running at the same time. Maybe my caldav client
accesses the calendar more than once. In one of my tries, I actually got
database constraint violation errors, because duplicate rows were added. Maybe
there needs to be some kind of lock to prevent multiple runs of the external
update at the same time?

## Second problem

Even after fixing the first problem, the caldav client doesn't show any events
in the calendar. The log contains lines like
```
davical: LOG: response:-->The calendar-query report must be run against a
calendar or a scheduling collection
```
I dumped the $dav_resource while doing a `GET /arie/mycalendar/` (that should
be possible, right?):
```
DAVResource::__set_state(array(
'dav_name' => '/arie/my-calendar/',
'exists' => true,
'unique_tag' => '"45da3cf5e83e957506fdbaa77eb3be51"',
'resource' => NULL,
'parent' => NULL,
'resourcetypes' =>
'<DAV::collection/><urn:ietf:params:xml:ns:caldav:calendar/>',
'contenttype' => 'httpd/unix-directory',
'bound_from' => '/.external/c99c6dbc5e8221cd269e576b5f0280e5',
'collection' =>
stdClass::__set_state(array(
'user_no' => 1001,
'parent_container' => '/arie/',
'dav_name' => '/arie/my-calendar/',
'dav_etag' => '45da3cf5e83e957506fdbaa77eb3be51',
'dav_displayname' => 'my-calendar',
'is_calendar' => true,
'created' => '2017-09-03 21:55:36.889685+02',
'modified' => '2017-09-04 10:38:24.194682+02',
'public_events_only' => false,
'publicly_readable' => false,
'collection_id' => '4911',
'default_privileges' => NULL,
'is_addressbook' => false,
'resourcetypes' =>
'<DAV::collection/><urn:ietf:params:xml:ns:caldav:calendar/>',
'schedule_transp' => 'opaque',
'timezone' => NULL,
'description' => '',
'path_privs' => '111111111111111111111111',
'principal_id' => '1001',
'principal_type_id' => '1',
'principal_displayname' => 'Arie',
'principal_default_privileges' => '000000000001111000000000',
'vtimezone' => NULL,
'access_ticket_id' => NULL,
'bind_parent_container' => '/arie/',
'bind_owner_url' => '/arie/',
'bound_to' => '/arie/my-calendar/',
'external_url' => 'https://example.com/calendar.ics',
'external_type' => NULL,
'bind_id' => '4912',
'exists' => true,
'parent_set' => '/.external/',
'bound_from' => '/.external/c99c6dbc5e8221cd269e576b5f0280e5',
'type' => 'collection',
'displayname' => 'my-calendar',
)),
'principal' => NULL,
'privileges' => 49,
'_is_collection' => true,
'_is_principal' => false,
'_is_calendar' => false,
'_is_binding' => true,
'_is_external' => true,
'_is_addressbook' => false,
'_is_proxy_request' => false,
'supported_methods' => NULL,
'supported_reports' => NULL,
'dead_properties' => NULL,
'supported_components' => NULL,
'tickets' => NULL,
'resource_id' => '4911',
'created' => '2017-09-03 21:55:36.889685+02',
'modified' => '2017-09-04 10:38:24.194682+02',
))
```
Apparently it doesn't regard the external bind as a calendar. I'm not sure if
it's the code creating this object that's wrong, or that the
`export_iCalendar` function should check for this situation, or that I'm doing
something wrong entirely.

Any hint appreciated!


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Davical-general mailing list
Davical-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/davical-general