From: Steve Brokenshire Date: Wed, 25 Jan 2017 23:30:42 +0000 (+0000) Subject: camelCase: Converted code in CalDAV directory X-Git-Tag: release-0.02~11 X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=commitdiff_plain;h=9bb29a2ad6d50014c8bb9b54cb40c8efb1ec75e9 camelCase: Converted code in CalDAV directory --- diff --git a/source/objects/CalDAV/CalDAV-XMLProcessing.cpp b/source/objects/CalDAV/CalDAV-XMLProcessing.cpp index 0018ebf..042750d 100644 --- a/source/objects/CalDAV/CalDAV-XMLProcessing.cpp +++ b/source/objects/CalDAV/CalDAV-XMLProcessing.cpp @@ -22,287 +22,287 @@ using namespace std; string CalDAV::ProcessXMLUserPrincipal(){ - string UserPrincipalURI; + string userPrincipalURI; xmlDocPtr xmlCalDAVDoc; - xmlCalDAVDoc = xmlReadMemory(ServerData.c_str(), (int)ServerData.size(), "noname.xml", NULL, 0); + xmlCalDAVDoc = xmlReadMemory(serverData.c_str(), (int)serverData.size(), "noname.xml", NULL, 0); - xmlNodePtr NodeSeek; - bool NodeFound = false; + xmlNodePtr nodeSeek; + bool nodeFound = false; // Start with the first node, look for multistatus. - for (NodeSeek = xmlCalDAVDoc->children; - NodeSeek != NULL; - NodeSeek = NodeSeek->next) + 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") + if (!xmlStrcmp(nodeSeek->name, (const xmlChar *)"multistatus") || + !xmlStrcmp(nodeSeek->name, (const xmlChar *)"d:multistatus") || + !xmlStrcmp(nodeSeek->name, (const xmlChar *)"D:multistatus") ){ - NodeFound = true; + nodeFound = true; break; } } - if (NodeFound == false){ + if (nodeFound == false){ - return UserPrincipalURI; + return userPrincipalURI; } // Look for response. - if (NodeFound == false){ return UserPrincipalURI; } else { NodeFound = false; } - NodeFound = MatchXMLNameTransverse(&NodeSeek, "response"); + if (nodeFound == false){ return userPrincipalURI; } else { nodeFound = false; } + nodeFound = MatchXMLNameTransverse(&nodeSeek, "response"); // Look for propstat. - if (NodeFound == false){ return UserPrincipalURI; } else { NodeFound = false; } - NodeFound = MatchXMLNameTransverse(&NodeSeek, "propstat"); + if (nodeFound == false){ return userPrincipalURI; } else { nodeFound = false; } + nodeFound = MatchXMLNameTransverse(&nodeSeek, "propstat"); // Look for prop. - if (NodeFound == false){ return UserPrincipalURI; } else { NodeFound = false; } - NodeFound = MatchXMLNameTransverse(&NodeSeek, "prop"); + if (nodeFound == false){ return userPrincipalURI; } else { nodeFound = false; } + nodeFound = MatchXMLNameTransverse(&nodeSeek, "prop"); // Look for current-user-principal. - if (NodeFound == false){ return UserPrincipalURI; } else { NodeFound = false; } - NodeFound = MatchXMLNameTransverse(&NodeSeek, "current-user-principal"); + if (nodeFound == false){ return userPrincipalURI; } else { nodeFound = false; } + nodeFound = MatchXMLNameTransverse(&nodeSeek, "current-user-principal"); // Look for href. - if (NodeFound == false){ return UserPrincipalURI; } else { NodeFound = false; } - NodeFound = MatchXMLNameTransverse(&NodeSeek, "href"); + if (nodeFound == false){ return userPrincipalURI; } else { nodeFound = false; } + nodeFound = MatchXMLNameTransverse(&nodeSeek, "href"); // Get the data from href. - UserPrincipalURI = FetchXMLData(&NodeSeek); + userPrincipalURI = FetchXMLData(&nodeSeek); xmlFreeDoc(xmlCalDAVDoc); - return UserPrincipalURI; + return userPrincipalURI; } string CalDAV::ProcessXMLCalendarHome(){ - string CalendarHomeURI; + string calendarHomeURI; xmlDocPtr xmlCalDAVDoc; - xmlCalDAVDoc = xmlReadMemory(ServerData.c_str(), (int)ServerData.size(), "noname.xml", NULL, 0); + xmlCalDAVDoc = xmlReadMemory(serverData.c_str(), (int)serverData.size(), "noname.xml", NULL, 0); - xmlNodePtr NodeSeek; - bool NodeFound = false; + xmlNodePtr nodeSeek; + bool nodeFound = false; // Start with the first node, look for multistatus. - for (NodeSeek = xmlCalDAVDoc->children; - NodeSeek != NULL; - NodeSeek = NodeSeek->next) + 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") + if (!xmlStrcmp(nodeSeek->name, (const xmlChar *)"multistatus") || + !xmlStrcmp(nodeSeek->name, (const xmlChar *)"d:multistatus") || + !xmlStrcmp(nodeSeek->name, (const xmlChar *)"D:multistatus") ){ - NodeFound = true; + nodeFound = true; break; } } - if (NodeFound == false){ + if (nodeFound == false){ - return CalendarHomeURI; + return calendarHomeURI; } // Look for response. - if (NodeFound == false){ return CalendarHomeURI; } else { NodeFound = false; } - NodeFound = MatchXMLNameTransverse(&NodeSeek, "response"); + if (nodeFound == false){ return calendarHomeURI; } else { nodeFound = false; } + nodeFound = MatchXMLNameTransverse(&nodeSeek, "response"); // Look for propstat. - if (NodeFound == false){ return CalendarHomeURI; } else { NodeFound = false; } - NodeFound = MatchXMLNameTransverse(&NodeSeek, "propstat"); + if (nodeFound == false){ return calendarHomeURI; } else { nodeFound = false; } + nodeFound = MatchXMLNameTransverse(&nodeSeek, "propstat"); // Look for prop. - if (NodeFound == false){ return CalendarHomeURI; } else { NodeFound = false; } - NodeFound = MatchXMLNameTransverse(&NodeSeek, "prop"); + if (nodeFound == false){ return calendarHomeURI; } else { nodeFound = false; } + nodeFound = MatchXMLNameTransverse(&nodeSeek, "prop"); // Look for calendar-home-set. - if (NodeFound == false){ return CalendarHomeURI; } else { NodeFound = false; } - NodeFound = MatchXMLNameTransverse(&NodeSeek, "calendar-home-set"); + if (nodeFound == false){ return calendarHomeURI; } else { nodeFound = false; } + nodeFound = MatchXMLNameTransverse(&nodeSeek, "calendar-home-set"); // Look for href. - if (NodeFound == false){ return CalendarHomeURI; } else { NodeFound = false; } - NodeFound = MatchXMLNameTransverse(&NodeSeek, "href"); + if (nodeFound == false){ return calendarHomeURI; } else { nodeFound = false; } + nodeFound = MatchXMLNameTransverse(&nodeSeek, "href"); // Get the data from href. - CalendarHomeURI = FetchXMLData(&NodeSeek); + CalendarHomeURI = FetchXMLData(&nodeSeek); xmlFreeDoc(xmlCalDAVDoc); - return CalendarHomeURI; + return calendarHomeURI; } CalDAVCalendarList CalDAV::ProcessXMLCalendarList(){ - CalDAVCalendarList CalendarList; + CalDAVCalendarList calendarList; xmlDocPtr xmlCalDAVDoc; - xmlCalDAVDoc = xmlReadMemory(ServerData.c_str(), (int)ServerData.size(), "noname.xml", NULL, 0); + xmlCalDAVDoc = xmlReadMemory(serverData.c_str(), (int)serverData.size(), "noname.xml", NULL, 0); - xmlNodePtr NodeSeek = NULL; - xmlNodePtr NodeResponse = NULL; - xmlNodePtr NodeMatch = NULL; - xmlNodePtr NodeData = NULL; - bool NodeFound = false; - int ResponseCount = 0; + xmlNodePtr nodeSeek = NULL; + xmlNodePtr nodeResponse = NULL; + xmlNodePtr nodeMatch = NULL; + xmlNodePtr nodeData = NULL; + bool nodeFound = false; + int responseCount = 0; // Start with the first node, look for multistatus. - for (NodeSeek = xmlCalDAVDoc->children; - NodeSeek != NULL; - NodeSeek = NodeSeek->next) + 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") + if (!xmlStrcmp(nodeSeek->name, (const xmlChar *)"multistatus") || + !xmlStrcmp(nodeSeek->name, (const xmlChar *)"d:multistatus") || + !xmlStrcmp(nodeSeek->name, (const xmlChar *)"D:multistatus") ){ - NodeResponse = NodeSeek->children; - NodeFound = true; + nodeResponse = nodeSeek->children; + nodeFound = true; break; } } - if (NodeFound == false){ + if (nodeFound == false){ - return CalendarList; + return calendarList; } - for (NodeResponse = NodeSeek->children; - NodeResponse != nullptr; - NodeResponse = NodeResponse->next) + for (nodeResponse = nodeSeek->children; + nodeResponse != nullptr; + nodeResponse = nodeResponse->next) { // Go through each of the responses and find the calendars. - NodeMatch = xmlCopyNode(NodeResponse, 1); + nodeMatch = xmlCopyNode(nodeResponse, 1); - if (MatchXMLName(&NodeMatch, "response")){ + if (MatchXMLName(&nodeMatch, "response")){ - NodeData = xmlCopyNode(NodeMatch, 1); + nodeData = xmlCopyNode(nodeMatch, 1); // Check the resource type is a calendar. - if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; } - if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; } - if (!MatchXMLNameTransverse(&NodeData, "resourcetype")){ continue; } - if (!MatchXMLNameTransverse(&NodeData, "calendar")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "propstat")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "prop")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "resourcetype")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "calendar")){ continue; } // Get the HREF. - NodeData = xmlCopyNode(NodeMatch, 1); + nodeData = xmlCopyNode(nodeMatch, 1); - if (!MatchXMLNameTransverse(&NodeData, "href")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "href")){ continue; } - string HREFAddress = FetchXMLData(&NodeData); + string hrefAddress = FetchXMLData(&nodeData); // Get the calendar name. - NodeData = xmlCopyNode(NodeMatch, 1); + nodeData = xmlCopyNode(nodeMatch, 1); - if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; } - if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; } - if (!MatchXMLNameTransverse(&NodeData, "displayname")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "propstat")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "prop")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "displayname")){ continue; } - string CalendarName = FetchXMLData(&NodeData); + string calendarName = FetchXMLData(&nodeData); // Get the calendar description. - NodeData = xmlCopyNode(NodeMatch, 1); + nodeData = xmlCopyNode(nodeMatch, 1); - string CalendarDescription = ""; + string calendarDescription = ""; - if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; } - if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; } - if (MatchXMLNameTransverse(&NodeData, "calendar-description")){ + if (!MatchXMLNameTransverse(&nodeData, "propstat")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "prop")){ continue; } + if (MatchXMLNameTransverse(&nodeData, "calendar-description")){ - CalendarDescription = FetchXMLData(&NodeData); + calendarDescription = FetchXMLData(&nodeData); } // Get the calendar colour. - NodeData = xmlCopyNode(NodeMatch, 1); + nodeData = xmlCopyNode(nodeMatch, 1); - Colour CalendarColour; - bool ColourResult = false; + Colour calendarColour; + bool colourResult = false; - if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; } - if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; } - if (MatchXMLNameTransverse(&NodeData, "calendar-color")){ + if (!MatchXMLNameTransverse(&nodeData, "propstat")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "prop")){ continue; } + if (MatchXMLNameTransverse(&nodeData, "calendar-color")){ - string CalendarColourString = ""; - string CalendarColourHexValue = ""; - int ColourNumber; - bool KeepRunning = true; + string calendarColourString = ""; + string calendarColourHexValue = ""; + int colourNumber; + bool keepRunning = true; - CalendarColourString = FetchXMLData(&NodeData); + calendarColourString = FetchXMLData(&nodeData); - while(KeepRunning == true){ + while(keepRunning == true){ - if (CalendarColourString.substr(0,1) == "#" && CalendarColourString.length() == 9){ + if (calendarColourString.substr(0,1) == "#" && calendarColourString.length() == 9){ // Get the red colour. - CalendarColourHexValue = CalendarColourString.substr(1,2); - if (!HexToInt(&CalendarColourHexValue, &ColourNumber)){ break; } - CalendarColour.red = ColourNumber; + calendarColourHexValue = calendarColourString.substr(1,2); + if (!HexToInt(&calendarColourHexValue, &colourNumber)){ break; } + calendarColour.red = colourNumber; // Get the green colour. - CalendarColourHexValue = CalendarColourString.substr(3,2); - if (!HexToInt(&CalendarColourHexValue, &ColourNumber)){ break; } - CalendarColour.green = ColourNumber; + calendarColourHexValue = calendarColourString.substr(3,2); + if (!HexToInt(&calendarColourHexValue, &colourNumber)){ break; } + calendarColour.green = colourNumber; // Get the blue colour. - CalendarColourHexValue = CalendarColourString.substr(5,2); - if (!HexToInt(&CalendarColourHexValue, &ColourNumber)){ break; }; - CalendarColour.blue = ColourNumber; + calendarColourHexValue = calendarColourString.substr(5,2); + if (!HexToInt(&calendarColourHexValue, &colourNumber)){ break; }; + calendarColour.blue = colourNumber; // Get the alpha. - CalendarColourHexValue = CalendarColourString.substr(7,2); - if (!HexToInt(&CalendarColourHexValue, &ColourNumber)){ break; }; - CalendarColour.alpha = ColourNumber; + calendarColourHexValue = calendarColourString.substr(7,2); + if (!HexToInt(&calendarColourHexValue, &colourNumber)){ break; }; + calendarColour.alpha = colourNumber; - ColourResult = true; + colourResult = true; } else { - ColourResult = false; + colourResult = false; } @@ -312,72 +312,72 @@ CalDAVCalendarList CalDAV::ProcessXMLCalendarList(){ } - if (ColourResult == false){ + if (colourResult == false){ - CalendarColour.red = 0; - CalendarColour.blue = 0; - CalendarColour.green = 0; - CalendarColour.alpha = 0; + calendarColour.red = 0; + calendarColour.blue = 0; + calendarColour.green = 0; + calendarColour.alpha = 0; } // Get the calendar order. - NodeData = xmlCopyNode(NodeMatch, 1); + nodeData = xmlCopyNode(nodeMatch, 1); - int CalendarOrder = 0; + int calendarOrder = 0; - if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; } - if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; } - if (MatchXMLNameTransverse(&NodeData, "calendar-order")){ + if (!MatchXMLNameTransverse(&nodeData, "propstat")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "prop")){ continue; } + if (MatchXMLNameTransverse(&nodeData, "calendar-order")){ - string CalendarOrderString = FetchXMLData(&NodeData); - if (!HexToInt(&CalendarOrderString, &CalendarOrder)){ - CalendarOrder = 0; + string calendarOrderString = FetchXMLData(&nodeData); + if (!HexToInt(&calendarOrderString, &calendarOrder)){ + calendarOrder = 0; } } // Get the calendar tag. - NodeData = xmlCopyNode(NodeMatch, 1); + nodeData = xmlCopyNode(nodeMatch, 1); - string CalendarTag = ""; + string calendarTag = ""; - if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; } - if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; } - if (MatchXMLNameTransverse(&NodeData, "getctag")){ + if (!MatchXMLNameTransverse(&nodeData, "propstat")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "prop")){ continue; } + if (MatchXMLNameTransverse(&nodeData, "getctag")){ - CalendarTag = FetchXMLData(&NodeData); + calendarTag = FetchXMLData(&nodeData); } // Get the calendar tag URL. - NodeData = xmlCopyNode(NodeMatch, 1); + nodeData = xmlCopyNode(nodeMatch, 1); - string CalendarTagURL = ""; + string calendarTagURL = ""; - if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; } - if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; } - if (MatchXMLNameTransverse(&NodeData, "sync-token")){ + if (!MatchXMLNameTransverse(&nodeData, "propstat")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "prop")){ continue; } + if (MatchXMLNameTransverse(&nodeData, "sync-token")){ - CalendarTagURL = FetchXMLData(&NodeData); + calendarTagURL = FetchXMLData(&nodeData); } // Insert the calendar information into the // list if all the information is there. - CalendarList.Name.insert(make_pair(ResponseCount, CalendarName)); - CalendarList.Description.insert(make_pair(ResponseCount, CalendarDescription)); - CalendarList.HREF.insert(make_pair(ResponseCount, HREFAddress)); - CalendarList.CalColour.insert(make_pair(ResponseCount, CalendarColour)); - CalendarList.Order.insert(make_pair(ResponseCount, CalendarOrder)); - CalendarList.Tag.insert(make_pair(ResponseCount, CalendarTag)); - CalendarList.TagURL.insert(make_pair(ResponseCount, CalendarTagURL)); + calendarList.name.insert(make_pair(responseCount, calendarName)); + calendarList.description.insert(make_pair(responseCount, calendarDescription)); + calendarList.href.insert(make_pair(responseCount, hrefAddress)); + calendarList.calColour.insert(make_pair(responseCount, calendarColour)); + calendarList.order.insert(make_pair(responseCount, calendarOrder)); + calendarList.tag.insert(make_pair(responseCount, calendarTag)); + calendarList.tagURL.insert(make_pair(responseCount, calendarTagURL)); - ResponseCount++; + responseCount++; } @@ -385,186 +385,186 @@ CalDAVCalendarList CalDAV::ProcessXMLCalendarList(){ xmlFreeDoc(xmlCalDAVDoc); - return CalendarList; + return calendarList; } string CalDAV::ProcessXMLEntryETag(){ - string EntryETag; + string entryETag; xmlDocPtr xmlCalDAVDoc; - xmlCalDAVDoc = xmlReadMemory(ServerData.c_str(), (int)ServerData.size(), "noname.xml", NULL, 0); + xmlCalDAVDoc = xmlReadMemory(serverData.c_str(), (int)serverData.size(), "noname.xml", NULL, 0); - xmlNodePtr NodeSeek; - bool NodeFound = false; + xmlNodePtr nodeSeek; + bool nodeFound = false; // Start with the first node, look for multistatus. - for (NodeSeek = xmlCalDAVDoc->children; - NodeSeek != NULL; - NodeSeek = NodeSeek->next) + 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") + if (!xmlStrcmp(nodeSeek->name, (const xmlChar *)"multistatus") || + !xmlStrcmp(nodeSeek->name, (const xmlChar *)"d:multistatus") || + !xmlStrcmp(nodeSeek->name, (const xmlChar *)"D:multistatus") ){ - NodeFound = true; + nodeFound = true; break; } } - if (NodeFound == false){ + if (nodeFound == false){ - return EntryETag; + return entryETag; } // Look for response. - if (NodeFound == false){ return EntryETag; } else { NodeFound = false; } - NodeFound = MatchXMLNameTransverse(&NodeSeek, "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"); + 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"); + 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"); + if (nodeFound == false){ return entryETag; } else { nodeFound = false; } + nodeFound = MatchXMLNameTransverse(&nodeSeek, "getetag"); // Get the data from href. - EntryETag = FetchXMLData(&NodeSeek); + 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){ + if (entryETag.substr(0,1) == "\"" && + entryETag.substr(entryETag.size()-1, 1) == "\"" && entryETag.size() > 2){ - EntryETag.erase(EntryETag.begin()); - EntryETag.erase(EntryETag.end()-1); + entryETag.erase(entryETag.begin()); + entryETag.erase(entryETag.end()-1); } - return EntryETag; + return entryETag; } CalDAVEntryList CalDAV::ProcessXMLEntryList(){ - CalDAVEntryList EntryList; + CalDAVEntryList entryList; xmlDocPtr xmlCalDAVDoc; - xmlCalDAVDoc = xmlReadMemory(ServerData.c_str(), (int)ServerData.size(), "noname.xml", NULL, 0); + xmlCalDAVDoc = xmlReadMemory(serverData.c_str(), (int)serverData.size(), "noname.xml", NULL, 0); - xmlNodePtr NodeSeek = NULL; - xmlNodePtr NodeResponse = NULL; - xmlNodePtr NodeMatch = NULL; - xmlNodePtr NodeData = NULL; - bool NodeFound = false; - int ResponseCount = 0; + xmlNodePtr nodeSeek = NULL; + xmlNodePtr nodeResponse = NULL; + xmlNodePtr nodeMatch = NULL; + xmlNodePtr nodeData = NULL; + bool nodeFound = false; + int responseCount = 0; // Start with the first node, look for multistatus. - for (NodeSeek = xmlCalDAVDoc->children; - NodeSeek != NULL; - NodeSeek = NodeSeek->next) + 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") + if (!xmlStrcmp(nodeSeek->name, (const xmlChar *)"multistatus") || + !xmlStrcmp(nodeSeek->name, (const xmlChar *)"d:multistatus") || + !xmlStrcmp(nodeSeek->name, (const xmlChar *)"D:multistatus") ){ - NodeResponse = NodeSeek->children; - NodeFound = true; + nodeResponse = nodeSeek->children; + nodeFound = true; break; } } - if (NodeFound == false){ + if (nodeFound == false){ - return EntryList; + return entryList; } - for (NodeResponse = NodeSeek->children; - NodeResponse != nullptr; - NodeResponse = NodeResponse->next) + for (nodeResponse = nodeSeek->children; + nodeResponse != nullptr; + nodeResponse = nodeResponse->next) { // Go through each of the responses and find the calendars. - NodeMatch = xmlCopyNode(NodeResponse, 1); + nodeMatch = xmlCopyNode(nodeResponse, 1); - if (MatchXMLName(&NodeMatch, "response")){ + if (MatchXMLName(&nodeMatch, "response")){ - NodeData = xmlCopyNode(NodeMatch, 1); + nodeData = xmlCopyNode(nodeMatch, 1); // Get the HREF. - NodeData = xmlCopyNode(NodeMatch, 1); + nodeData = xmlCopyNode(nodeMatch, 1); - if (!MatchXMLNameTransverse(&NodeData, "href")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "href")){ continue; } - string HREFAddress = FetchXMLData(&NodeData); + string hrefAddress = FetchXMLData(&nodeData); // Get the calendar data. - NodeData = xmlCopyNode(NodeMatch, 1); + nodeData = xmlCopyNode(nodeMatch, 1); - string EntryDescription = ""; + string entryDescription = ""; - if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; } - if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; } - if (MatchXMLNameTransverse(&NodeData, "calendar-data")){ + if (!MatchXMLNameTransverse(&nodeData, "propstat")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "prop")){ continue; } + if (MatchXMLNameTransverse(&nodeData, "calendar-data")){ // Note: libxml2 will strip the CDATA part at the start and // end of each calendar-data section. - EntryDescription = FetchXMLData(&NodeData); + entryDescription = FetchXMLData(&nodeData); } // Get the entry entity tag. - NodeData = xmlCopyNode(NodeMatch, 1); + nodeData = xmlCopyNode(nodeMatch, 1); - string EntryEntityTag = ""; + string entryEntityTag = ""; - if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; } - if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; } - if (MatchXMLNameTransverse(&NodeData, "getetag")){ + if (!MatchXMLNameTransverse(&nodeData, "propstat")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "prop")){ continue; } + if (MatchXMLNameTransverse(&nodeData, "getetag")){ - EntryEntityTag = FetchXMLData(&NodeData); + entryEntityTag = FetchXMLData(&nodeData); } // Insert the calendar information into the // list if all the information is there. - EntryList.HREF.insert(make_pair(ResponseCount, HREFAddress)); - EntryList.Data.insert(make_pair(ResponseCount, EntryDescription)); - EntryList.Tag.insert(make_pair(ResponseCount, EntryEntityTag)); + entryList.href.insert(make_pair(responseCount, hrefAddress)); + entryList.data.insert(make_pair(responseCount, entryDescription)); + entryList.tag.insert(make_pair(responseCount, entryEntityTag)); - ResponseCount++; + responseCount++; } @@ -572,93 +572,93 @@ CalDAVEntryList CalDAV::ProcessXMLEntryList(){ xmlFreeDoc(xmlCalDAVDoc); - return EntryList; + return entryList; } CalDAVEntryList CalDAV::ProcessXMLSyncTokenList(){ - CalDAVEntryList EntryList; + CalDAVEntryList entryList; xmlDocPtr xmlCalDAVDoc; - xmlCalDAVDoc = xmlReadMemory(ServerData.c_str(), (int)ServerData.size(), "noname.xml", NULL, 0); + xmlCalDAVDoc = xmlReadMemory(serverData.c_str(), (int)serverData.size(), "noname.xml", NULL, 0); - xmlNodePtr NodeSeek = NULL; - xmlNodePtr NodeResponse = NULL; - xmlNodePtr NodeMatch = NULL; - xmlNodePtr NodeData = NULL; - bool NodeFound = false; - int ResponseCount = 0; + xmlNodePtr nodeSeek = NULL; + xmlNodePtr nodeResponse = NULL; + xmlNodePtr nodeMatch = NULL; + xmlNodePtr nodeData = NULL; + bool nodeFound = false; + int responseCount = 0; // Start with the first node, look for multistatus. - for (NodeSeek = xmlCalDAVDoc->children; - NodeSeek != NULL; - NodeSeek = NodeSeek->next) + 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") + if (!xmlStrcmp(nodeSeek->name, (const xmlChar *)"multistatus") || + !xmlStrcmp(nodeSeek->name, (const xmlChar *)"d:multistatus") || + !xmlStrcmp(nodeSeek->name, (const xmlChar *)"D:multistatus") ){ - NodeResponse = NodeSeek->children; - NodeFound = true; + nodeResponse = nodeSeek->children; + nodeFound = true; break; } } - if (NodeFound == false){ + if (nodeFound == false){ - return EntryList; + return entryList; } - for (NodeResponse = NodeSeek->children; - NodeResponse != nullptr; - NodeResponse = NodeResponse->next) + for (nodeResponse = nodeSeek->children; + nodeResponse != nullptr; + nodeResponse = nodeResponse->next) { // Go through each of the responses and find the calendars. - NodeMatch = xmlCopyNode(NodeResponse, 1); + nodeMatch = xmlCopyNode(nodeResponse, 1); - if (MatchXMLName(&NodeMatch, "response")){ + if (MatchXMLName(&nodeMatch, "response")){ - NodeData = xmlCopyNode(NodeMatch, 1); + nodeData = xmlCopyNode(nodeMatch, 1); // Get the HREF. - NodeData = xmlCopyNode(NodeMatch, 1); + nodeData = xmlCopyNode(nodeMatch, 1); - if (!MatchXMLNameTransverse(&NodeData, "href")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "href")){ continue; } - string HREFAddress = FetchXMLData(&NodeData); + string hrefAddress = FetchXMLData(&nodeData); // Get the entry entity tag. - NodeData = xmlCopyNode(NodeMatch, 1); + nodeData = xmlCopyNode(nodeMatch, 1); - string EntryEntityTag = ""; + string entryEntityTag = ""; - if (!MatchXMLNameTransverse(&NodeData, "propstat")){ continue; } - if (!MatchXMLNameTransverse(&NodeData, "prop")){ continue; } - if (MatchXMLNameTransverse(&NodeData, "getetag")){ + if (!MatchXMLNameTransverse(&nodeData, "propstat")){ continue; } + if (!MatchXMLNameTransverse(&nodeData, "prop")){ continue; } + if (MatchXMLNameTransverse(&nodeData, "getetag")){ - EntryEntityTag = FetchXMLData(&NodeData); + entryEntityTag = FetchXMLData(&nodeData); } // Insert the calendar information into the // list if all the information is there. - EntryList.HREF.insert(make_pair(ResponseCount, HREFAddress)); - EntryList.Data.insert(make_pair(ResponseCount, "")); - EntryList.Tag.insert(make_pair(ResponseCount, EntryEntityTag)); + entryList.href.insert(make_pair(responseCount, hrefAddress)); + entryList.data.insert(make_pair(responseCount, "")); + entryList.tag.insert(make_pair(responseCount, entryEntityTag)); - ResponseCount++; + responseCount++; } @@ -666,23 +666,23 @@ CalDAVEntryList CalDAV::ProcessXMLSyncTokenList(){ xmlFreeDoc(xmlCalDAVDoc); - return EntryList; + return entryList; } -bool CalDAV::MatchXMLNameTransverse(xmlNodePtr *NodePtr, string NodeName){ +bool CalDAV::MatchXMLNameTransverse(xmlNodePtr *nodePtr, string nodeName){ - string NodeNameSmallD = "d:" + NodeName; - string NodeNameLargeD = "D:" + NodeName; + string nodeNameSmallD = "d:" + nodeName; + string nodeNameLargeD = "D:" + nodeName; - for ((*NodePtr) = (*NodePtr)->children; - (*NodePtr) != NULL; - (*NodePtr) = (*NodePtr)->next) + for ((*nodePtr) = (*nodePtr)->children; + (*nodePtr) != NULL; + (*nodePtr) = (*nodePtr)->next) { - if (!xmlStrcmp((*NodePtr)->name, (const xmlChar *)NodeName.c_str()) || - !xmlStrcmp((*NodePtr)->name, (const xmlChar *)NodeNameSmallD.c_str()) || - !xmlStrcmp((*NodePtr)->name, (const xmlChar *)NodeNameLargeD.c_str()) + if (!xmlStrcmp((*nodePtr)->name, (const xmlChar *)nodeName.c_str()) || + !xmlStrcmp((*nodePtr)->name, (const xmlChar *)nodeNameSmallD.c_str()) || + !xmlStrcmp((*nodePtr)->name, (const xmlChar *)nodeNameLargeD.c_str()) ){ return true; @@ -695,22 +695,22 @@ bool CalDAV::MatchXMLNameTransverse(xmlNodePtr *NodePtr, string NodeName){ } -bool CalDAV::MatchXMLName(xmlNodePtr *NodePtrOriginal, string NodeName){ +bool CalDAV::MatchXMLName(xmlNodePtr *nodePtrOriginal, string nodeName){ - if (NodePtrOriginal == nullptr){ + if (nodePtrOriginal == nullptr){ return false; } - string NodeNameSmallD = "d:" + NodeName; - string NodeNameLargeD = "D:" + NodeName; + string nodeNameSmallD = "d:" + NodeName; + string nodeNameLargeD = "D:" + NodeName; - xmlNodePtr *NodePtr = NodePtrOriginal; + xmlNodePtr *nodePtr = nodePtrOriginal; - if (!xmlStrcmp((*NodePtr)->name, (const xmlChar *)NodeName.c_str()) || - !xmlStrcmp((*NodePtr)->name, (const xmlChar *)NodeNameSmallD.c_str()) || - !xmlStrcmp((*NodePtr)->name, (const xmlChar *)NodeNameLargeD.c_str()) + if (!xmlStrcmp((*nodePtr)->name, (const xmlChar *)nodeName.c_str()) || + !xmlStrcmp((*nodePtr)->name, (const xmlChar *)nodeNameSmallD.c_str()) || + !xmlStrcmp((*nodePtr)->name, (const xmlChar *)nodeNameLargeD.c_str()) ){ return true; @@ -725,14 +725,14 @@ bool CalDAV::MatchXMLName(xmlNodePtr *NodePtrOriginal, string NodeName){ } -string CalDAV::FetchXMLData(xmlNodePtr *NodePtr){ +string CalDAV::FetchXMLData(xmlNodePtr *nodePtr){ - for ((*NodePtr) = (*NodePtr)->children; - (*NodePtr) != NULL; - (*NodePtr) = (*NodePtr)->next) + for ((*nodePtr) = (*nodePtr)->children; + (*nodePtr) != NULL; + (*nodePtr) = (*nodePtr)->next) { - return (const char*)(*NodePtr)->content; + return (const char*)(*nodePtr)->content; } diff --git a/source/objects/CalDAV/CalDAV.cpp b/source/objects/CalDAV/CalDAV.cpp index 7f268b0..6739d48 100644 --- a/source/objects/CalDAV/CalDAV.cpp +++ b/source/objects/CalDAV/CalDAV.cpp @@ -20,29 +20,29 @@ using namespace std; -size_t CalDAVReceive(char *ReceivedBuffer, size_t Size, size_t NewMemoryBytes, string *StringPointer) +size_t CalDAVReceive(char *receivedBuffer, size_t size, size_t newMemoryBytes, string *stringPointer) { - StringPointer->append(ReceivedBuffer, NewMemoryBytes); + stringPointer->append(receivedBuffer, newMemoryBytes); - return Size * NewMemoryBytes; + return size * newMemoryBytes; } -size_t CalDAVSend(char *SendBuffer, size_t Size, size_t NewMemoryBytes, void *DataStruct){ +size_t CalDAVSend(char *sendBuffer, size_t size, size_t newMemoryBytes, void *dataStruct){ - struct CalDAVSendData *UploadPtr = (struct CalDAVSendData *)DataStruct; + struct CalDAVSendData *uploadPtr = (struct calDAVSendData *)dataStruct; - if (UploadPtr->sizeleft){ + if (uploadPtr->sizeleft){ - UploadPtr->sizeleft--; - char CharSend; + uploadPtr->sizeleft--; + char charSend; - CharSend = (*UploadPtr->readptr)[UploadPtr->seek]; + charSend = (*uploadPtr->readptr)[uploadPtr->seek]; - *SendBuffer = CharSend; + *sendBuffer = charSend; - UploadPtr->seek++; + uploadPtr->seek++; return 1; @@ -57,7 +57,7 @@ CalDAV::CalDAV(){ // Setup the objects within the CalDAV connection // object. - ConnectionHandle = curl_easy_init(); + connectionHandle = curl_easy_init(); } @@ -66,22 +66,22 @@ CalDAV::~CalDAV(){ // Destory the objects within the CalDAV connection // object. - curl_easy_cleanup(ConnectionHandle); - ConnectionHandle = nullptr; + curl_easy_cleanup(connectionHandle); + connectionHandle = nullptr; } -void CalDAV::SetupConnectionData(CalDAVConnectionData *ConnData){ +void CalDAV::SetupConnectionData(CalDAVConnectionData *connData){ // Check if ConnData is a nullptr, return if it is. - if (ConnData == nullptr){ + if (connData == nullptr){ return; } // Set the connection settings to the values from ConnData. - ConnectionData = (*ConnData); + connectionData = (*connData); } @@ -90,120 +90,120 @@ CalDAVStatus CalDAV::GetConnectionData(){ // Get the current connection settings for the CalDAV // connection object and return a CalDAVStatus object. - CalDAVStatus ConnectionStatus; + CalDAVStatus connectionStatus; - ConnectionStatus.Hostname = ConnectionData.Hostname; - ConnectionStatus.Port = ConnectionData.Port; - ConnectionStatus.Username = ConnectionData.Username; - ConnectionStatus.Prefix = ConnectionData.Prefix; - ConnectionStatus.UseSSL = ConnectionData.UseSSL; - ConnectionStatus.Timeout = ConnectionData.Timeout; + connectionStatus.hostname = connectionData.hostname; + connectionStatus.port = connectionData.port; + connectionStatus.username = connectionData.username; + connectionStatus.prefix = connectionData.prefix; + connectionStatus.useSSL = connectionData.useSSL; + connectionStatus.timeout = connectionData.timeout; - return ConnectionStatus; + return connectionStatus; } CalDAVServerResult CalDAV::Connect(){ - CalDAVServerResult ServerResult; + CalDAVServerResult serverResult; - string ServerAddress = ""; - string ServerUserPass = ""; + string serverAddress = ""; + string serverUserPass = ""; // Setup the server address. - ServerAddress = BuildServerAddress(&ConnectionData, "/principals/"); + serverAddress = BuildServerAddress(&connectionData, "/principals/"); // Setup the server password. - ServerUserPass += ConnectionData.Username; + ServerUserPass += connectionData.username; ServerUserPass += ":"; - ServerUserPass += ConnectionData.Password; + ServerUserPass += connectionData.password; - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, ServerAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_USERPWD, ServerUserPass.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); - curl_easy_setopt(ConnectionHandle, CURLOPT_FAILONERROR, 1L); - curl_easy_setopt(ConnectionHandle, CURLOPT_TIMEOUT, ConnectionData.Timeout); - curl_easy_setopt(ConnectionHandle, CURLOPT_WRITEFUNCTION, CalDAVReceive); - curl_easy_setopt(ConnectionHandle, CURLOPT_WRITEDATA, &ServerData); - curl_easy_setopt(ConnectionHandle, CURLOPT_WRITEHEADER, &ServerHeader); + curl_easy_setopt(connectionHandle, CURLOPT_URL, serverAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_USERPWD, serverUserPass.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); + curl_easy_setopt(connectionHandle, CURLOPT_FAILONERROR, 1L); + curl_easy_setopt(connectionHandle, CURLOPT_TIMEOUT, connectionData.timeout); + curl_easy_setopt(connectionHandle, CURLOPT_WRITEFUNCTION, calDAVReceive); + curl_easy_setopt(connectionHandle, CURLOPT_WRITEDATA, &serverData); + curl_easy_setopt(connectionHandle, CURLOPT_WRITEHEADER, &serverHeader); // Connect to the CalDAV server. - ServerResult.Code = curl_easy_perform(ConnectionHandle); + serverResult.code = curl_easy_perform(connectionHandle); // Process the result received from the server. - if (ServerResult.Code != CURLE_OK){ + if (serverResult.code != CURLE_OK){ - ServerResult.Result = CALDAVQUERYRESULT_SERVERERROR; + serverResult.result = CALDAVQUERYRESULT_SERVERERROR; } else { - ServerResult.Result = CALDAVQUERYRESULT_OK; + serverResult.result = CALDAVQUERYRESULT_OK; } // Get the HTTP code. - curl_easy_getinfo(ConnectionHandle, CURLINFO_RESPONSE_CODE, &ServerResult.HTTPCode); + curl_easy_getinfo(connectionHandle, CURLINFO_RESPONSE_CODE, &serverResult.httpCode); - return ServerResult; + return serverResult; } CalDAVServerResult CalDAV::GetServerResult(){ - return ConnectionServerResult; + return connectionServerResult; } CalDAVServerSupport CalDAV::GetServerSupport(){ - CalDAVServerSupport ServerStatus; + CalDAVServerSupport serverStatus; // Setup the server connection. - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, "OPTIONS"); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, "OPTIONS"); - CURLcode ServerResult = curl_easy_perform(ConnectionHandle); + CURLcode serverResult = curl_easy_perform(connectionHandle); // Set the results. - if (ServerResult == CURLE_OK){ - ConnectionServerResult.Result = CALDAVQUERYRESULT_OK; + if (serverResult == CURLE_OK){ + connectionServerResult.result = CALDAVQUERYRESULT_OK; } else { - ConnectionServerResult.Result = CALDAVQUERYRESULT_SERVERERROR; + connectionServerResult.result = CALDAVQUERYRESULT_SERVERERROR; } - ConnectionServerResult.Code = ServerResult; - curl_easy_getinfo(ConnectionHandle, CURLINFO_RESPONSE_CODE, &ConnectionServerResult.HTTPCode); + connectionServerResult.code = serverResult; + curl_easy_getinfo(connectionHandle, CURLINFO_RESPONSE_CODE, &connectionServerResult.httpCode); - if (ServerResult != CURLE_OK){ - return ServerStatus; + if (serverResult != CURLE_OK){ + return serverStatus; } // Check that the server header has data in, // otherwise return an "empty" CalDAVServerSupport. - if (ServerHeader.size() == 0){ - return ServerStatus; + if (serverHeader.size() == 0){ + return serverStatus; } // Process each line looking for the first DAV header // line. - bool NewlineMode = true; + bool newlineMode = true; - string DAVLine; + string davLine; - for (int CharSeek = 0; CharSeek < ServerHeader.size(); CharSeek++){ + for (int charSeek = 0; charSeek < serverHeader.size(); charSeek++){ - if (NewlineMode == true){ + if (newlineMode == true){ // Check if we have reached the end of the string. - if (CharSeek >= ServerHeader.size()){ + if (charSeek >= serverHeader.size()){ break; @@ -212,29 +212,29 @@ CalDAVServerSupport CalDAV::GetServerSupport(){ // Check the first four letters to make sure // they are 'DAV:'. - string DAVHeaderCheck = ""; + string davHeaderCheck = ""; try { - DAVHeaderCheck = ServerHeader.substr(CharSeek, 4); + davHeaderCheck = serverHeader.substr(charSeek, 4); } catch (out_of_range &oor){ break; } - if (DAVHeaderCheck == "DAV:"){ + if (davHeaderCheck == "DAV:"){ - CharSeek += 5; + charSeek += 5; - for (; CharSeek < ServerHeader.size(); CharSeek++){ + for (; charSeek < serverHeader.size(); charSeek++){ - if (ServerHeader[CharSeek] == '\n'){ + if (serverHeader[charSeek] == '\n'){ break; } - DAVLine.push_back(ServerHeader[CharSeek]); + davLine.push_back(serverHeader[charSeek]); } @@ -242,13 +242,13 @@ CalDAVServerSupport CalDAV::GetServerSupport(){ } - NewlineMode = false; + newlineMode = false; } - if (ServerHeader[CharSeek] == '\n'){ + if (serverHeader[charSeek] == '\n'){ - NewlineMode = true; + newlineMode = true; } @@ -256,37 +256,37 @@ CalDAVServerSupport CalDAV::GetServerSupport(){ // Process the DAV line. - vector DAVLineData; - string DAVSegmentString; + vector davLineData; + string davSegmentString; - for (int CharSeek = 0; CharSeek < DAVLine.size(); CharSeek++){ + for (int charSeek = 0; charSeek < davLine.size(); charSeek++){ - if (DAVLine[CharSeek] == ' '){ + if (davLine[charSeek] == ' '){ continue; } - if (DAVLine[CharSeek] == ','){ + if (davLine[charSeek] == ','){ - DAVLineData.push_back(DAVSegmentString); - DAVSegmentString.clear(); + davLineData.push_back(davSegmentString); + davSegmentString.clear(); continue; } - DAVSegmentString += DAVLine[CharSeek]; + davSegmentString += davLine[charSeek]; } // Process the DAV values and set each value // to true as required. - for (int DAVItemSeek = 0; - DAVItemSeek < DAVLineData.size(); - DAVItemSeek++){ + for (int davItemSeek = 0; + davItemSeek < davLineData.size(); + davItemSeek++){ - if (DAVLineData.at(DAVItemSeek) == "calendar-access"){ + if (davLineData.at(davItemSeek) == "calendar-access"){ - ServerStatus.BasicSupport = true; + serverStatus.basicSupport = true; } @@ -294,180 +294,180 @@ CalDAVServerSupport CalDAV::GetServerSupport(){ // Reset the connection status. - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, NULL); - return ServerStatus; + return serverStatus; } string CalDAV::GetUserPrincipal(){ - string CurrentUserPrincipal = ""; - string UserPrincipalRequest = ""; - CalDAVSendData UserPrincipalSendData; + string currentUserPrincipal = ""; + string userPrincipalRequest = ""; + CalDAVSendData userPrincipalSendData; - UserPrincipalRequest = "\n" + userPrincipalRequest = "\n" "\n" " \n" " \n" " \n" ""; - UserPrincipalSendData.readptr = &UserPrincipalRequest; - UserPrincipalSendData.sizeleft = UserPrincipalRequest.size(); + userPrincipalSendData.readptr = &userPrincipalRequest; + userPrincipalSendData.sizeleft = userPrincipalRequest.size(); // Setup the header. - struct curl_slist *UserPrincipalRequestHeader = NULL; + struct curl_slist *userPrincipalRequestHeader = NULL; - UserPrincipalRequestHeader = curl_slist_append(UserPrincipalRequestHeader, "Depth: 0"); - UserPrincipalRequestHeader = curl_slist_append(UserPrincipalRequestHeader, "Prefer: return-minimal"); - UserPrincipalRequestHeader = curl_slist_append(UserPrincipalRequestHeader, "Content-Type: application/xml; charset=utf-8"); + userPrincipalRequestHeader = curl_slist_append(userPrincipalRequestHeader, "Depth: 0"); + userPrincipalRequestHeader = curl_slist_append(userPrincipalRequestHeader, "Prefer: return-minimal"); + userPrincipalRequestHeader = curl_slist_append(userPrincipalRequestHeader, "Content-Type: application/xml; charset=utf-8"); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, UserPrincipalRequestHeader); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, userPrincipalRequestHeader); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, "PROPFIND"); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 1L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, &UserPrincipalSendData); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, CalDAVSend); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, "PROPFIND"); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 1L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, &userPrincipalSendData); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, calDAVSend); // Process the data. - ServerData.clear(); - ServerHeader.clear(); + serverData.clear(); + serverHeader.clear(); - CURLcode ServerResult = curl_easy_perform(ConnectionHandle); + CURLcode serverResult = curl_easy_perform(connectionHandle); // Set the results. - if (ServerResult == CURLE_OK){ - ConnectionServerResult.Result = CALDAVQUERYRESULT_OK; + if (serverResult == CURLE_OK){ + connectionServerResult.Result = CALDAVQUERYRESULT_OK; } else { - ConnectionServerResult.Result = CALDAVQUERYRESULT_SERVERERROR; + connectionServerResult.Result = CALDAVQUERYRESULT_SERVERERROR; } - ConnectionServerResult.Code = ServerResult; - curl_easy_getinfo(ConnectionHandle, CURLINFO_RESPONSE_CODE, &ConnectionServerResult.HTTPCode); + connectionServerResult.Code = serverResult; + curl_easy_getinfo(connectionHandle, CURLINFO_RESPONSE_CODE, &connectionServerResult.HTTPCode); - if (ServerResult != CURLE_OK){ + if (serverResult != CURLE_OK){ - return CurrentUserPrincipal; + return currentUserPrincipal; } // Process the User Principal from the ServerData. - CurrentUserPrincipal = ProcessXMLUserPrincipal(); + currentUserPrincipal = ProcessXMLUserPrincipal(); // Reset the changed settings. - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 0L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 0L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, NULL); - return CurrentUserPrincipal; + return currentUserPrincipal; } -string CalDAV::GetCalendarHome(string UserPrincipalURI){ +string CalDAV::GetCalendarHome(string userPrincipalURI){ - string CalendarHomeURI = ""; + string calendarHomeURI = ""; // Build the Calendar Home URL address. - string CalendarHomeURL = BuildServerAddress(&ConnectionData, UserPrincipalURI); + string calendarHomeURL = BuildServerAddress(&connectionData, userPrincipalURI); // Setup the header request. - CalDAVSendData CalendarHomeSendData; + CalDAVSendData calendarHomeSendData; - string CalendarHomeRequest = "\n" + string calendarHomeRequest = "\n" "\n" " \n" " \n" " \n" ""; - CalendarHomeSendData.readptr = &CalendarHomeRequest; - CalendarHomeSendData.sizeleft = CalendarHomeRequest.size(); + calendarHomeSendData.readptr = &calendarHomeRequest; + calendarHomeSendData.sizeleft = calendarHomeRequest.size(); // Setup the header. - struct curl_slist *CalendarRequestHeader = NULL; + struct curl_slist *calendarRequestHeader = NULL; - CalendarRequestHeader = curl_slist_append(CalendarRequestHeader, "Depth: 0"); - CalendarRequestHeader = curl_slist_append(CalendarRequestHeader, "Prefer: return-minimal"); - CalendarRequestHeader = curl_slist_append(CalendarRequestHeader, "Content-Type: application/xml; charset=utf-8"); + calendarRequestHeader = curl_slist_append(calendarRequestHeader, "Depth: 0"); + calendarRequestHeader = curl_slist_append(calendarRequestHeader, "Prefer: return-minimal"); + calendarRequestHeader = curl_slist_append(calendarRequestHeader, "Content-Type: application/xml; charset=utf-8"); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, CalendarRequestHeader); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, CalendarHomeURL.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, "PROPFIND"); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 1L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, &CalendarHomeSendData); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, CalDAVSend); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, calendarRequestHeader); + curl_easy_setopt(connectionHandle, CURLOPT_URL, calendarHomeURL.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, "PROPFIND"); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 1L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, &calendarHomeSendData); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, calDAVSend); // Process the data. - ServerData.clear(); - ServerHeader.clear(); + serverData.clear(); + serverHeader.clear(); - CURLcode ServerResult = curl_easy_perform(ConnectionHandle); + CURLcode serverResult = curl_easy_perform(connectionHandle); // Set the results. - if (ServerResult == CURLE_OK){ - ConnectionServerResult.Result = CALDAVQUERYRESULT_OK; + if (serverResult == CURLE_OK){ + connectionServerResult.result = CALDAVQUERYRESULT_OK; } else { - ConnectionServerResult.Result = CALDAVQUERYRESULT_SERVERERROR; + connectionServerResult.result = CALDAVQUERYRESULT_SERVERERROR; } - ConnectionServerResult.Code = ServerResult; - curl_easy_getinfo(ConnectionHandle, CURLINFO_RESPONSE_CODE, &ConnectionServerResult.HTTPCode); + connectionServerResult.code = serverResult; + curl_easy_getinfo(connectionHandle, CURLINFO_RESPONSE_CODE, &connectionServerResult.httpCode); - if (ServerResult != CURLE_OK){ + if (serverResult != CURLE_OK){ - return CalendarHomeURI; + return calendarHomeURI; } // Process the User Principal from the ServerData. - CalendarHomeURI = ProcessXMLCalendarHome(); + calendarHomeURI = ProcessXMLCalendarHome(); // Reset the changed settings. - string OriginalServerAddress = BuildServerAddress(&ConnectionData, "/principals/"); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, OriginalServerAddress.c_str()); + string originalServerAddress = BuildServerAddress(&connectionData, "/principals/"); + curl_easy_setopt(connectionHandle, CURLOPT_URL, originalServerAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 0L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 0L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, NULL); - return CalendarHomeURI; + return calendarHomeURI; } CalDAVCalendarList CalDAV::GetCalendars(){ - CalDAVCalendarList ServerList; - CalDAVSendData CalendarListSendData; + CalDAVCalendarList serverList; + CalDAVSendData calendarListSendData; // Build the server address. - string UserPrincipalURI = ""; - UserPrincipalURI = GetUserPrincipal(); + string userPrincipalURI = ""; + userPrincipalURI = GetUserPrincipal(); - if (UserPrincipalURI.size() == 0){ + if (userPrincipalURI.size() == 0){ - return ServerList; + return serverList; } - string CalendarHomeURI = ""; - CalendarHomeURI = GetCalendarHome(UserPrincipalURI); + string calendarHomeURI = ""; + calendarHomeURI = GetCalendarHome(userPrincipalURI); - string CalendarListURLAddress = BuildServerAddress(&ConnectionData, CalendarHomeURI); + string calendarListURLAddress = BuildServerAddress(&connectionData, calendarHomeURI); - string CalendarListRequest = "\n" + string calendarListRequest = "\n" "\n" " \n" @@ -482,84 +482,84 @@ CalDAVCalendarList CalDAV::GetCalendars(){ " \n" ""; - CalendarListSendData.readptr = &CalendarListRequest; - CalendarListSendData.sizeleft = CalendarListRequest.size(); + calendarListSendData.readptr = &calendarListRequest; + calendarListSendData.sizeleft = calendarListRequest.size(); // Setup the header. - struct curl_slist *CalendarListRequestHeader = NULL; + struct curl_slist *calendarListRequestHeader = NULL; - CalendarListRequestHeader = curl_slist_append(CalendarListRequestHeader, "Depth: 1"); - CalendarListRequestHeader = curl_slist_append(CalendarListRequestHeader, "Prefer: return-minimal"); - CalendarListRequestHeader = curl_slist_append(CalendarListRequestHeader, "Content-Type: application/xml; charset=utf-8"); + calendarListRequestHeader = curl_slist_append(calendarListRequestHeader, "Depth: 1"); + calendarListRequestHeader = curl_slist_append(calendarListRequestHeader, "Prefer: return-minimal"); + calendarListRequestHeader = curl_slist_append(calendarListRequestHeader, "Content-Type: application/xml; charset=utf-8"); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, CalendarListRequestHeader); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, CalendarListURLAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, "PROPFIND"); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 1L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, &CalendarListSendData); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, CalDAVSend); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, calendarListRequestHeader); + curl_easy_setopt(connectionHandle, CURLOPT_URL, calendarListURLAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, "PROPFIND"); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 1L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, &calendarListSendData); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, calDAVSend); // Process the data. - ServerData.clear(); - ServerHeader.clear(); + serverData.clear(); + serverHeader.clear(); - CURLcode ServerResult = curl_easy_perform(ConnectionHandle); + CURLcode serverResult = curl_easy_perform(connectionHandle); //ServerList = ProcessXMLCalendarList(); - if (ServerResult == CURLE_OK){ - ConnectionServerResult.Result = CALDAVQUERYRESULT_OK; + if (serverResult == CURLE_OK){ + connectionServerResult.result = CALDAVQUERYRESULT_OK; } else { - ConnectionServerResult.Result = CALDAVQUERYRESULT_SERVERERROR; + connectionServerResult.result = CALDAVQUERYRESULT_SERVERERROR; } - ConnectionServerResult.Code = ServerResult; - curl_easy_getinfo(ConnectionHandle, CURLINFO_RESPONSE_CODE, &ConnectionServerResult.HTTPCode); + connectionServerResult.code = serverResult; + curl_easy_getinfo(connectionHandle, CURLINFO_RESPONSE_CODE, &connectionServerResult.httpCode); - if (ServerResult != CURLE_OK){ + if (cerverResult != CURLE_OK){ - return ServerList; + return serverList; } // Process the received XML data into a list of calendars // and locations. - ServerList = ProcessXMLCalendarList(); + serverList = ProcessXMLCalendarList(); // Restore the original settings. - string OriginalServerAddress = BuildServerAddress(&ConnectionData, "/principals/"); + string originalServerAddress = BuildServerAddress(&connectionData, "/principals/"); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, OriginalServerAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 0L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_URL, originalServerAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 0L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, NULL); - return ServerList; + return serverList; } -CalDAVEntryList CalDAV::GetEntryList(string *CalendarHREF){ +CalDAVEntryList CalDAV::GetEntryList(string *calendarHREF){ - CalDAVEntryList EntryList; - CalDAVSendData EntryListSendData; + CalDAVEntryList entryList; + CalDAVSendData entryListSendData; - if (CalendarHREF->size() == 0){ + if (calendarHREF->size() == 0){ - return EntryList; + return entryList; } - string EntryListURLAddress = BuildServerAddress(&ConnectionData, *CalendarHREF); + string entryListURLAddress = BuildServerAddress(&connectionData, *calendarHREF); - string EntryListRequest = "\n"; + string entryListRequest = "\n"; /*if (CalendarTag == nullptr){*/ - EntryListRequest += "\n" " \n" " \n" @@ -586,12 +586,12 @@ CalDAVEntryList CalDAV::GetEntryList(string *CalendarHREF){ }*/ - EntryListSendData.readptr = &EntryListRequest; - EntryListSendData.sizeleft = EntryListRequest.size(); + entryListSendData.readptr = &entryListRequest; + entryListSendData.sizeleft = entryListRequest.size(); - struct curl_slist *EntryListRequestHeader = NULL; + struct curl_slist *entryListRequestHeader = NULL; - EntryListRequestHeader = curl_slist_append(EntryListRequestHeader, "Content-Type: application/xml; charset=utf-8"); + entryListRequestHeader = curl_slist_append(entryListRequestHeader, "Content-Type: application/xml; charset=utf-8"); /*if (CalendarTag != nullptr){ @@ -600,140 +600,140 @@ CalDAVEntryList CalDAV::GetEntryList(string *CalendarHREF){ }*/ - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, EntryListRequestHeader); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, EntryListURLAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, "REPORT"); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 1L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, &EntryListSendData); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, CalDAVSend); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, entryListRequestHeader); + curl_easy_setopt(connectionHandle, CURLOPT_URL, entryListURLAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, "REPORT"); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 1L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, &entryListSendData); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, calDAVSend); // Process the data. - ServerData.clear(); - ServerHeader.clear(); + serverData.clear(); + serverHeader.clear(); - CURLcode ServerResult = curl_easy_perform(ConnectionHandle); + CURLcode serverResult = curl_easy_perform(connectionHandle); //ServerList = ProcessXMLCalendarList(); - if (ServerResult == CURLE_OK){ - ConnectionServerResult.Result = CALDAVQUERYRESULT_OK; + if (serverResult == CURLE_OK){ + connectionServerResult.result = CALDAVQUERYRESULT_OK; } else { - ConnectionServerResult.Result = CALDAVQUERYRESULT_SERVERERROR; + connectionServerResult.result = CALDAVQUERYRESULT_SERVERERROR; } - ConnectionServerResult.Code = ServerResult; - curl_easy_getinfo(ConnectionHandle, CURLINFO_RESPONSE_CODE, &ConnectionServerResult.HTTPCode); + connectionServerResult.code = serverResult; + curl_easy_getinfo(connectionHandle, CURLINFO_RESPONSE_CODE, &connectionServerResult.httpCode); - if (ServerResult != CURLE_OK){ + if (serverResult != CURLE_OK){ - return EntryList; + return entryList; } // Process the received XML data into a list of calendars // and locations. - EntryList = ProcessXMLEntryList(); + entryList = ProcessXMLEntryList(); // Restore the original settings. - string OriginalServerAddress = BuildServerAddress(&ConnectionData, "/principals/"); + string originalServerAddress = BuildServerAddress(&connectionData, "/principals/"); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, OriginalServerAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 0L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_URL, originalServerAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 0L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, NULL); - return EntryList; + return entryList; } -CalDAVEntryList CalDAV::GetEntryList(string *CalendarHREF, string *CalendarTag){ +CalDAVEntryList CalDAV::GetEntryList(string *calendarHREF, string *calendarTag){ - CalDAVEntryList EntryList; - CalDAVSendData EntryListSendData; + CalDAVEntryList entryList; + CalDAVSendData entryListSendData; - if (CalendarHREF->size() == 0){ + if (calendarHREF->size() == 0){ - return EntryList; + return entryList; } - string EntryListURLAddress = BuildServerAddress(&ConnectionData, *CalendarHREF); + string entryListURLAddress = BuildServerAddress(&connectionData, *calendarHREF); // First query: Get the list of contacts that need to be updated. - string EntryListRequest = "\n"; + string entryListRequest = "\n"; - EntryListRequest += "\n" " "; - if (CalendarTag != nullptr){ + if (calendarTag != nullptr){ - EntryListRequest += *CalendarTag; + entryListRequest += *calendarTag; } else { - EntryListRequest += ""; + entryListRequest += ""; } - EntryListRequest += "\n" + entryListRequest += "\n" " 1\n" " \n" " \n" " \n" ""; - EntryListSendData.readptr = &EntryListRequest; - EntryListSendData.sizeleft = EntryListRequest.size(); + entryListSendData.readptr = &entryListRequest; + entryListSendData.sizeleft = entryListRequest.size(); - struct curl_slist *EntryListRequestHeader = NULL; + struct curl_slist *entryListRequestHeader = NULL; - EntryListRequestHeader = curl_slist_append(EntryListRequestHeader, "Content-Type: application/xml; charset=utf-8"); + entryListRequestHeader = curl_slist_append(entryListRequestHeader, "Content-Type: application/xml; charset=utf-8"); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, EntryListRequestHeader); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, EntryListURLAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, "REPORT"); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 1L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, &EntryListSendData); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, CalDAVSend); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, entryListRequestHeader); + curl_easy_setopt(connectionHandle, CURLOPT_URL, entryListURLAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, "REPORT"); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 1L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, &entryListSendData); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, calDAVSend); // Process the data. - ServerData.clear(); - ServerHeader.clear(); + serverData.clear(); + serverHeader.clear(); - CURLcode ServerResult = curl_easy_perform(ConnectionHandle); + CURLcode serverResult = curl_easy_perform(connectionHandle); - if (ServerResult == CURLE_OK){ - ConnectionServerResult.Result = CALDAVQUERYRESULT_OK; + if (serverResult == CURLE_OK){ + connectionServerResult.result = CALDAVQUERYRESULT_OK; } else { - ConnectionServerResult.Result = CALDAVQUERYRESULT_SERVERERROR; + connectionServerResult.result = CALDAVQUERYRESULT_SERVERERROR; } - ConnectionServerResult.Code = ServerResult; - curl_easy_getinfo(ConnectionHandle, CURLINFO_RESPONSE_CODE, &ConnectionServerResult.HTTPCode); + connectionServerResult.code = serverResult; + curl_easy_getinfo(connectionHandle, CURLINFO_RESPONSE_CODE, &connectionServerResult.httpCode); - if (ServerResult != CURLE_OK){ + if (serverResult != CURLE_OK){ - return EntryList; + return entryList; } - EntryList = ProcessXMLSyncTokenList(); + entryList = ProcessXMLSyncTokenList(); // Check the last entry matches the HREF and if it // does then delete it. - if (EntryList.HREF.size() > 0) { + if (entryList.href.size() > 0) { - if (EntryList.HREF.rbegin()->second == *CalendarHREF){ + if (entryList.href.rbegin()->second == *calendarHREF){ - EntryList.HREF.erase((EntryList.HREF.size() - 1)); - EntryList.Tag.erase((EntryList.HREF.size() - 1)); - EntryList.Data.erase((EntryList.HREF.size() - 1)); + entryList.href.erase((entryList.href.size() - 1)); + entryList.tag.erase((entryList.href.size() - 1)); + entryList.data.erase((entryList.href.size() - 1)); } @@ -742,147 +742,147 @@ CalDAVEntryList CalDAV::GetEntryList(string *CalendarHREF, string *CalendarTag){ // Build the list into a new list for getting the new // calendar data with. - EntryListRequest.clear(); + entryListRequest.clear(); - EntryListRequest = "\n"; + entryListRequest = "\n"; - EntryListRequest += "\n" " \n" " \n" " \n" " \n"; - for (std::map::iterator HREFIter = EntryList.HREF.begin(); - HREFIter != EntryList.HREF.end(); HREFIter++){ + for (std::map::iterator hrefIter = entryList.href.begin(); + hrefIter != entryList.href.end(); hrefIter++){ - string EntryListHREFString = HREFIter->second; + string entryListHREFString = hrefIter->second; - EntryListRequest += " "; - EntryListRequest += EntryListHREFString; - EntryListRequest += "\n"; + entryListRequest += " "; + entryListRequest += entryListHREFString; + entryListRequest += "\n"; } - EntryListRequest += ""; + entryListRequest += ""; - CalDAVSendData UpdatedEntryListSendData; + CalDAVSendData updatedEntryListSendData; - UpdatedEntryListSendData.readptr = &EntryListRequest; - UpdatedEntryListSendData.sizeleft = EntryListRequest.size(); + updatedEntryListSendData.readptr = &entryListRequest; + updatedEntryListSendData.sizeleft = entryListRequest.size(); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, EntryListRequestHeader); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, EntryListURLAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, "REPORT"); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 1L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, &UpdatedEntryListSendData); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, CalDAVSend); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, entryListRequestHeader); + curl_easy_setopt(connectionHandle, CURLOPT_URL, entryListURLAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, "REPORT"); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 1L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, &updatedEntryListSendData); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, calDAVSend); // Get the updated calendar data. - ServerData.clear(); - ServerHeader.clear(); - EntryList.HREF.clear(); - EntryList.Tag.clear(); - EntryList.Data.clear(); + serverData.clear(); + serverHeader.clear(); + entryList.href.clear(); + entryList.tag.clear(); + entryList.data.clear(); - ServerResult = curl_easy_perform(ConnectionHandle); + serverResult = curl_easy_perform(connectionHandle); // Check the last entry matches the HREF and if it // does then delete it. - if (ServerResult == CURLE_OK){ - ConnectionServerResult.Result = CALDAVQUERYRESULT_OK; + if (serverResult == CURLE_OK){ + connectionServerResult.result = CALDAVQUERYRESULT_OK; } else { - ConnectionServerResult.Result = CALDAVQUERYRESULT_SERVERERROR; + connectionServerResult.result = CALDAVQUERYRESULT_SERVERERROR; } - ConnectionServerResult.Code = ServerResult; - curl_easy_getinfo(ConnectionHandle, CURLINFO_RESPONSE_CODE, &ConnectionServerResult.HTTPCode); + connectionServerResult.code = serverResult; + curl_easy_getinfo(connectionHandle, CURLINFO_RESPONSE_CODE, &connectionServerResult.httpCode); - if (ServerResult != CURLE_OK){ + if (serverResult != CURLE_OK){ - return EntryList; + return entryList; } - EntryList = ProcessXMLEntryList(); + entryList = ProcessXMLEntryList(); // Second query: Get the list of contact data for the contacts that have // beenchanged. // Restore the original settings. - string OriginalServerAddress = BuildServerAddress(&ConnectionData, "/principals/"); + string originalServerAddress = BuildServerAddress(&connectionData, "/principals/"); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, OriginalServerAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 0L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_URL, originalServerAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 0L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, NULL); - return EntryList; + return entryList; } -CalDAVServerResult CalDAV::AddCalendar(string CalendarName){ +CalDAVServerResult CalDAV::AddCalendar(string calendarName){ - CalDAVServerResult ServerResult; + CalDAVServerResult serverResult; - AddCalendar(&CalendarName, nullptr); + AddCalendar(&calendarName, nullptr); - return ServerResult; + return serverResult; } -CalDAVServerResult CalDAV::AddCalendar(string *CalendarName, string *CalendarShortName){ +CalDAVServerResult CalDAV::AddCalendar(string *calendarName, string *calendarShortName){ - CalDAVServerResult ServerResult; - CalDAVSendData CalendarAddSendData; + CalDAVServerResult serverResult; + CalDAVSendData calendarAddSendData; // Build the server address. - string UserPrincipalURI = ""; - UserPrincipalURI = GetUserPrincipal(); + string userPrincipalURI = ""; + userPrincipalURI = GetUserPrincipal(); - if (UserPrincipalURI.size() == 0){ + if (userPrincipalURI.size() == 0){ return ServerResult; } - string CalendarHomeURI = ""; - CalendarHomeURI = GetCalendarHome(UserPrincipalURI); + string calendarHomeURI = ""; + calendarHomeURI = GetCalendarHome(userPrincipalURI); // Generate the UUID. string UUIDValue = ""; - if (CalendarShortName == nullptr){ + if (calendarShortName == nullptr){ UUIDValue = GenerateUUID(); UUIDValue.erase(UUIDValue.end()-1); } else { - UUIDValue = *CalendarShortName; + UUIDValue = *calendarShortName; } - string CalendarHomeURL = CalendarHomeURI; - CalendarHomeURL.append(UUIDValue); - CalendarHomeURL.append("/"); + string calendarHomeURL = calendarHomeURI; + calendarHomeURL.append(UUIDValue); + calendarHomeURL.append("/"); // Build the calendar list address. - string CalendarListURLAddress = BuildServerAddress(&ConnectionData, CalendarHomeURL); + string calendarListURLAddress = BuildServerAddress(&connectionData, calendarHomeURL); - string CalendarAddRequest = "\n" + string calendarAddRequest = "\n" "\n" " \n" " \n" " "; - CalendarAddRequest += *CalendarName; - CalendarAddRequest += "\n" + calendarAddRequest += *calendarName; + calendarAddRequest += "\n" " \n" " \n" " \n" @@ -891,85 +891,85 @@ CalDAVServerResult CalDAV::AddCalendar(string *CalendarName, string *CalendarSho " \n" ""; - CalendarAddSendData.readptr = &CalendarAddRequest; - CalendarAddSendData.sizeleft = CalendarAddRequest.size(); + calendarAddSendData.readptr = &calendarAddRequest; + calendarAddSendData.sizeleft = calendarAddRequest.size(); // Setup the header. - struct curl_slist *CalendarRequestHeader = NULL; + struct curl_slist *calendarRequestHeader = NULL; //curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, CalendarRequestHeader); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, CalendarListURLAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, "MKCALENDAR"); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 1L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, &CalendarAddSendData); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, CalDAVSend); + curl_easy_setopt(connectionHandle, CURLOPT_URL, calendarListURLAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, "MKCALENDAR"); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 1L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, &calendarAddSendData); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, calDAVSend); // Process the data. - ServerData.clear(); - ServerHeader.clear(); + serverData.clear(); + serverHeader.clear(); - CURLcode ServerConnectionResult = curl_easy_perform(ConnectionHandle); + CURLcode serverConnectionResult = curl_easy_perform(connectionHandle); - if (ServerConnectionResult == CURLE_OK){ - ServerResult.Result = CALDAVQUERYRESULT_OK; + if (serverConnectionResult == CURLE_OK){ + serverResult.result = CALDAVQUERYRESULT_OK; } else { - ServerResult.Result = CALDAVQUERYRESULT_SERVERERROR; + serverResult.result = CALDAVQUERYRESULT_SERVERERROR; } - ServerResult.Code = ServerConnectionResult; - curl_easy_getinfo(ConnectionHandle, CURLINFO_RESPONSE_CODE, &ServerResult.HTTPCode); + serverResult.code = serverConnectionResult; + curl_easy_getinfo(connectionHandle, CURLINFO_RESPONSE_CODE, &serverResult.httpCode); // Restore the original settings. - string OriginalServerAddress = BuildServerAddress(&ConnectionData, "/principals/"); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, OriginalServerAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 0L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, NULL); + string originalServerAddress = BuildServerAddress(&connectionData, "/principals/"); + curl_easy_setopt(connectionHandle, CURLOPT_URL, originalServerAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 0L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, NULL); - return ServerResult; + return serverResult; } -CalDAVServerResult CalDAV::EditCalendarProcess(string *CalendarHREF, - string *CalendarName, - Colour *CalendarColour, - string *CalendarDescription, - int *CalendarOrder){ +CalDAVServerResult CalDAV::EditCalendarProcess(string *calendarHREF, + string *calendarName, + Colour *calendarColour, + string *calendarDescription, + int *calendarOrder){ - CalDAVServerResult ServerResult; - CalDAVSendData CalendarEditSendData; + CalDAVServerResult serverResult; + CalDAVSendData calendarEditSendData; // Build the server address. - string UserPrincipalURI = ""; - UserPrincipalURI = GetUserPrincipal(); + string userPrincipalURI = ""; + userPrincipalURI = GetUserPrincipal(); - if (UserPrincipalURI.size() == 0){ + if (userPrincipalURI.size() == 0){ - return ServerResult; + return serverResult; } - string CalendarHomeURI = ""; - CalendarHomeURI = GetCalendarHome(UserPrincipalURI); + string calendarHomeURI = ""; + calendarHomeURI = GetCalendarHome(userPrincipalURI); // Generate the UUID. string UUIDValue = GenerateUUID(); UUIDValue.erase(UUIDValue.end()-1); - string CalendarHomeURL = CalendarHomeURI; - CalendarHomeURL.append(UUIDValue); - CalendarHomeURL.append("/"); + string calendarHomeURL = calendarHomeURI; + calendarHomeURL.append(UUIDValue); + calendarHomeURL.append("/"); // Build the calendar list address. - string CalendarEditURLAddress = BuildServerAddress(&ConnectionData, (*CalendarHREF)); + string calendarEditURLAddress = BuildServerAddress(&connectionData, (*calendarHREF)); - string CalendarEditRequest = "\n" + string calendarEditRequest = "\n" "\n" " \n" @@ -977,105 +977,105 @@ CalDAVServerResult CalDAV::EditCalendarProcess(string *CalendarHREF, // Update the calendar name. - if (CalendarName != nullptr){ + if (calendarName != nullptr){ - CalendarEditRequest += ""; - CalendarEditRequest += (*CalendarName); - CalendarEditRequest += "\n"; + calendarEditRequest += ""; + calendarEditRequest += (*calendarName); + calendarEditRequest += "\n"; } // Update the calendar colour. - if (CalendarColour != nullptr){ + if (calendarColour != nullptr){ - CalendarEditRequest += ""; - CalendarEditRequest += (*CalendarColour); - CalendarEditRequest += "\n"; + calendarEditRequest += ""; + calendarEditRequest += (*calendarColour); + calendarEditRequest += "\n"; } // Update the calendar description. - if (CalendarDescription != nullptr){ + if (calendarDescription != nullptr){ - CalendarEditRequest += ""; - CalendarEditRequest += (*CalendarDescription); - CalendarEditRequest += "\n"; + calendarEditRequest += ""; + calendarEditRequest += (*calendarDescription); + calendarEditRequest += "\n"; } // Update the calendar order. - if (CalendarOrder != nullptr){ + if (calendarOrder != nullptr){ - CalendarEditRequest += ""; - CalendarEditRequest += to_string((*CalendarOrder)); - CalendarEditRequest += "\n"; + calendarEditRequest += ""; + calendarEditRequest += to_string((*calendarOrder)); + calendarEditRequest += "\n"; } - CalendarEditRequest += " \n" + calendarEditRequest += " \n" " \n" ""; - CalendarEditSendData.readptr = &CalendarEditRequest; - CalendarEditSendData.sizeleft = CalendarEditRequest.size(); + calendarEditSendData.readptr = &calendarEditRequest; + calendarEditSendData.sizeleft = calendarEditRequest.size(); // Setup the header. - struct curl_slist *CalendarRequestHeader = NULL; + struct curl_slist *calendarRequestHeader = NULL; //curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, CalendarRequestHeader); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, CalendarEditURLAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, "PROPPATCH"); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 1L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, &CalendarEditSendData); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, CalDAVSend); + curl_easy_setopt(connectionHandle, CURLOPT_URL, calendarEditURLAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, "PROPPATCH"); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 1L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, &calendarEditSendData); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, calDAVSend); // Process the data. - ServerData.clear(); - ServerHeader.clear(); + serverData.clear(); + serverHeader.clear(); - CURLcode ServerConnectionResult = curl_easy_perform(ConnectionHandle); + CURLcode serverConnectionResult = curl_easy_perform(connectionHandle); - if (ServerConnectionResult == CURLE_OK){ - ServerResult.Result = CALDAVQUERYRESULT_OK; + if (serverConnectionRsult == CURLE_OK){ + serverResult.result = CALDAVQUERYRESULT_OK; } else { - ServerResult.Result = CALDAVQUERYRESULT_SERVERERROR; + serverResult.result = CALDAVQUERYRESULT_SERVERERROR; } - ServerResult.Code = ServerConnectionResult; - curl_easy_getinfo(ConnectionHandle, CURLINFO_RESPONSE_CODE, &ServerResult.HTTPCode); + serverResult.code = serverConnectionResult; + curl_easy_getinfo(connectionHandle, CURLINFO_RESPONSE_CODE, &serverResult.httpCode); // Restore the original settings. - string OriginalServerAddress = BuildServerAddress(&ConnectionData, "/principals/"); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, OriginalServerAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 0L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, NULL); + string originalServerAddress = BuildServerAddress(&connectionData, "/principals/"); + curl_easy_setopt(connectionHandle, CURLOPT_URL, originalServerAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 0L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, NULL); return ServerResult; } -CalDAVServerResult CalDAV::EditCalendar(string *CalendarHREF, - string *CalendarName, - Colour *CalendarColour, - string *CalendarDescription, - int *CalendarOrder){ - - CalDAVServerResult ServerResult; - - ServerResult = EditCalendarProcess(CalendarHREF, - CalendarName, - CalendarColour, - CalendarDescription, - CalendarOrder); +CalDAVServerResult CalDAV::EditCalendar(string *calendarHREF, + string *calendarName, + Colour *calendarColour, + string *calendarDescription, + int *calendarOrder){ + + CalDAVServerResult serverResult; + + serverResult = EditCalendarProcess(calendarHREF, + calendarName, + calendarColour, + calendarDescription, + calendarOrder); - return ServerResult; + return serverResult; } @@ -1083,390 +1083,390 @@ CalDAVServerResult CalDAV::EditCalendar(string *CalendarHREF, Colour *CalendarColour){ - CalDAVServerResult ServerResult; + CalDAVServerResult serverResult; - ServerResult = EditCalendarProcess(CalendarHREF, + serverResult = EditCalendarProcess(calendarHREF, nullptr, - CalendarColour, + calendarColour, nullptr, nullptr); - return ServerResult; + return serverResult; } -CalDAVServerResult CalDAV::EditCalendar(string *CalendarHREF, - string *CalendarName){ +CalDAVServerResult CalDAV::EditCalendar(string *calendarHREF, + string *calendarName){ - CalDAVServerResult ServerResult; + CalDAVServerResult serverResult; - ServerResult = EditCalendarProcess(CalendarHREF, - CalendarName, + serverResult = EditCalendarProcess(calendarHREF, + calendarName, nullptr, nullptr, nullptr); - return ServerResult; + return serverResult; } -CalDAVServerResult CalDAV::EditCalendar(string *CalendarHREF, - int *CalendarOrder){ +CalDAVServerResult CalDAV::EditCalendar(string *calendarHREF, + int *calendarOrder){ - CalDAVServerResult ServerResult; + CalDAVServerResult serverResult; - ServerResult = EditCalendarProcess(CalendarHREF, + serverResult = EditCalendarProcess(calendarHREF, nullptr, nullptr, nullptr, - CalendarOrder); + calendarOrder); - return ServerResult; + return serverResult; } -CalDAVServerResult CalDAV::EditCalendarDescription(string *CalendarHREF, - string *CalendarDescription){ +CalDAVServerResult CalDAV::EditCalendarDescription(string *calendarHREF, + string *calendarDescription){ - CalDAVServerResult ServerResult; + CalDAVServerResult serverResult; - ServerResult = EditCalendarProcess(CalendarHREF, + serverResult = EditCalendarProcess(calendarHREF, nullptr, nullptr, - CalendarDescription, + calendarDescription, nullptr); - return ServerResult; + return serverResult; } -CalDAVServerResult CalDAV::DeleteCalendar(string *CalendarHREF){ +CalDAVServerResult CalDAV::DeleteCalendar(string *calendarHREF){ - CalDAVServerResult ServerResult; + CalDAVServerResult serverResult; // Build the server address. - string UserPrincipalURI = ""; - UserPrincipalURI = GetUserPrincipal(); + string userPrincipalURI = ""; + userPrincipalURI = GetUserPrincipal(); - if (UserPrincipalURI.size() == 0){ + if (userPrincipalURI.size() == 0){ - return ServerResult; + return serverResult; } - string CalendarHomeURI = ""; - CalendarHomeURI = GetCalendarHome(UserPrincipalURI); + string calendarHomeURI = ""; + calendarHomeURI = GetCalendarHome(userPrincipalURI); // Generate the UUID. string UUIDValue = GenerateUUID(); UUIDValue.erase(UUIDValue.end()-1); - string CalendarHomeURL = CalendarHomeURI; - CalendarHomeURL.append(UUIDValue); - CalendarHomeURL.append("/"); + string calendarHomeURL = calendarHomeURI; + calendarHomeURL.append(UUIDValue); + calendarHomeURL.append("/"); // Build the calendar list address. - struct curl_slist *DeleteRequestHeader = NULL; + struct curl_slist *deleteRequestHeader = NULL; - DeleteRequestHeader = curl_slist_append(DeleteRequestHeader, "Depth: infinity"); + deleteRequestHeader = curl_slist_append(deleteRequestHeader, "Depth: infinity"); - string CalendarDeleteURLAddress = BuildServerAddress(&ConnectionData, (*CalendarHREF)); + string calendarDeleteURLAddress = BuildServerAddress(&connectionData, (*calendarHREF)); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, DeleteRequestHeader); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, CalendarDeleteURLAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, deleteRequestHeader); + curl_easy_setopt(connectionHandle, CURLOPT_URL, calendarDeleteURLAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, "DELETE"); // Delete the calendar. - ServerData.clear(); - ServerHeader.clear(); + serverData.clear(); + serverHeader.clear(); - CURLcode ServerConnectionResult = curl_easy_perform(ConnectionHandle); + CURLcode serverConnectionResult = curl_easy_perform(connectionHandle); - if (ServerConnectionResult == CURLE_OK){ - ServerResult.Result = CALDAVQUERYRESULT_OK; + if (serverConnectionResult == CURLE_OK){ + serverResult.Result = CALDAVQUERYRESULT_OK; } else { - ServerResult.Result = CALDAVQUERYRESULT_SERVERERROR; + serverResult.Result = CALDAVQUERYRESULT_SERVERERROR; } - ServerResult.Code = ServerConnectionResult; - curl_easy_getinfo(ConnectionHandle, CURLINFO_RESPONSE_CODE, &ServerResult.HTTPCode); + serverResult.code = serverConnectionResult; + curl_easy_getinfo(connectionHandle, CURLINFO_RESPONSE_CODE, &serverResult.httpCode); // Restore the original settings. - string OriginalServerAddress = BuildServerAddress(&ConnectionData, "/principals/"); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, OriginalServerAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 0L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, NULL); + string originalServerAddress = BuildServerAddress(&connectionData, "/principals/"); + curl_easy_setopt(connectionHandle, CURLOPT_URL, originalServerAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 0L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, NULL); - return ServerResult; + return serverResult; } -CalDAVServerResult CalDAV::GetEntryETag(string *CalendarEntryHREF, string *ETagValue){ +CalDAVServerResult CalDAV::GetEntryETag(string *calendarEntryHREF, string *eTagValue){ - CalDAVServerResult ServerResult; - CalDAVSendData EntryETagGetData; + CalDAVServerResult serverResult; + CalDAVSendData entryETagGetData; // Build the server address. - string UserPrincipalURI = ""; - UserPrincipalURI = GetUserPrincipal(); + string userPrincipalURI = ""; + userPrincipalURI = GetUserPrincipal(); - if (UserPrincipalURI.size() == 0){ + if (userPrincipalURI.size() == 0){ - return ServerResult; + return serverResult; } - string CalendarHomeURI = ""; - CalendarHomeURI = GetCalendarHome(UserPrincipalURI); + string calendarHomeURI = ""; + calendarHomeURI = GetCalendarHome(userPrincipalURI); // Split the path and filename. - string EntryURIPath; - string EntryFilename; + string entryURIPath; + string entryFilename; - SplitPathFilename(CalendarEntryHREF, &EntryURIPath, &EntryFilename); + SplitPathFilename(calendarEntryHREF, &entryURIPath, &entryFilename); // Build the request for the server. - string EntryETagRequest = "\n" + string entryETagRequest = "\n" "\n" " \n" " \n" " \n" " "; - EntryETagRequest += (*CalendarEntryHREF); - EntryETagRequest += "\n" + entryETagRequest += (*calendarEntryHREF); + entryETagRequest += "\n" ""; - EntryETagGetData.readptr = &EntryETagRequest; - EntryETagGetData.sizeleft = EntryETagRequest.size(); + entryETagGetData.readptr = &entryETagRequest; + entryETagGetData.sizeleft = entryETagRequest.size(); // Build the calendar list address. - struct curl_slist *GetETagRequestHeader = NULL; + struct curl_slist *getETagRequestHeader = NULL; - GetETagRequestHeader = curl_slist_append(GetETagRequestHeader, "Depth: 1"); - GetETagRequestHeader = curl_slist_append(GetETagRequestHeader, "Prefer: return-minimal"); - GetETagRequestHeader = curl_slist_append(GetETagRequestHeader, "Content-Type: application/xml; charset=utf-8"); + getETagRequestHeader = curl_slist_append(getETagRequestHeader, "Depth: 1"); + getETagRequestHeader = curl_slist_append(getETagRequestHeader, "Prefer: return-minimal"); + getETagRequestHeader = curl_slist_append(getETagRequestHeader, "Content-Type: application/xml; charset=utf-8"); - string GetETagURLAddress = BuildServerAddress(&ConnectionData, EntryURIPath); + string getETagURLAddress = BuildServerAddress(&connectionData, entryURIPath); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, GetETagRequestHeader); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, GetETagURLAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, "REPORT"); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 1L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, &EntryETagGetData); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, CalDAVSend); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, getETagRequestHeader); + curl_easy_setopt(connectionHandle, CURLOPT_URL, getETagURLAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, "REPORT"); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 1L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, &entryETagGetData); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, calDAVSend); // Attempt to get the entity tag. - ServerData.clear(); - ServerHeader.clear(); + serverData.clear(); + serverHeader.clear(); - CURLcode ServerConnectionResult = curl_easy_perform(ConnectionHandle); + CURLcode serverConnectionResult = curl_easy_perform(connectionHandle); - if (ServerConnectionResult == CURLE_OK){ - ServerResult.Result = CALDAVQUERYRESULT_OK; + if (serverConnectionResult == CURLE_OK){ + serverResult.result = CALDAVQUERYRESULT_OK; } else { - ServerResult.Result = CALDAVQUERYRESULT_SERVERERROR; + serverResult.result = CALDAVQUERYRESULT_SERVERERROR; } - ServerResult.Code = ServerConnectionResult; - curl_easy_getinfo(ConnectionHandle, CURLINFO_RESPONSE_CODE, &ServerResult.HTTPCode); + serverResult.code = serverConnectionResult; + curl_easy_getinfo(connectionHandle, CURLINFO_RESPONSE_CODE, &serverResult.httpCode); - if (ServerConnectionResult != CURLE_OK){ - return ServerResult; + if (serverConnectionResult != CURLE_OK){ + return serverResult; } // Get the entity tag from the result. - *ETagValue = ProcessXMLEntryETag(); + *eTagValue = ProcessXMLEntryETag(); // Restore the original settings. - string OriginalServerAddress = BuildServerAddress(&ConnectionData, "/principals/"); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, OriginalServerAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 0L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, NULL); + string originalServerAddress = BuildServerAddress(&connectionData, "/principals/"); + curl_easy_setopt(connectionHandle, CURLOPT_URL, originalServerAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 0L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, NULL); - return ServerResult; + return serverResult; } -CalDAVServerResult CalDAV::AddEntry(string *CalendarEntryHREF, string *EntryData){ +CalDAVServerResult CalDAV::AddEntry(string *calendarEntryHREF, string *entryData){ // Add an entry to the calendar collection. - CalDAVServerResult ServerResult; - CalDAVSendData EntryAddSendData; + CalDAVServerResult serverResult; + CalDAVSendData entryAddSendData; // Build the calendar list address. - string EntryAddURLAddress = BuildServerAddress(&ConnectionData, (*CalendarEntryHREF)); + string entryAddURLAddress = BuildServerAddress(&connectionData, (*calendarEntryHREF)); - EntryAddSendData.readptr = EntryData; - EntryAddSendData.sizeleft = EntryData->size(); + entryAddSendData.readptr = entryData; + entryAddSendData.sizeleft = entryData->size(); - struct curl_slist *CalendarRequestHeader = NULL; + struct curl_slist *calendarRequestHeader = NULL; - CalendarRequestHeader = curl_slist_append(CalendarRequestHeader, "Content-Type: text/calendar; charset=utf-8"); + calendarRequestHeader = curl_slist_append(calendarRequestHeader, "Content-Type: text/calendar; charset=utf-8"); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, CalendarRequestHeader); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, EntryAddURLAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, "PUT"); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 1L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, &EntryAddSendData); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, CalDAVSend); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, calendarRequestHeader); + curl_easy_setopt(connectionHandle, CURLOPT_URL, entryAddURLAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, "PUT"); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 1L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, &entryAddSendData); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, calDAVSend); // Process the data. - ServerData.clear(); - ServerHeader.clear(); + serverData.clear(); + serverHeader.clear(); - CURLcode ServerConnectionResult = curl_easy_perform(ConnectionHandle); + CURLcode serverConnectionResult = curl_easy_perform(connectionHandle); - if (ServerConnectionResult == CURLE_OK){ - ServerResult.Result = CALDAVQUERYRESULT_OK; + if (serverConnectionResult == CURLE_OK){ + serverResult.result = CALDAVQUERYRESULT_OK; } else { - ServerResult.Result = CALDAVQUERYRESULT_SERVERERROR; + serverResult.result = CALDAVQUERYRESULT_SERVERERROR; } - ServerResult.Code = ServerConnectionResult; - curl_easy_getinfo(ConnectionHandle, CURLINFO_RESPONSE_CODE, &ServerResult.HTTPCode); + serverResult.code = serverConnectionResult; + curl_easy_getinfo(connectionHandle, CURLINFO_RESPONSE_CODE, &serverResult.httpCode); // Restore the original settings. - string OriginalServerAddress = BuildServerAddress(&ConnectionData, "/principals/"); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, OriginalServerAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 0L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, NULL); + string originalServerAddress = BuildServerAddress(&connectionData, "/principals/"); + curl_easy_setopt(connectionHandle, CURLOPT_URL, originalServerAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 0L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, NULL); - return ServerResult; + return serverResult; } -CalDAVServerResult CalDAV::EditEntry(string *CalendarEntryHREF, string *EntryData, string *EntryETag){ +CalDAVServerResult CalDAV::EditEntry(string *calendarEntryHREF, string *entryData, string *entryETag){ // Edit an entry in the calendar collection. // Add an entry to the calendar collection. - CalDAVServerResult ServerResult; - CalDAVSendData EntryAddSendData; + CalDAVServerResult serverResult; + CalDAVSendData entryAddSendData; // Build the calendar list address. - string EntryAddURLAddress = BuildServerAddress(&ConnectionData, (*CalendarEntryHREF)); + string entryAddURLAddress = BuildServerAddress(&connectionData, (*calendarEntryHREF)); - EntryAddSendData.readptr = EntryData; - EntryAddSendData.sizeleft = EntryData->size(); + entryAddSendData.readptr = entryData; + entryAddSendData.sizeleft = entryData->size(); - string IfMatchHeader = "If-Match: \""; - IfMatchHeader.append(*EntryETag); - IfMatchHeader.append("\""); + string ifMatchHeader = "If-Match: \""; + ifMatchHeader.append(*entryETag); + ifMatchHeader.append("\""); - struct curl_slist *CalendarRequestHeader = NULL; + struct curl_slist *calendarRequestHeader = NULL; - CalendarRequestHeader = curl_slist_append(CalendarRequestHeader, "Content-Type: text/calendar; charset=utf-8"); - CalendarRequestHeader = curl_slist_append(CalendarRequestHeader, IfMatchHeader.c_str()); + calendarRequestHeader = curl_slist_append(calendarRequestHeader, "Content-Type: text/calendar; charset=utf-8"); + calendarRequestHeader = curl_slist_append(calendarRequestHeader, ifMatchHeader.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, CalendarRequestHeader); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, EntryAddURLAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, "PUT"); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 1L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, &EntryAddSendData); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, CalDAVSend); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, calendarRequestHeader); + curl_easy_setopt(connectionHandle, CURLOPT_URL, entryAddURLAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, "PUT"); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 1L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, &entryAddSendData); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, calDAVSend); // Process the data. - ServerData.clear(); - ServerHeader.clear(); + serverData.clear(); + serverHeader.clear(); - CURLcode ServerConnectionResult = curl_easy_perform(ConnectionHandle); + CURLcode serverConnectionResult = curl_easy_perform(connectionHandle); - if (ServerConnectionResult == CURLE_OK){ - ServerResult.Result = CALDAVQUERYRESULT_OK; + if (serverConnectionResult == CURLE_OK){ + serverResult.result = CALDAVQUERYRESULT_OK; } else { - ServerResult.Result = CALDAVQUERYRESULT_SERVERERROR; + serverResult.result = CALDAVQUERYRESULT_SERVERERROR; } - ServerResult.Code = ServerConnectionResult; - curl_easy_getinfo(ConnectionHandle, CURLINFO_RESPONSE_CODE, &ServerResult.HTTPCode); + serverResult.code = serverConnectionResult; + curl_easy_getinfo(connectionHandle, CURLINFO_RESPONSE_CODE, &serverResult.httpCode); // Restore the original settings. - string OriginalServerAddress = BuildServerAddress(&ConnectionData, "/principals/"); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, OriginalServerAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 0L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, NULL); + string originalServerAddress = BuildServerAddress(&connectionData, "/principals/"); + curl_easy_setopt(connectionHandle, CURLOPT_URL, originalServerAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 0L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, NULL); - return ServerResult; + return serverResult; } -CalDAVServerResult CalDAV::DeleteEntry(string *CalendarEntryHREF){ +CalDAVServerResult CalDAV::DeleteEntry(string *calendarEntryHREF){ // Delete an entry in the calendar collection. - CalDAVServerResult ServerResult; + CalDAVServerResult serverResult; // Build the calendar list address. - string EntryDeleteURLAddress = BuildServerAddress(&ConnectionData, (*CalendarEntryHREF)); + string entryDeleteURLAddress = BuildServerAddress(&connectionData, (*calendarEntryHREF)); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, EntryDeleteURLAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_URL, entryDeleteURLAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, "DELETE"); // Delete the calendar. - ServerData.clear(); - ServerHeader.clear(); + serverData.clear(); + serverHeader.clear(); - CURLcode ServerConnectionResult = curl_easy_perform(ConnectionHandle); + CURLcode serverConnectionResult = curl_easy_perform(connectionHandle); - if (ServerConnectionResult == CURLE_OK){ - ServerResult.Result = CALDAVQUERYRESULT_OK; + if (serverConnectionResult == CURLE_OK){ + serverResult.result = CALDAVQUERYRESULT_OK; } else { - ServerResult.Result = CALDAVQUERYRESULT_SERVERERROR; + serverResult.result = CALDAVQUERYRESULT_SERVERERROR; } - ServerResult.Code = ServerConnectionResult; - curl_easy_getinfo(ConnectionHandle, CURLINFO_RESPONSE_CODE, &ServerResult.HTTPCode); + serverResult.code = serverConnectionResult; + curl_easy_getinfo(connectionHandle, CURLINFO_RESPONSE_CODE, &serverResult.httpCode); // Restore the original settings. - string OriginalServerAddress = BuildServerAddress(&ConnectionData, "/principals/"); - curl_easy_setopt(ConnectionHandle, CURLOPT_URL, OriginalServerAddress.c_str()); - curl_easy_setopt(ConnectionHandle, CURLOPT_CUSTOMREQUEST, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_UPLOAD, 0L); - curl_easy_setopt(ConnectionHandle, CURLOPT_READDATA, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_READFUNCTION, NULL); - curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPHEADER, NULL); + string originalServerAddress = BuildServerAddress(&connectionData, "/principals/"); + curl_easy_setopt(connectionHandle, CURLOPT_URL, originalServerAddress.c_str()); + curl_easy_setopt(connectionHandle, CURLOPT_CUSTOMREQUEST, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_UPLOAD, 0L); + curl_easy_setopt(connectionHandle, CURLOPT_READDATA, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_READFUNCTION, NULL); + curl_easy_setopt(connectionHandle, CURLOPT_HTTPHEADER, NULL); - return ServerResult; + return serverResult; } -bool CalDAVObjectValidSettings(CalDAVConnectionData *ConnData){ +bool CalDAVObjectValidSettings(CalDAVConnectionData *connData){ // Check if the passed CalDAV Connection Data is has // an address set. Return false if nullptr is used. - if (ConnData == nullptr){ + if (connData == nullptr){ return false; @@ -1475,7 +1475,7 @@ bool CalDAVObjectValidSettings(CalDAVConnectionData *ConnData){ // Check the server hostname. Return false // if no value has been set. - if (ConnData->Hostname.size() == 0){ + if (connData->hostname.size() == 0){ return false; @@ -1485,7 +1485,7 @@ bool CalDAVObjectValidSettings(CalDAVConnectionData *ConnData){ // no value has been set or the port number // is less than 1 or higher than 65535. - if (ConnData->Port < 1 || ConnData->Port > 65535){ + if (connData->port < 1 || connData->port > 65535){ return false; @@ -1494,7 +1494,7 @@ bool CalDAVObjectValidSettings(CalDAVConnectionData *ConnData){ // Check the server username. Return false // if no value has been set. - if (ConnData->Username.size() == 0){ + if (connData->username.size() == 0){ return false; @@ -1503,7 +1503,7 @@ bool CalDAVObjectValidSettings(CalDAVConnectionData *ConnData){ // Check the server password. Return false // if no value has been set. - if (ConnData->Password.size() == 0){ + if (connData->password.size() == 0){ return false; @@ -1522,30 +1522,30 @@ bool CalDAVObjectValidSettings(CalDAVConnectionData *ConnData){ } -string BuildServerAddress(CalDAVConnectionData *ConnData, string URIAddress){ +string BuildServerAddress(CalDAVConnectionData *connData, string uriAddress){ - string ServerAddress; + string serverAddress; // Setup the server address. - if (ConnData->UseSSL == true){ - ServerAddress += "https://"; + if (connData->useSSL == true){ + serverAddress += "https://"; } else { - ServerAddress += "http://"; + serverAddress += "http://"; } - ServerAddress += ConnData->Hostname; + serverAddress += connData->hostname; // Check if server port is 80, otherwise // specifiy the port number in the address. - if (ConnData->Port != 80){ - ServerAddress += ":"; - ServerAddress += to_string(ConnData->Port); + if (connData->port != 80){ + serverAddress += ":"; + serverAddress += to_string(connData->port); } - ServerAddress += URIAddress; + serverAddress += uriAddress; - return ServerAddress; + return serverAddress; } \ No newline at end of file diff --git a/source/objects/CalDAV/CalDAV.h b/source/objects/CalDAV/CalDAV.h index 5629b87..148f2d0 100644 --- a/source/objects/CalDAV/CalDAV.h +++ b/source/objects/CalDAV/CalDAV.h @@ -45,33 +45,33 @@ enum CalDAVQueryResult { struct CalDAVCalendarList { - map Name; - map HREF; - map Order; - map Description; - map CalColour; - map Tag; - map TagURL; + map name; + map href; + map order; + map description; + map calColour; + map tag; + map tagURL; }; struct CalDAVEntryList { - map HREF; - map Data; - map Tag; + map href; + map data; + map tag; }; struct CalDAVConnectionData{ - string Hostname = ""; - int Port = 8008; - string Username = ""; - string Password = ""; - string Prefix = ""; - bool UseSSL = true; - int Timeout = 60; + string hostname = ""; + int port = 8008; + string username = ""; + string password = ""; + string prefix = ""; + bool useSSL = true; + int timeout = 60; }; @@ -82,12 +82,12 @@ struct CalDAVConnectionData{ struct CalDAVStatus{ - string Hostname; - int Port; - string Username; - string Prefix; - bool UseSSL; - int Timeout; + string hostname; + int port; + string username; + string prefix; + bool useSSL; + int timeout; }; @@ -99,7 +99,7 @@ struct CalDAVServerSupport{ // Variable name. Name in CalDAV header. - bool BasicSupport = false; // calendar-access + bool basicSupport = false; // calendar-access }; @@ -110,9 +110,9 @@ struct CalDAVServerSupport{ struct CalDAVServerResult{ - CalDAVQueryResult Result = CALDAVQUERYRESULT_NOTRUN; - CURLcode Code = CURLE_OK; - long HTTPCode = 0; + CalDAVQueryResult result = CALDAVQUERYRESULT_NOTRUN; + CURLcode code = CURLE_OK; + long httpCode = 0; }; @@ -135,67 +135,67 @@ class CalDAV{ CalDAVEntryList ProcessXMLEntryList(); CalDAVEntryList ProcessXMLSyncTokenList(); string ProcessXMLEntryETag(); - bool MatchXMLNameTransverse(xmlNodePtr *NodePtr, string NodeName); - bool MatchXMLName(xmlNodePtr *NodePtrOriginal, string NodeName); - string FetchXMLData(xmlNodePtr *NodePtr); - CalDAVServerResult EditCalendarProcess(string *CalendarHREF, - string *CalendarName, - Colour *CalendarColour, - string *CalendarDescription, - int *CalendarOrder); + bool MatchXMLNameTransverse(xmlNodePtr *nodePtr, string nodeName); + bool MatchXMLName(xmlNodePtr *nodePtrOriginal, string nodeName); + string FetchXMLData(xmlNodePtr *nodePtr); + CalDAVServerResult EditCalendarProcess(string *calendarHREF, + string *calendarName, + Colour *calendarColour, + string *calendarDescription, + int *calendarOrder); - CalDAVConnectionData ConnectionData; - CalDAVServerResult ConnectionServerResult; - CURL *ConnectionHandle = nullptr; - string ServerData = ""; - string ServerHeader = ""; + CalDAVConnectionData connectionData; + CalDAVServerResult connectionServerResult; + CURL *connectionHandle = nullptr; + string serverData = ""; + string serverHeader = ""; public: CalDAV(); ~CalDAV(); - void SetupConnectionData(CalDAVConnectionData *ConnData); + void SetupConnectionData(CalDAVConnectionData *connData); CalDAVStatus GetConnectionData(); CalDAVServerResult Connect(); CalDAVServerResult GetServerResult(); CalDAVServerSupport GetServerSupport(); CalDAVCalendarList GetCalendars(); - CalDAVEntryList GetEntryList(string *CalendarHREF); - CalDAVEntryList GetEntryList(string *CalendarHREF, string *CalendarTag); + CalDAVEntryList GetEntryList(string *calendarHREF); + CalDAVEntryList GetEntryList(string *calendarHREF, string *calendarTag); - CalDAVServerResult AddCalendar(string CalendarName); - CalDAVServerResult AddCalendar(string *CalendarName, string *CalendarShortName); + CalDAVServerResult AddCalendar(string calendarName); + CalDAVServerResult AddCalendar(string *calendarName, string *calendarShortName); - CalDAVServerResult EditCalendar(string *CalendarHREF, - string *CalendarName, - Colour *CalendarColour, - string *CalendarDescription, - int *CalendarOrder); - CalDAVServerResult EditCalendar(string *CalendarHREF, - Colour *CalendarColour); - CalDAVServerResult EditCalendar(string *CalendarHREF, - string *CalendarName); - CalDAVServerResult EditCalendar(string *CalendarHREF, - int *CalendarOrder); - CalDAVServerResult EditCalendarDescription(string *CalendarHREF, - string *CalendarDescription); + CalDAVServerResult EditCalendar(string *calendarHREF, + string *calendarName, + Colour *calendarColour, + string *calendarDescription, + int *calendarOrder); + CalDAVServerResult EditCalendar(string *calendarHREF, + Colour *calendarColour); + CalDAVServerResult EditCalendar(string *calendarHREF, + string *calendarName); + CalDAVServerResult EditCalendar(string *calendarHREF, + int *calendarOrder); + CalDAVServerResult EditCalendarDescription(string *calendarHREF, + string *calendarDescription); - CalDAVServerResult DeleteCalendar(string *CalendarHREF); + CalDAVServerResult DeleteCalendar(string *calendarHREF); - CalDAVServerResult AddEntry(string *CalendarEntryHREF, string *EntryData); - CalDAVServerResult EditEntry(string *CalendarEntryHREF, string *EntryData, string *EntryETag); - CalDAVServerResult DeleteEntry(string *CalendarEntryHREF); + CalDAVServerResult AddEntry(string *calendarEntryHREF, string *entryData); + CalDAVServerResult EditEntry(string *calendarEntryHREF, string *entryData, string *entryETag); + CalDAVServerResult DeleteEntry(string *calendarEntryHREF); string GetUserPrincipal(); - string GetCalendarHome(string UserPrincipalURI); + string GetCalendarHome(string userPrincipalURI); - CalDAVServerResult GetEntryETag(string *CalendarEntryHREF, string *ETagValue); + CalDAVServerResult GetEntryETag(string *calendarEntryHREF, string *eTagValue); }; // Subroutines that are used with the // CalDAVConnectionData struct. -bool CalDAVObjectValidSettings(CalDAVConnectionData *ConnData); -string BuildServerAddress(CalDAVConnectionData *ConnData, string URIAddress); +bool CalDAVObjectValidSettings(CalDAVConnectionData *connData); +string BuildServerAddress(CalDAVConnectionData *connData, string uriAddress); #endif