From 2dfb7189efe8e02d37af274b2ec193b5ae058d85 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 6 Mar 2016 10:55:16 +0000 Subject: [PATCH] Added ProcessXMLCalenadrHome to the CalDAV Object. --- .../objects/CalDAV/CalDAV-XMLProcessing.cpp | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/source/objects/CalDAV/CalDAV-XMLProcessing.cpp b/source/objects/CalDAV/CalDAV-XMLProcessing.cpp index 81d4674..1884533 100644 --- a/source/objects/CalDAV/CalDAV-XMLProcessing.cpp +++ b/source/objects/CalDAV/CalDAV-XMLProcessing.cpp @@ -84,6 +84,70 @@ string CalDAV::ProcessXMLUserPrincipal(){ } +string CalDAV::ProcessXMLCalendarHome(){ + + string CalendarHomeURI; + + xmlDocPtr xmlCalDAVDoc; + xmlCalDAVDoc = xmlReadMemory(ServerData.c_str(), (int)ServerData.size(), "noname.xml", NULL, 0); + + xmlNodePtr NodeSeek; + bool NodeFound = false; + + // Start with the first node, look for multistatus. + + for (NodeSeek = xmlCalDAVDoc->children; + NodeSeek != NULL; + NodeSeek = NodeSeek->next) + { + + if (!xmlStrcmp(NodeSeek->name, (const xmlChar *)"multistatus") || + !xmlStrcmp(NodeSeek->name, (const xmlChar *)"d:multistatus") || + !xmlStrcmp(NodeSeek->name, (const xmlChar *)"D:multistatus") + ){ + + NodeFound = true; + break; + + } + + } + + // Look for response. + + if (NodeFound == false){ return CalendarHomeURI; } else { NodeFound = false; } + NodeFound = MatchXMLName(&NodeSeek, "response"); + + // Look for propstat. + + if (NodeFound == false){ return CalendarHomeURI; } else { NodeFound = false; } + NodeFound = MatchXMLName(&NodeSeek, "propstat"); + + // Look for prop. + + if (NodeFound == false){ return CalendarHomeURI; } else { NodeFound = false; } + NodeFound = MatchXMLName(&NodeSeek, "prop"); + + // Look for calendar-home-set. + + if (NodeFound == false){ return CalendarHomeURI; } else { NodeFound = false; } + NodeFound = MatchXMLName(&NodeSeek, "calendar-home-set"); + + // Look for href. + + if (NodeFound == false){ return CalendarHomeURI; } else { NodeFound = false; } + NodeFound = MatchXMLName(&NodeSeek, "href"); + + // Get the data from href. + + CalendarHomeURI = FetchXMLData(&NodeSeek); + + xmlFreeDoc(xmlCalDAVDoc); + + return CalendarHomeURI; + +} + bool CalDAV::MatchXMLName(xmlNodePtr *NodePtr, string NodeName){ string NodeNameSmallD = "d:" + NodeName; -- 2.39.5