Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
CalDAV: Implemented SSL support (taken from XAB)
[xestiacalendar/.git] / source / objects / CalDAV / CalDAV.h
index 7ca237a..cd873d8 100644 (file)
@@ -22,6 +22,8 @@
 #include <curl/curl.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
+#include <wx/tokenzr.h>
+#include <wx/file.h>
 #include <string>
 #include <iostream>
 #include <vector>
@@ -30,7 +32,9 @@
 #include "../../common/colour.h"
 #include "../../common/text.h"
 #include "../../common/uuid.h"
+#include "../../common/dirs.h"
 #include "../../common/sslcertstructs.h"
+#include "../../version.h"
 
 using namespace std;
 
@@ -41,7 +45,8 @@ enum CalDAVQueryResult {
        CALDAVQUERYRESULT_UNITTESTFAIL = -1,
        CALDAVQUERYRESULT_OK,
        CALDAVQUERYRESULT_NOTRUN,
-       CALDAVQUERYRESULT_SERVERERROR
+       CALDAVQUERYRESULT_SERVERERROR,
+       CALDAVQUERYRESULT_SSLFAILURE,
 };
 
 struct CalDAVCalendarList {
@@ -73,6 +78,7 @@ struct CalDAVConnectionData{
        string prefix = "";
        bool useSSL = true;
        int timeout = 60;
+       string account = "";
        
 };
 
@@ -155,22 +161,32 @@ class CalDAV{
                        Colour *calendarColour,
                        string *calendarDescription,
                        int *calendarOrder);
+               string BuildServerAddress(CalDAVConnectionData *connData, string uriAddress);
+               void SetupDefaultParametersNonSSL(bool doAuthentication);
+               void SetupDefaultParametersSSL(bool doAuthentication);
+               void ResetResults();
        
                CalDAVConnectionData connectionData;
                CalDAVServerResult connectionServerResult;
                CURL *connectionHandle = nullptr;
+               char sessionErrorBuffer[CURL_ERROR_SIZE];
                string serverData = "";
                string serverHeader = "";
        
-               COSSLVerified SSLVerified;
-               bool EnableSSLBypass = false;
-               bool SSLSelfSigned = false;
+               COSSLVerified sslVerified;
+               bool enableSSLBypass = false;
+               bool sslSelfSigned = false;
+               bool sslStatus = false;
+               
+               bool validResponse = false;
+               bool authPassed = false;
+               string errorMessage = "";
        public:
                CalDAV();
                ~CalDAV();
                void SetupConnectionData(CalDAVConnectionData *connData);
                CalDAVStatus GetConnectionData();
-               CalDAVServerResult Connect();
+               CalDAVServerResult Connect(bool doAuthentication);
                CalDAVServerResult GetServerResult();
                CalDAVServerSupport GetServerSupport();
                CalDAVCalendarList GetCalendars();
@@ -205,6 +221,12 @@ class CalDAV{
                
                CalDAVServerResult GetEntryETag(string *calendarEntryHREF, string *eTagValue);
 
+               bool CanDoSSL();
+               bool HasValidResponse();
+               bool AbleToLogin();
+               bool IsSelfSigned();
+               std::string GetErrorMessage();
+
                COSSLVerified SSLVerify();
                void BypassSSLVerification(bool EnableBypass);
                
@@ -226,6 +248,5 @@ class CalDAV{
 // CalDAVConnectionData struct.
 
 //bool CalDAVObjectValidSettings(CalDAVConnectionData *connData);
-//string BuildServerAddress(CalDAVConnectionData *connData, string uriAddress);
 
 #endif
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