X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fobjects%2FCalDAV%2FCalDAV-XMLProcessing.cpp;h=f84daed735c7b205b64367376b2f9cb761d7d0f0;hb=6e26afc98c0656bbd2ffed756b826d986b97c0bf;hp=38e26c7c84ef9b726ef6613c56402df2191e3f0a;hpb=fb7334af110912e40389f059adcf58c4a289a881;p=xestiacalendar%2F.git diff --git a/source/objects/CalDAV/CalDAV-XMLProcessing.cpp b/source/objects/CalDAV/CalDAV-XMLProcessing.cpp index 38e26c7..f84daed 100644 --- a/source/objects/CalDAV/CalDAV-XMLProcessing.cpp +++ b/source/objects/CalDAV/CalDAV-XMLProcessing.cpp @@ -355,6 +355,76 @@ CalDAVCalendarList CalDAV::ProcessXMLCalendarList(){ } +string CalDAV::ProcessXMLEntryETag(){ + + string EntryETag; + + 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 EntryETag; } else { NodeFound = false; } + NodeFound = MatchXMLNameTransverse(&NodeSeek, "response"); + + // Look for propstat. + + if (NodeFound == false){ return EntryETag; } else { NodeFound = false; } + NodeFound = MatchXMLNameTransverse(&NodeSeek, "propstat"); + + // Look for prop. + + if (NodeFound == false){ return EntryETag; } else { NodeFound = false; } + NodeFound = MatchXMLNameTransverse(&NodeSeek, "prop"); + + // Look for calendar-home-set. + + if (NodeFound == false){ return EntryETag; } else { NodeFound = false; } + NodeFound = MatchXMLNameTransverse(&NodeSeek, "getetag"); + + // Get the data from href. + + EntryETag = FetchXMLData(&NodeSeek); + + xmlFreeDoc(xmlCalDAVDoc); + + // Check if the entity tag contains quote marks + // at the start and end and remove them (if needed). + + if (EntryETag.substr(0,1) == "\"" && + EntryETag.substr(EntryETag.size()-1, 1) == "\"" && EntryETag.size() > 2){ + + EntryETag.erase(EntryETag.begin()); + EntryETag.erase(EntryETag.end()-1); + + } + + return EntryETag; + +} + bool CalDAV::MatchXMLNameTransverse(xmlNodePtr *NodePtr, string NodeName){ string NodeNameSmallD = "d:" + NodeName;