Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added support to add a calendar using a shortname.
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 29 May 2016 19:01:58 +0000 (20:01 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 29 May 2016 19:01:58 +0000 (20:01 +0100)
Added support to add a calendar using a shortname instead of a randomly
generated UUID.

source/objects/CalDAV/CalDAV.cpp
source/objects/CalDAV/CalDAV.h

index 68def69..38c5bdb 100644 (file)
@@ -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){
        " <d:set>\n"
        "  <d:prop>\n"
        "   <d:displayname>";
-       CalendarAddRequest += CalendarName;
+       CalendarAddRequest += *CalendarName;
        CalendarAddRequest += "</d:displayname>\n"
        "   <c:supported-calendar-component-set>\n"
        "    <c:comp name=\"VTODO\"/>\n"
index 332c91e..86e554b 100644 (file)
@@ -153,6 +153,7 @@ class CalDAV{
                CalDAVCalendarList GetCalendars();
        
                CalDAVServerResult AddCalendar(string CalendarName);
+               CalDAVServerResult AddCalendar(string *CalendarName, string *CalendarShortName);
        
                CalDAVServerResult EditCalendar(string *CalendarHREF,
                        string *CalendarName,
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy