]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_calendar_caldav: Add support reading gmail calendar 34/4534/1
authorEduardo S. Libardi <eslibardi@gmail.com>
Tue, 29 Nov 2016 01:43:53 +0000 (23:43 -0200)
committerEduardo Scudeller Libardi <eslibardi@gmail.com>
Wed, 30 Nov 2016 19:16:10 +0000 (14:16 -0500)
The response from gmail calendar includes the string name
"caldav:calendar-data". res_calendar_caldav implements
the example included in RFC 4791: string "C:calendar-data".
When reading the calendar, res_calendar_caldav compare the
string and if does not match just discards the event.
This commit compares the response to both strings,
successfully loading gmail calendar events.
Writing to gmail calendar is working prior to this fix.

ASTERISK-26624
Reported by: Eduardo S. Libardi

Change-Id: Ia1eef10552ae616efb645d390f5ffe81260d7d4a

res/res_calendar_caldav.c

index a8eac7c20cc3d9eb8026fa68116e1ed146359a89..6b4f9082e6e9b01a67a418c004bbc333c151578c 100644 (file)
@@ -482,7 +482,7 @@ static void handle_start_element(void *data, const xmlChar *fullname, const xmlC
 {
        struct xmlstate *state = data;
 
-       if (!xmlStrcasecmp(fullname, BAD_CAST "C:calendar-data")) {
+       if (!xmlStrcasecmp(fullname, BAD_CAST "C:calendar-data") || !xmlStrcasecmp(fullname, BAD_CAST "caldav:calendar-data")) {
                state->in_caldata = 1;
                ast_str_reset(state->cdata);
        }
@@ -496,7 +496,7 @@ static void handle_end_element(void *data, const xmlChar *name)
        icalcomponent *iter;
        icalcomponent *comp;
 
-       if (xmlStrcasecmp(name, BAD_CAST "C:calendar-data")) {
+       if (xmlStrcasecmp(name, BAD_CAST "C:calendar-data") && xmlStrcasecmp(name, BAD_CAST "caldav:calendar-data")) {
                return;
        }