Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
0018ebf6484bde2e8e73dd4b08c750350ac6ea6f
[xestiacalendar/.git] / source / objects / CalDAV / CalDAV-XMLProcessing.cpp
1 // CalDAV-XMLProcessing.cpp - CalDAV Connection Object - XML Processing.
2 //
3 // (c) 2016-2017 Xestia Software Development.
4 //
5 // This file is part of Xestia Calendar.
6 //
7 // Xestia Calendar is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
10 //
11 // Xestia Calendar is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
19 #include "CalDAV.h"
21 using namespace std;
22  
23 string CalDAV::ProcessXMLUserPrincipal(){
25         string UserPrincipalURI;
26         
27         xmlDocPtr xmlCalDAVDoc;
28         xmlCalDAVDoc = xmlReadMemory(ServerData.c_str(), (int)ServerData.size(), "noname.xml", NULL, 0);
30         xmlNodePtr NodeSeek;
31         bool NodeFound = false;
32         
33         // Start with the first node, look for multistatus.
34         
35         for (NodeSeek = xmlCalDAVDoc->children;
36                 NodeSeek != NULL;
37                 NodeSeek = NodeSeek->next)
38         {
39         
40                 if (!xmlStrcmp(NodeSeek->name, (const xmlChar *)"multistatus") ||
41                         !xmlStrcmp(NodeSeek->name, (const xmlChar *)"d:multistatus") ||
42                         !xmlStrcmp(NodeSeek->name, (const xmlChar *)"D:multistatus")
43                 ){
44                         
45                         NodeFound = true;
46                         break;
47                         
48                 }
49                 
50         }
51         
52         if (NodeFound == false){
53         
54                 return UserPrincipalURI;
56         }
57         
58         // Look for response.
60         if (NodeFound == false){ return UserPrincipalURI; } else { NodeFound = false; }
61         NodeFound = MatchXMLNameTransverse(&NodeSeek, "response");
63         // Look for propstat.
64         
65         if (NodeFound == false){ return UserPrincipalURI; } else { NodeFound = false; }
66         NodeFound = MatchXMLNameTransverse(&NodeSeek, "propstat");
68         // Look for prop.
69         
70         if (NodeFound == false){ return UserPrincipalURI; } else { NodeFound = false; }
71         NodeFound = MatchXMLNameTransverse(&NodeSeek, "prop");
72         
73         // Look for current-user-principal.
74         
75         if (NodeFound == false){ return UserPrincipalURI; } else { NodeFound = false; }
76         NodeFound = MatchXMLNameTransverse(&NodeSeek, "current-user-principal");
77         
78         // Look for href.       
79         
80         if (NodeFound == false){ return UserPrincipalURI; } else { NodeFound = false; }
81         NodeFound = MatchXMLNameTransverse(&NodeSeek, "href");
83         // Get the data from href.
84         
85         UserPrincipalURI = FetchXMLData(&NodeSeek);
86         
87         xmlFreeDoc(xmlCalDAVDoc);
88         
89         return UserPrincipalURI;
90         
91 }
93 string CalDAV::ProcessXMLCalendarHome(){
95         string CalendarHomeURI;
96         
97         xmlDocPtr xmlCalDAVDoc;
98         xmlCalDAVDoc = xmlReadMemory(ServerData.c_str(), (int)ServerData.size(), "noname.xml", NULL, 0);
100         xmlNodePtr NodeSeek;
101         bool NodeFound = false;
102         
103         // Start with the first node, look for multistatus.
104         
105         for (NodeSeek = xmlCalDAVDoc->children;
106                 NodeSeek != NULL;
107                 NodeSeek = NodeSeek->next)
108         {
109         
110                 if (!xmlStrcmp(NodeSeek->name, (const xmlChar *)"multistatus") ||
111                         !xmlStrcmp(NodeSeek->name, (const xmlChar *)"d:multistatus") ||
112                         !xmlStrcmp(NodeSeek->name, (const xmlChar *)"D:multistatus")
113                 ){
114                         
115                         NodeFound = true;
116                         break;
117                         
118                 }
119                 
120         }
121         
122         if (NodeFound == false){
123         
124                 return CalendarHomeURI;
126         }
127         
128         // Look for response.
130         if (NodeFound == false){ return CalendarHomeURI; } else { NodeFound = false; }
131         NodeFound = MatchXMLNameTransverse(&NodeSeek, "response");
133         // Look for propstat.
134         
135         if (NodeFound == false){ return CalendarHomeURI; } else { NodeFound = false; }
136         NodeFound = MatchXMLNameTransverse(&NodeSeek, "propstat");
138         // Look for prop.
139         
140         if (NodeFound == false){ return CalendarHomeURI; } else { NodeFound = false; }
141         NodeFound = MatchXMLNameTransverse(&NodeSeek, "prop");
142         
143         // Look for calendar-home-set.
144         
145         if (NodeFound == false){ return CalendarHomeURI; } else { NodeFound = false; }
146         NodeFound = MatchXMLNameTransverse(&NodeSeek, "calendar-home-set");
147         
148         // Look for href.       
149         
150         if (NodeFound == false){ return CalendarHomeURI; } else { NodeFound = false; }
151         NodeFound = MatchXMLNameTransverse(&NodeSeek, "href");
153         // Get the data from href.
154         
155         CalendarHomeURI = FetchXMLData(&NodeSeek);
156         
157         xmlFreeDoc(xmlCalDAVDoc);
158         
159         return CalendarHomeURI;
160         
163 CalDAVCalendarList CalDAV::ProcessXMLCalendarList(){
164         
165         CalDAVCalendarList CalendarList;
166         
167         xmlDocPtr xmlCalDAVDoc;
168         xmlCalDAVDoc = xmlReadMemory(ServerData.c_str(), (int)ServerData.size(), "noname.xml", NULL, 0);
170         xmlNodePtr NodeSeek = NULL;
171         xmlNodePtr NodeResponse = NULL;
172         xmlNodePtr NodeMatch = NULL;
173         xmlNodePtr NodeData = NULL;
174         bool NodeFound = false;
175         int ResponseCount = 0;
176         
177         // Start with the first node, look for multistatus.
178         
179         for (NodeSeek = xmlCalDAVDoc->children;
180                 NodeSeek != NULL;
181                 NodeSeek = NodeSeek->next)
182         {
183         
184                 if (!xmlStrcmp(NodeSeek->name, (const xmlChar *)"multistatus") ||
185                         !xmlStrcmp(NodeSeek->name, (const xmlChar *)"d:multistatus") ||
186                         !xmlStrcmp(NodeSeek->name, (const xmlChar *)"D:multistatus")
187                 ){
188                 
189                         NodeResponse = NodeSeek->children;      
190                         NodeFound = true;
191                         break;
192                         
193                 }
194                 
195         }
196         
197         if (NodeFound == false){
198         
199                 return CalendarList;
201         }
202         
203         for (NodeResponse = NodeSeek->children;
204                 NodeResponse != nullptr;
205                 NodeResponse = NodeResponse->next)
206         {
207         
208                 // Go through each of the responses and find the calendars.
210                 NodeMatch = xmlCopyNode(NodeResponse, 1);
211                 
212                 if (MatchXMLName(&NodeMatch, "response")){
214                         NodeData = xmlCopyNode(NodeMatch, 1);
215                         
216                         // Check the resource type is a calendar.
217                         
218                         if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; }
219                         if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; }
220                         if (!MatchXMLNameTransverse(&NodeData, "resourcetype")){ continue; }                    
221                         if (!MatchXMLNameTransverse(&NodeData, "calendar")){ continue; }
222                         
223                         // Get the HREF.
224                         
225                         NodeData = xmlCopyNode(NodeMatch, 1);
226                         
227                         if (!MatchXMLNameTransverse(&NodeData, "href")){ continue; }
228                                                 
229                         string HREFAddress = FetchXMLData(&NodeData);
230                         
231                         // Get the calendar name.
233                         NodeData = xmlCopyNode(NodeMatch, 1);
234                         
235                         if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; }
236                         if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; }
237                         if (!MatchXMLNameTransverse(&NodeData, "displayname")){ continue; }
238                         
239                         string CalendarName = FetchXMLData(&NodeData);
240                         
241                         // Get the calendar description.
242                         
243                         NodeData = xmlCopyNode(NodeMatch, 1);
244                         
245                         string CalendarDescription = "";
246                         
247                         if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; }
248                         if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; }
249                         if (MatchXMLNameTransverse(&NodeData, "calendar-description")){ 
250                         
251                                 CalendarDescription = FetchXMLData(&NodeData);
252                                 
253                         }
254                         
255                         // Get the calendar colour.
256                         
257                         NodeData = xmlCopyNode(NodeMatch, 1);
259                         Colour CalendarColour;
260                         bool ColourResult = false;
261                         
262                         if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; }
263                         if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; }
264                         if (MatchXMLNameTransverse(&NodeData, "calendar-color")){ 
265                         
266                                 string CalendarColourString = "";
267                                 string CalendarColourHexValue = "";
268                                 int ColourNumber;
269                                 bool KeepRunning = true;
270                                 
271                                 CalendarColourString = FetchXMLData(&NodeData);
272                                 
273                                 while(KeepRunning == true){
274                                 
275                                         if (CalendarColourString.substr(0,1) == "#" && CalendarColourString.length() == 9){
276                                                 
277                                                 // Get the red colour.
278                                                 
279                                                 CalendarColourHexValue = CalendarColourString.substr(1,2);
280                                                 if (!HexToInt(&CalendarColourHexValue, &ColourNumber)){ break; }
281                                                 CalendarColour.red = ColourNumber;
282                                                 
283                                                 // Get the green colour.
285                                                 CalendarColourHexValue = CalendarColourString.substr(3,2);
286                                                 if (!HexToInt(&CalendarColourHexValue, &ColourNumber)){ break; }
287                                                 CalendarColour.green = ColourNumber;
288                                                 
289                                                 // Get the blue colour.
290                                                 
291                                                 CalendarColourHexValue = CalendarColourString.substr(5,2);
292                                                 if (!HexToInt(&CalendarColourHexValue, &ColourNumber)){ break; };
293                                                 CalendarColour.blue = ColourNumber;
294                                                 
295                                                 // Get the alpha.
297                                                 CalendarColourHexValue = CalendarColourString.substr(7,2);
298                                                 if (!HexToInt(&CalendarColourHexValue, &ColourNumber)){ break; };
299                                                 CalendarColour.alpha = ColourNumber;
300                                                 
301                                                 ColourResult = true;
302                                                 
303                                         } else {
305                                                 ColourResult = false;
306                                         
307                                         }
308                                         
309                                         break;
310                                         
311                                 }
312                                 
313                         }
314                         
315                         if (ColourResult == false){
316                                         
317                                         CalendarColour.red = 0;
318                                         CalendarColour.blue = 0;
319                                         CalendarColour.green = 0;
320                                         CalendarColour.alpha = 0;
321                                         
322                         }
323                         
324                         // Get the calendar order.
326                         NodeData = xmlCopyNode(NodeMatch, 1);
327                         
328                         int CalendarOrder = 0;
329                         
330                         if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; }
331                         if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; }
332                         if (MatchXMLNameTransverse(&NodeData, "calendar-order")){
333                                 
334                                 string CalendarOrderString = FetchXMLData(&NodeData);
335                                 if (!HexToInt(&CalendarOrderString, &CalendarOrder)){
336                                         CalendarOrder = 0;
337                                 }
338                                 
339                         }
340                         
341                         // Get the calendar tag.
342                         
343                         NodeData = xmlCopyNode(NodeMatch, 1);
344                         
345                         string CalendarTag = "";
346                         
347                         if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; }
348                         if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; }
349                         if (MatchXMLNameTransverse(&NodeData, "getctag")){ 
350                                 
351                                 CalendarTag = FetchXMLData(&NodeData);
352                                 
353                         }
354                         
355                         // Get the calendar tag URL.
356                         
357                         NodeData = xmlCopyNode(NodeMatch, 1);
358                         
359                         string CalendarTagURL = "";
360                         
361                         if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; }
362                         if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; }
363                         if (MatchXMLNameTransverse(&NodeData, "sync-token")){ 
364                                 
365                                 CalendarTagURL = FetchXMLData(&NodeData);
366                                 
367                         }
368                         
369                         // Insert the calendar information into the
370                         // list if all the information is there.
371                         
372                         CalendarList.Name.insert(make_pair(ResponseCount, CalendarName));
373                         CalendarList.Description.insert(make_pair(ResponseCount, CalendarDescription));
374                         CalendarList.HREF.insert(make_pair(ResponseCount, HREFAddress));
375                         CalendarList.CalColour.insert(make_pair(ResponseCount, CalendarColour));
376                         CalendarList.Order.insert(make_pair(ResponseCount, CalendarOrder));
377                         CalendarList.Tag.insert(make_pair(ResponseCount, CalendarTag));
378                         CalendarList.TagURL.insert(make_pair(ResponseCount, CalendarTagURL));
379                         
380                         ResponseCount++;
381                         
382                 }
383                 
384         }
385         
386         xmlFreeDoc(xmlCalDAVDoc);
387         
388         return CalendarList;
389         
392 string CalDAV::ProcessXMLEntryETag(){
393         
394         string EntryETag;
395         
396         xmlDocPtr xmlCalDAVDoc;
397         xmlCalDAVDoc = xmlReadMemory(ServerData.c_str(), (int)ServerData.size(), "noname.xml", NULL, 0);
399         xmlNodePtr NodeSeek;
400         bool NodeFound = false;
401         
402         // Start with the first node, look for multistatus.
403         
404         for (NodeSeek = xmlCalDAVDoc->children;
405                 NodeSeek != NULL;
406                 NodeSeek = NodeSeek->next)
407         {
408         
409                 if (!xmlStrcmp(NodeSeek->name, (const xmlChar *)"multistatus") ||
410                         !xmlStrcmp(NodeSeek->name, (const xmlChar *)"d:multistatus") ||
411                         !xmlStrcmp(NodeSeek->name, (const xmlChar *)"D:multistatus")
412                 ){
413                         
414                         NodeFound = true;
415                         break;
416                         
417                 }
418                 
419         }
420         
421         if (NodeFound == false){
422         
423                 return EntryETag;
425         }
426         
427         // Look for response.
428         
429         if (NodeFound == false){ return EntryETag; } else { NodeFound = false; }
430         NodeFound = MatchXMLNameTransverse(&NodeSeek, "response");
432         // Look for propstat.
433         
434         if (NodeFound == false){ return EntryETag; } else { NodeFound = false; }
435         NodeFound = MatchXMLNameTransverse(&NodeSeek, "propstat");
437         // Look for prop.
438         
439         if (NodeFound == false){ return EntryETag; } else { NodeFound = false; }
440         NodeFound = MatchXMLNameTransverse(&NodeSeek, "prop");
441         
442         // Look for calendar-home-set.
443         
444         if (NodeFound == false){ return EntryETag; } else { NodeFound = false; }
445         NodeFound = MatchXMLNameTransverse(&NodeSeek, "getetag");
447         // Get the data from href.
448         
449         EntryETag = FetchXMLData(&NodeSeek);    
450         
451         xmlFreeDoc(xmlCalDAVDoc);       
452         
453         // Check if the entity tag contains quote marks
454         // at the start and end and remove them (if needed).
455         
456         if (EntryETag.substr(0,1) == "\"" && 
457                 EntryETag.substr(EntryETag.size()-1, 1) == "\"" && EntryETag.size() > 2){
458                 
459                 EntryETag.erase(EntryETag.begin());
460                 EntryETag.erase(EntryETag.end()-1);
461                         
462         }
463         
464         return EntryETag;
465         
468 CalDAVEntryList CalDAV::ProcessXMLEntryList(){
470         CalDAVEntryList EntryList;
471         
472         xmlDocPtr xmlCalDAVDoc;
473         xmlCalDAVDoc = xmlReadMemory(ServerData.c_str(), (int)ServerData.size(), "noname.xml", NULL, 0);
475         xmlNodePtr NodeSeek = NULL;
476         xmlNodePtr NodeResponse = NULL;
477         xmlNodePtr NodeMatch = NULL;
478         xmlNodePtr NodeData = NULL;
479         bool NodeFound = false;
480         int ResponseCount = 0;
481         
482         // Start with the first node, look for multistatus.
483         
484         for (NodeSeek = xmlCalDAVDoc->children;
485                 NodeSeek != NULL;
486                 NodeSeek = NodeSeek->next)
487         {
488         
489                 if (!xmlStrcmp(NodeSeek->name, (const xmlChar *)"multistatus") ||
490                         !xmlStrcmp(NodeSeek->name, (const xmlChar *)"d:multistatus") ||
491                         !xmlStrcmp(NodeSeek->name, (const xmlChar *)"D:multistatus")
492                 ){
493                 
494                         NodeResponse = NodeSeek->children;      
495                         NodeFound = true;
496                         break;
497                         
498                 }
499                 
500         }
501         
502         if (NodeFound == false){
503         
504                 return EntryList;
506         }
507         
508         for (NodeResponse = NodeSeek->children;
509                 NodeResponse != nullptr;
510                 NodeResponse = NodeResponse->next)
511         {
512         
513                 // Go through each of the responses and find the calendars.
515                 NodeMatch = xmlCopyNode(NodeResponse, 1);
516                 
517                 if (MatchXMLName(&NodeMatch, "response")){
519                         NodeData = xmlCopyNode(NodeMatch, 1);
520                         
521                         // Get the HREF.
522                         
523                         NodeData = xmlCopyNode(NodeMatch, 1);
524                         
525                         if (!MatchXMLNameTransverse(&NodeData, "href")){ continue; }
526                                                 
527                         string HREFAddress = FetchXMLData(&NodeData);
528                         
529                         // Get the calendar data.
530                         
531                         NodeData = xmlCopyNode(NodeMatch, 1);
532                         
533                         string EntryDescription = "";
534                         
535                         if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; }
536                         if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; }
537                         if (MatchXMLNameTransverse(&NodeData, "calendar-data")){ 
538                         
539                                 // Note: libxml2 will strip the CDATA part at the start and
540                                 // end of each calendar-data section.
541                                 
542                                 EntryDescription = FetchXMLData(&NodeData);
543                                 
544                         }
545                         
546                         // Get the entry entity tag.
547                         
548                         NodeData = xmlCopyNode(NodeMatch, 1);
549                         
550                         string EntryEntityTag = "";
551                         
552                         if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; }
553                         if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; }
554                         if (MatchXMLNameTransverse(&NodeData, "getetag")){ 
555                                 
556                                 EntryEntityTag = FetchXMLData(&NodeData);
557                                 
558                         }
559                         
560                         // Insert the calendar information into the
561                         // list if all the information is there.
562                         
563                         EntryList.HREF.insert(make_pair(ResponseCount, HREFAddress));
564                         EntryList.Data.insert(make_pair(ResponseCount, EntryDescription));
565                         EntryList.Tag.insert(make_pair(ResponseCount, EntryEntityTag));
566                         
567                         ResponseCount++;
568                         
569                 }
570                 
571         }
572         
573         xmlFreeDoc(xmlCalDAVDoc);
574         
575         return EntryList;
576         
579 CalDAVEntryList CalDAV::ProcessXMLSyncTokenList(){
581         CalDAVEntryList EntryList;
582         
583         xmlDocPtr xmlCalDAVDoc;
584         xmlCalDAVDoc = xmlReadMemory(ServerData.c_str(), (int)ServerData.size(), "noname.xml", NULL, 0);
586         xmlNodePtr NodeSeek = NULL;
587         xmlNodePtr NodeResponse = NULL;
588         xmlNodePtr NodeMatch = NULL;
589         xmlNodePtr NodeData = NULL;
590         bool NodeFound = false;
591         int ResponseCount = 0;
592         
593         // Start with the first node, look for multistatus.
594         
595         for (NodeSeek = xmlCalDAVDoc->children;
596                 NodeSeek != NULL;
597                 NodeSeek = NodeSeek->next)
598         {
599         
600                 if (!xmlStrcmp(NodeSeek->name, (const xmlChar *)"multistatus") ||
601                         !xmlStrcmp(NodeSeek->name, (const xmlChar *)"d:multistatus") ||
602                         !xmlStrcmp(NodeSeek->name, (const xmlChar *)"D:multistatus")
603                 ){
604                 
605                         NodeResponse = NodeSeek->children;      
606                         NodeFound = true;
607                         break;
608                         
609                 }
610                 
611         }
612         
613         if (NodeFound == false){
614         
615                 return EntryList;
617         }
618         
619         for (NodeResponse = NodeSeek->children;
620                 NodeResponse != nullptr;
621                 NodeResponse = NodeResponse->next)
622         {
623         
624                 // Go through each of the responses and find the calendars.
626                 NodeMatch = xmlCopyNode(NodeResponse, 1);
627                 
628                 if (MatchXMLName(&NodeMatch, "response")){
630                         NodeData = xmlCopyNode(NodeMatch, 1);
631                         
632                         // Get the HREF.
633                         
634                         NodeData = xmlCopyNode(NodeMatch, 1);
635                         
636                         if (!MatchXMLNameTransverse(&NodeData, "href")){ continue; }
637                                                 
638                         string HREFAddress = FetchXMLData(&NodeData);
639                         
640                         // Get the entry entity tag.
641                         
642                         NodeData = xmlCopyNode(NodeMatch, 1);
643                         
644                         string EntryEntityTag = "";
645                         
646                         if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; }
647                         if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; }
648                         if (MatchXMLNameTransverse(&NodeData, "getetag")){ 
649                                 
650                                 EntryEntityTag = FetchXMLData(&NodeData);
651                                 
652                         }
653                         
654                         // Insert the calendar information into the
655                         // list if all the information is there.
656                         
657                         EntryList.HREF.insert(make_pair(ResponseCount, HREFAddress));
658                         EntryList.Data.insert(make_pair(ResponseCount, ""));
659                         EntryList.Tag.insert(make_pair(ResponseCount, EntryEntityTag));
660                         
661                         ResponseCount++;
662                         
663                 }
664                 
665         }
666         
667         xmlFreeDoc(xmlCalDAVDoc);
668         
669         return EntryList;
670         
673 bool CalDAV::MatchXMLNameTransverse(xmlNodePtr *NodePtr, string NodeName){
675         string NodeNameSmallD = "d:" + NodeName;
676         string NodeNameLargeD = "D:" + NodeName;
677         
678         for ((*NodePtr) = (*NodePtr)->children;
679                 (*NodePtr) != NULL;
680                 (*NodePtr) = (*NodePtr)->next)
681         {
682         
683                 if (!xmlStrcmp((*NodePtr)->name, (const xmlChar *)NodeName.c_str()) ||
684                         !xmlStrcmp((*NodePtr)->name, (const xmlChar *)NodeNameSmallD.c_str()) ||
685                         !xmlStrcmp((*NodePtr)->name, (const xmlChar *)NodeNameLargeD.c_str())
686                 ){
687                         
688                         return true;
689                         
690                 }
691                 
692         }
693         
694         return false;
695         
698 bool CalDAV::MatchXMLName(xmlNodePtr *NodePtrOriginal, string NodeName){
700         if (NodePtrOriginal == nullptr){
701                 
702                 return false;
703                 
704         }
705         
706         string NodeNameSmallD = "d:" + NodeName;
707         string NodeNameLargeD = "D:" + NodeName;
708         
709         xmlNodePtr *NodePtr = NodePtrOriginal;
710         
711         if (!xmlStrcmp((*NodePtr)->name, (const xmlChar *)NodeName.c_str()) ||
712                 !xmlStrcmp((*NodePtr)->name, (const xmlChar *)NodeNameSmallD.c_str()) ||
713                 !xmlStrcmp((*NodePtr)->name, (const xmlChar *)NodeNameLargeD.c_str())
714         ){
715                         
716                 return true;
717                         
718         } else {
719                         
720                 return false;
721                 
722         }
723         
724         return false;
725         
728 string CalDAV::FetchXMLData(xmlNodePtr *NodePtr){
730         for ((*NodePtr) = (*NodePtr)->children;
731                 (*NodePtr) != NULL;
732                 (*NodePtr) = (*NodePtr)->next)
733         {
734                                                                 
735                 return (const char*)(*NodePtr)->content;
736                         
737         }
738         
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