static int propfind_calurl(const xmlChar *name, xmlNsPtr ns,
			   struct propfind_ctx *fctx,
			   xmlNodePtr resp __attribute__((unused)),
			   struct propstat propstat[],
			   xmlNodePtr expand,
			   const char *cal)
{
    xmlNodePtr node;

    if (!(namespace_calendar.enabled && fctx->req_tgt->user))
	return HTTP_NOT_FOUND;

    node = xml_add_prop(HTTP_OK, fctx->ns[NS_DAV], &propstat[PROPSTAT_OK],
			name, ns, NULL, 0);

    /* named calendars are only used for scheduling */
    if (cal && !(namespace_calendar.allow & ALLOW_CAL_SCHED))
	return HTTP_NOT_FOUND;

    buf_reset(&fctx->buf);
    buf_printf(&fctx->buf, "%s/user/%.*s/%s", namespace_calendar.prefix,
	       (int) fctx->req_tgt->userlen, fctx->req_tgt->user,
	       cal ? cal : "");

    if (expand) {
	/* Return properties for this URL */
	expand_property(expand, fctx, buf_cstring(&fctx->buf),
			&caldav_parse_path, caldav_props, node, cal ? 1 : 0);

    }
    else {
	/* Return just the URL */
	xml_add_href(node, fctx->ns[NS_DAV], buf_cstring(&fctx->buf));
    }

    return 0;
}
static int propfind_calurl(const xmlChar *name, xmlNsPtr ns,
			   struct propfind_ctx *fctx,
			   xmlNodePtr resp __attribute__((unused)),
			   struct propstat propstat[],
			   xmlNodePtr expand,
			   const char *cal)
{
    xmlNodePtr node;

    if (!(namespace_calendar.enabled && fctx->req_tgt->user))
	return HTTP_NOT_FOUND;

    node = xml_add_prop(HTTP_OK, fctx->ns[NS_DAV], &propstat[PROPSTAT_OK],
			name, ns, NULL, 0);

     
    if (cal && !(namespace_calendar.allow & ALLOW_CAL_SCHED))
	return HTTP_NOT_FOUND;

    buf_reset(&fctx->buf);
    buf_printf(&fctx->buf, "%s/user/%.*s/%s", namespace_calendar.prefix,
	       (int) fctx->req_tgt->userlen, fctx->req_tgt->user,
	       cal ? cal : "");

    if (expand) {
	 
	expand_property(expand, fctx, buf_cstring(&fctx->buf),
			&caldav_parse_path, caldav_props, node, cal ? 1 : 0);

    }
    else {
	 
	xml_add_href(node, fctx->ns[NS_DAV], buf_cstring(&fctx->buf));
    }

    return 0;
}