\r
size_t WritebackFunc(char *ptr, size_t size, size_t nmemb, wxString *stream){\r
\r
+ // Writeback function for the CardDAV object.\r
+ \r
wxString Data;\r
Data = wxString::FromUTF8((char *)ptr);\r
\r
\r
int ProgressFunc(void *clientdata, double TTDown, double NDown, double TTUp, double NUp){\r
\r
+ // Progress function for the CardDAV object.\r
+ \r
int ProgressRet;\r
\r
CardDAV *IncCardDAV = static_cast<CardDAV*>(clientdata);\r
bool CardDAV::AllowSelfSign;\r
\r
CardDAV::CardDAV(){\r
+ \r
+ // Setup the CardDAV object.\r
+ \r
ServerPort = 8080;\r
SSLStatus = FALSE;\r
SSLVerified = FALSE;\r
UploadMode = FALSE;\r
EditMode = FALSE;\r
HTTPErrorCode = 0;\r
+ \r
}\r
\r
CardDAV::~CardDAV(){\r
\r
+ // Destroy the CardDAV object.\r
+ \r
}\r
\r
size_t UploadReadFunc(void *ptr, size_t size, size_t nmemb, void *userdata){\r
\r
+ \r
+ // Upload function for the CardDAV object.\r
+ \r
struct UploadDataStruc *UploadPtr = (struct UploadDataStruc *)userdata;\r
\r
if (UploadPtr->sizeleft){\r
\r
bool CardDAV::SetupConnection(wxString SvrAddress, int SvrPort, wxString SvrUser, wxString SvrPass, bool SvrSSL){\r
\r
+ // Setup the CardDAV connection without the prefix/account.\r
+ \r
ServerAddress = SvrAddress;\r
ServerPort = SvrPort;\r
ServerUser = SvrUser;\r
\r
bool CardDAV::SetupConnection(wxString SvrAddress, int SvrPort, wxString SvrUser, wxString SvrPass, bool SvrSSL, wxString SvrPrefix, wxString SvrAccount){\r
\r
+ // Setup the CardDAV connection with the prefix/account.\r
+ \r
ServerAddress = SvrAddress;\r
ServerPort = SvrPort;\r
ServerUser = SvrUser;\r
\r
bool CardDAV::SetupResultBools(bool *SvrResult, bool *SvrMonitor){\r
\r
+ // Setup the result booleans.\r
+ \r
ServerResult = SvrResult;\r
ServerMonitor = SvrMonitor;\r
\r
\r
bool CardDAV::HasValidResponse(){\r
\r
+ // Check that CardDAV server gave a valid response.\r
+ \r
return ValidResponse;\r
\r
}\r
\r
bool CardDAV::CanDoCardDAV(){\r
\r
+ // Check that the server has CardDAV support.\r
+ \r
return HasCalDAVSupport;\r
\r
}\r
\r
bool CardDAV::CanDoSSL(){\r
\r
+ // Check that the server can do SSL.\r
+ \r
return SSLStatus;\r
\r
}\r
\r
bool CardDAV::SSLVerify(){\r
\r
+ // Check that the server can verify SSL.\r
+ \r
return SSLVerified;\r
\r
}\r
\r
bool CardDAV::AbleToLogin(){\r
\r
+ // Check that the user is able to login.\r
+ \r
return AuthPassed;\r
\r
}\r
\r
bool CardDAV::IsSelfSigned(){\r
\r
+ // Check that self-signed certificates are allowed.\r
+ \r
return AllowSelfSign;\r
\r
}\r
\r
int CardDAV::ProgressFuncProc(void *clientdata, double TTUp, double NUp, double TTDown, double NDown){\r
\r
+ // Progress function processing.\r
+ \r
if (AbortConnection == TRUE){\r
\r
return -1;\r
\r
void CardDAV::Abort(){\r
\r
+ // Abort (close) the connection.\r
+ \r
AbortConnection = TRUE;\r
\r
}\r
\r
SSLCertCollection CardDAV::GetSSLVerifyResults(){\r
+ \r
+ // Get the SSL verification results.\r
+ \r
return VerifyCertCollection;\r
+ \r
}\r
\r
void CardDAV::AllowSelfSignTest(bool AllowSelfSignIn){\r
+ \r
+ // Set the value to enable/disable SSL self-signed certificates.\r
+ \r
AllowSelfSign = AllowSelfSignIn;\r
}\r
\r
void CardDAV::GetSSLResults(){\r
\r
- \r
+ // Get the SSL results.\r
\r
}\r
\r
void CardDAV::SetServerFilename(wxString Filename){\r
\r
+ // Set the server filename.\r
+ \r
ServerFilenameLocation = Filename;\r
\r
}\r
wxString CardDAV::GetPageData()\r
{\r
\r
+ // Get the server page data.\r
+ \r
return PageData;\r
\r
}\r
\r
wxString CardDAV::ETagValueResult(){\r
\r
+ // Get the ETag Result value.\r
+ \r
return ETagResult;\r
\r
}\r
\r
void CardDAV::SetupData(wxString Method, wxString FilenameLocation, wxString UploadData){\r
\r
+ // Setup the data to use with the CardDAV connection.\r
+ \r
ServerMethod = Method;\r
ServerFilenameLocation = FilenameLocation;\r
ServerUploadData = UploadData;\r
\r
void CardDAV::SetupVariables(std::map<int, int> *actlist, int actindex){\r
\r
+ // Setup the variable pointers.\r
+ \r
ActivityListPtr = actlist;\r
ItemIndex = actindex;\r
\r
\r
wxString CardDAV::GetETagData(){\r
\r
+ // Get the ETag data.\r
+ \r
return ETagData;\r
\r
}\r
\r
void CardDAV::SetUploadMode(bool IncMode){\r
\r
+ // Set the upload mode.\r
+ \r
UploadMode = IncMode;\r
\r
}\r
\r
void CardDAV::SetEditMode(bool EditModeInc){\r
\r
+ // Set the edit mode.\r
+ \r
EditMode = EditModeInc;\r
\r
}\r
\r
int CardDAV::GetResultCode(){\r
\r
+ // Get the result code.\r
+ \r
return (int)claconncode;\r
\r
}\r
\r
int CardDAV::GetHTTPCode(){\r
\r
+ // Get the HTTP error code.\r
+ \r
return HTTPErrorCode;\r
\r
}\r
\r
wxString CardDAV::GetErrorBuffer(){\r
\r
+ // Get the error buffer.\r
+ \r
wxString ErrorBuffer = wxString::FromUTF8(curlerrbuffer);\r
\r
return ErrorBuffer;\r
\r
SSLCertCollection CardDAV::BuildSSLCollection(CURL *conn){\r
\r
+ // Build and return the SSL collection.\r
+ \r
SSLCertCollection SSLCertInfo;\r
\r
// Grab the certificate data.\r
\r
wxString CardDAV::GetErrorMessage(){\r
\r
+ // Get the error message.\r
+ \r
return ErrorMessage;\r
\r
}
\ No newline at end of file