#define __OBJECTS_CALDAV_CALDAV_H__
#include <curl/curl.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
#include <string>
+#include <iostream>
+#include <vector>
+#include <stdexcept>
using namespace std;
CALDAVQUERYRESULT_SERVERERROR
};
+struct CalDAVCalendarList {
+
+};
+
struct CalDAVConnectionData{
string Hostname = "";
string Password = "";
string Prefix = "";
bool UseSSL = true;
+ int Timeout = 60;
};
string Username;
string Prefix;
bool UseSSL;
+ int Timeout;
+
+};
+// CalDAVServerSupport: used for
+// getting what the server supports
+// from the CalDAV specification.
+
+struct CalDAVServerSupport{
+
+ // Variable name. Name in CalDAV header.
+
+ bool BasicSupport = false; // calendar-access
+
};
// CalDAVServerResult: used for
};
+// CalDAVSendData: used for
+// sending data to the CaLDAV
+// server.
+
+struct CalDAVSendData{
+ string *readptr;
+ long sizeleft;
+ int seek = 0;
+};
+
class CalDAV{
private:
+ string ProcessXMLUserPrincipal();
+ string ProcessXMLCalendarHome();
+ bool MatchXMLName(xmlNodePtr *NodePtr, string NodeName);
+ string FetchXMLData(xmlNodePtr *NodePtr);
+
CalDAVConnectionData ConnectionData;
+ CalDAVServerResult ConnectionServerResult;
CURL *ConnectionHandle = nullptr;
+ string ServerData = "";
+ string ServerHeader = "";
public:
+ CalDAV();
+ ~CalDAV();
void SetupConnectionData(CalDAVConnectionData *ConnData);
CalDAVStatus GetConnectionData();
CalDAVServerResult Connect();
- CalDAV();
- ~CalDAV();
+ CalDAVServerResult GetServerResult();
+ CalDAVServerSupport GetServerSupport();
+ CalDAVCalendarList GetCalendars();
+
+ string GetUserPrincipal();
+ string GetCalendarHome(string UserPrincipalURI);
};
// CalDAVConnectionData struct.
bool CalDAVObjectValidSettings(CalDAVConnectionData *ConnData);
+string BuildServerAddress(CalDAVConnectionData *ConnData, string URIAddress);
#endif