diff options
author | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-10-15 06:48:17 +0000 |
---|---|---|
committer | twilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-10-15 06:48:17 +0000 |
commit | 6d59c9cda06527d91b85eb07b1c9cea18be06d7f (patch) | |
tree | c480f736a2cc0f0089d30cfffb6c77d024cba7b5 /res/res_calendar_caldav.c | |
parent | 4df640512082c9fd0f755cc4b182939a14e57b93 (diff) |
Properly handle PUT requests for CALENDAR_WRITE()
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@224109 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_calendar_caldav.c')
-rw-r--r-- | res/res_calendar_caldav.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/res/res_calendar_caldav.c b/res/res_calendar_caldav.c index 5294c0937..d1dcbeb4b 100644 --- a/res/res_calendar_caldav.c +++ b/res/res_calendar_caldav.c @@ -155,7 +155,9 @@ static struct ast_str *caldav_request(struct caldav_pvt *pvt, const char *method ne_request_destroy(req); if (ret != NE_OK || !ast_str_strlen(response)) { - ast_log(LOG_WARNING, "Unknown response to CalDAV calendar %s, request %s to %s: %s\n", pvt->owner->name, method, pvt->url, ne_get_error(pvt->session)); + if (ret != NE_OK) { + ast_log(LOG_WARNING, "Unknown response to CalDAV calendar %s, request %s to %s: %s\n", pvt->owner->name, method, buf, ne_get_error(pvt->session)); + } ast_free(response); return NULL; } @@ -165,6 +167,7 @@ static struct ast_str *caldav_request(struct caldav_pvt *pvt, const char *method static int caldav_write_event(struct ast_calendar_event *event) { + struct caldav_pvt *pvt; struct ast_str *body = NULL, *response = NULL, *subdir = NULL; icalcomponent *calendar, *icalevent; icaltimezone *utc = icaltimezone_get_utc_timezone(); @@ -186,6 +189,8 @@ static int caldav_write_event(struct ast_calendar_event *event) goto write_cleanup; } + pvt = event->owner->tech_pvt; + if (ast_strlen_zero(event->uid)) { unsigned short val[8]; int x; @@ -233,9 +238,9 @@ static int caldav_write_event(struct ast_calendar_event *event) icalcomponent_add_component(calendar, icalevent); ast_str_append(&body, 0, "%s", icalcomponent_as_ical_string(calendar)); - ast_str_set(&subdir, 0, "%s%s.ics", ast_str_buffer(body)[ast_str_strlen(body)] == '/' ? "" : "/", event->uid); + ast_str_set(&subdir, 0, "%s%s.ics", pvt->url[strlen(pvt->url) - 1] == '/' ? "" : "/", event->uid); - response = caldav_request(event->owner->tech_pvt, "PUT", body, subdir, "text/calendar"); + response = caldav_request(pvt, "PUT", body, subdir, "text/calendar"); ret = 0; |