From: Steve Brokenshire Date: Sun, 29 May 2016 19:01:58 +0000 (+0100) Subject: Added support to add a calendar using a shortname. X-Git-Tag: release-0.02~271 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=6db84a2ded5a6d8f10b341965e303f329588f293;p=xestiacalendar%2F.git Added support to add a calendar using a shortname. Added support to add a calendar using a shortname instead of a randomly generated UUID. --- diff --git a/source/objects/CalDAV/CalDAV.cpp b/source/objects/CalDAV/CalDAV.cpp index 68def69..38c5bdb 100644 --- a/source/objects/CalDAV/CalDAV.cpp +++ b/source/objects/CalDAV/CalDAV.cpp @@ -547,6 +547,16 @@ CalDAVCalendarList CalDAV::GetCalendars(){ CalDAVServerResult CalDAV::AddCalendar(string CalendarName){ + CalDAVServerResult ServerResult; + + AddCalendar(&CalendarName, nullptr); + + return ServerResult; + +} + +CalDAVServerResult CalDAV::AddCalendar(string *CalendarName, string *CalendarShortName){ + CalDAVServerResult ServerResult; CalDAVSendData CalendarAddSendData; @@ -566,9 +576,19 @@ CalDAVServerResult CalDAV::AddCalendar(string CalendarName){ // Generate the UUID. - string UUIDValue = GenerateUUID(); - UUIDValue.erase(UUIDValue.end()-1); + string UUIDValue = ""; + + if (CalendarShortName == nullptr){ + + UUIDValue = GenerateUUID(); + UUIDValue.erase(UUIDValue.end()-1); + + } else { + UUIDValue = *CalendarShortName; + + } + string CalendarHomeURL = CalendarHomeURI; CalendarHomeURL.append(UUIDValue); CalendarHomeURL.append("/"); @@ -582,7 +602,7 @@ CalDAVServerResult CalDAV::AddCalendar(string CalendarName){ " \n" " \n" " "; - CalendarAddRequest += CalendarName; + CalendarAddRequest += *CalendarName; CalendarAddRequest += "\n" " \n" " \n" diff --git a/source/objects/CalDAV/CalDAV.h b/source/objects/CalDAV/CalDAV.h index 332c91e..86e554b 100644 --- a/source/objects/CalDAV/CalDAV.h +++ b/source/objects/CalDAV/CalDAV.h @@ -153,6 +153,7 @@ class CalDAV{ CalDAVCalendarList GetCalendars(); CalDAVServerResult AddCalendar(string CalendarName); + CalDAVServerResult AddCalendar(string *CalendarName, string *CalendarShortName); CalDAVServerResult EditCalendar(string *CalendarHREF, string *CalendarName,