Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added code and unit tests for deleting entries in the CalDAV object
[xestiacalendar/.git] / source / objects / CalDAV / CalDAV-XMLProcessing.cpp
index 38e26c7..f84daed 100644 (file)
@@ -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;
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy