Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Initial import of code already done for Xestia Address Book
[xestiaab/.git] / source / carddav / carddav.h
1 #include <iostream>
2 #include <map>
3 #include <wx/wx.h>
4 #include <libxml/parser.h>
5 #include <libxml/tree.h>
6 #include <curl/curl.h>
7 #include "../vcard/vcard.h"
8 #include "../frmActivityMgr.h"
9 #include "../common/sslcertstructs.h"
11 #ifndef CALDAV_CALDAV_H
12 #define CALDAV_CALDAV_H
14 struct FileSyncData{
15         unsigned int DataFlag:2;
16         wxString ETagData;
17 };
19 struct ContactListData{
20         wxString SyncToken;
21         std::map<wxString,FileSyncData> ListData;
22 };
24 /*struct CertificateData{
25         std::multimap<wxString,wxString> CertificateData;
26         bool CertValid;
27         int CertError;
28 };
30 struct CertificateCollection{
31         std::map<int,CertificateData> Certificates;
32         std::map<int,int> ParentCerticiate;
33         bool AllCertsValid;
34         std::map<int,int> CertErrors;
35 };*/
37 //size_t WritebackFunc(char *ptr, size_t size, size_t nmemb, FILE *userdata);
39 size_t WritebackFunc(char *ptr, size_t size, size_t nmemb, wxString *userdata);
40 int ProgressFunc(void *clientdata, double TTDown, double NDown, double TTUp, double NUp);
42 class CardDAV
43 {
44         public:
45                 CardDAV();
46                 ~CardDAV();
47                 bool SetupConnection(wxString SvrAddress, int SvrPort, wxString SvrUser, wxString SvrPass, bool SvrSSL);
48                 bool SetupConnection(wxString SvrAddress, int SvrPort, wxString SvrUser, wxString SvrPass, bool SvrSSL, wxString SvrPrefix, wxString SvrAccount);
49                 bool CanDoCardDAV();
50                 bool CanDoSSL();
51                 bool SSLVerify();
52                 bool AbleToLogin();
53                 bool HasValidResponse();
54                 wxString GetResponseData();             
55                 bool Connect();
56                 bool ConnectThread();
57                 void ProcessData();
58                 void SetupData(wxString Method, wxString FilenameLocation, wxString UploadData);
59                 void ProcessDataThread();
60                 void SetUploadMode(bool IncMode);
61                 void Abort();
62                 bool SetupResultBools(bool *SvrResult, bool *SvrMonitor);
63                 int ProgressFuncProc(void *clientdata, double TTUp, double NUp, double TTDown, double NDown);
64                 void SetupVariables(std::map<int, int> *actlist, int actindex);
65                 wxString GetETagData();
66                 void GetServerETagValue();
67                 void GetServerETagValueThread();
68                 void GetServerContactData();
69                 wxString GetPageData();
70                 void SetEditMode(bool EditModeInc);
71                 ContactListData GetContactList(wxString SyncTokenInc);
72                 void SetServerFilename(wxString Filename);
73                 int GetResultCode();
74                 static int GetHTTPCode();
75                 wxString GetErrorBuffer();
76                 wxString GetDefaultAddressBookURL();
77                 void GetSSLResults();
78                 SSLCertCollection GetCertificateData();
79                 static SSLCertCollection BuildSSLCollection(CURL *conn);
80                 wxString ETagValueResult();
81                 wxString GetErrorMessage();
82                 //size_t WritebackFunc(char *ptr, size_t size, size_t nmemb, FILE *userdata);
83         private:
84                 static wxString ServerAddress;
85                 static int ServerPort;
86                 static wxString ServerUser;
87                 static wxString ServerPass;
88                 static wxString ServerPrefix;
89                 static wxString ServerAccount;
90                 static bool ServerSSL;
91                 static bool *ServerResult;
92                 static bool *ServerMonitor;
93                 static bool SSLStatus;
94                 static bool SSLVerified;
95                 static bool ValidResponse;
96                 static bool AuthPassed;
97                 static bool HasCalDAVSupport;
98                 static bool AbortConnection;
99                 static wxString ServerResponse;
100                 static wxString ServerMethod;
101                 static wxString ServerFilenameLocation;
102                 static wxString ServerUploadData;
103                 static wxString ETagData;
104                 static wxString ETagResult;
105                 static bool UploadMode;
106                 static bool EditMode;
107                 static long ItemIndex;
108                 static std::map<int, int> *ActivityListPtr;
109                 //frmActivityMgr *ActMgrPtr;
110                 static char curlerrbuffer[CURL_ERROR_SIZE];
111                 static SSLCertCollection SSLCertCol;
112                 static wxString ErrorMessage;
113         protected:
114                 static int SSLErrorCode;
115                 static int ConnectionErrorCode;
116                 static wxString PageHeader;
117                 static wxString PageData;
118                 static CURLcode claconncode;
119                 static int HTTPErrorCode;
120                                 
121 };
123 #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