From a10f6a5be860215492885ab324760b603a5d22fa Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 13 Mar 2016 09:10:07 +0000 Subject: [PATCH] Added comments to functions in carddav/carddav.cpp --- source/carddav/carddav.cpp | 70 +++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/source/carddav/carddav.cpp b/source/carddav/carddav.cpp index d10530b..a7cc43d 100644 --- a/source/carddav/carddav.cpp +++ b/source/carddav/carddav.cpp @@ -30,6 +30,8 @@ size_t WritebackFunc(char *ptr, size_t size, size_t nmemb, wxString *stream){ + // Writeback function for the CardDAV object. + wxString Data; Data = wxString::FromUTF8((char *)ptr); @@ -41,6 +43,8 @@ size_t WritebackFunc(char *ptr, size_t size, size_t nmemb, wxString *stream){ int ProgressFunc(void *clientdata, double TTDown, double NDown, double TTUp, double NUp){ + // Progress function for the CardDAV object. + int ProgressRet; CardDAV *IncCardDAV = static_cast(clientdata); @@ -90,6 +94,9 @@ SSLCertCollection CardDAV::VerifyCertCollection; bool CardDAV::AllowSelfSign; CardDAV::CardDAV(){ + + // Setup the CardDAV object. + ServerPort = 8080; SSLStatus = FALSE; SSLVerified = FALSE; @@ -103,14 +110,20 @@ CardDAV::CardDAV(){ UploadMode = FALSE; EditMode = FALSE; HTTPErrorCode = 0; + } CardDAV::~CardDAV(){ + // Destroy the CardDAV object. + } size_t UploadReadFunc(void *ptr, size_t size, size_t nmemb, void *userdata){ + + // Upload function for the CardDAV object. + struct UploadDataStruc *UploadPtr = (struct UploadDataStruc *)userdata; if (UploadPtr->sizeleft){ @@ -139,6 +152,8 @@ size_t UploadReadFunc(void *ptr, size_t size, size_t nmemb, void *userdata){ bool CardDAV::SetupConnection(wxString SvrAddress, int SvrPort, wxString SvrUser, wxString SvrPass, bool SvrSSL){ + // Setup the CardDAV connection without the prefix/account. + ServerAddress = SvrAddress; ServerPort = SvrPort; ServerUser = SvrUser; @@ -151,6 +166,8 @@ bool CardDAV::SetupConnection(wxString SvrAddress, int SvrPort, wxString SvrUser bool CardDAV::SetupConnection(wxString SvrAddress, int SvrPort, wxString SvrUser, wxString SvrPass, bool SvrSSL, wxString SvrPrefix, wxString SvrAccount){ + // Setup the CardDAV connection with the prefix/account. + ServerAddress = SvrAddress; ServerPort = SvrPort; ServerUser = SvrUser; @@ -165,6 +182,8 @@ bool CardDAV::SetupConnection(wxString SvrAddress, int SvrPort, wxString SvrUser bool CardDAV::SetupResultBools(bool *SvrResult, bool *SvrMonitor){ + // Setup the result booleans. + ServerResult = SvrResult; ServerMonitor = SvrMonitor; @@ -174,36 +193,48 @@ bool CardDAV::SetupResultBools(bool *SvrResult, bool *SvrMonitor){ bool CardDAV::HasValidResponse(){ + // Check that CardDAV server gave a valid response. + return ValidResponse; } bool CardDAV::CanDoCardDAV(){ + // Check that the server has CardDAV support. + return HasCalDAVSupport; } bool CardDAV::CanDoSSL(){ + // Check that the server can do SSL. + return SSLStatus; } bool CardDAV::SSLVerify(){ + // Check that the server can verify SSL. + return SSLVerified; } bool CardDAV::AbleToLogin(){ + // Check that the user is able to login. + return AuthPassed; } bool CardDAV::IsSelfSigned(){ + // Check that self-signed certificates are allowed. + return AllowSelfSign; } @@ -227,6 +258,8 @@ size_t CardDAV::WritebackFunc(char *ptr, size_t size, size_t nmemb, FILE *stream int CardDAV::ProgressFuncProc(void *clientdata, double TTUp, double NUp, double TTDown, double NDown){ + // Progress function processing. + if (AbortConnection == TRUE){ return -1; @@ -241,26 +274,37 @@ int CardDAV::ProgressFuncProc(void *clientdata, double TTUp, double NUp, double void CardDAV::Abort(){ + // Abort (close) the connection. + AbortConnection = TRUE; } SSLCertCollection CardDAV::GetSSLVerifyResults(){ + + // Get the SSL verification results. + return VerifyCertCollection; + } void CardDAV::AllowSelfSignTest(bool AllowSelfSignIn){ + + // Set the value to enable/disable SSL self-signed certificates. + AllowSelfSign = AllowSelfSignIn; } void CardDAV::GetSSLResults(){ - + // Get the SSL results. } void CardDAV::SetServerFilename(wxString Filename){ + // Set the server filename. + ServerFilenameLocation = Filename; } @@ -268,18 +312,24 @@ void CardDAV::SetServerFilename(wxString Filename){ wxString CardDAV::GetPageData() { + // Get the server page data. + return PageData; } wxString CardDAV::ETagValueResult(){ + // Get the ETag Result value. + return ETagResult; } void CardDAV::SetupData(wxString Method, wxString FilenameLocation, wxString UploadData){ + // Setup the data to use with the CardDAV connection. + ServerMethod = Method; ServerFilenameLocation = FilenameLocation; ServerUploadData = UploadData; @@ -299,6 +349,8 @@ void CardDAV::SetupData(wxString Method, wxString FilenameLocation, wxString Upl void CardDAV::SetupVariables(std::map *actlist, int actindex){ + // Setup the variable pointers. + ActivityListPtr = actlist; ItemIndex = actindex; @@ -306,36 +358,48 @@ void CardDAV::SetupVariables(std::map *actlist, int actindex){ wxString CardDAV::GetETagData(){ + // Get the ETag data. + return ETagData; } void CardDAV::SetUploadMode(bool IncMode){ + // Set the upload mode. + UploadMode = IncMode; } void CardDAV::SetEditMode(bool EditModeInc){ + // Set the edit mode. + EditMode = EditModeInc; } int CardDAV::GetResultCode(){ + // Get the result code. + return (int)claconncode; } int CardDAV::GetHTTPCode(){ + // Get the HTTP error code. + return HTTPErrorCode; } wxString CardDAV::GetErrorBuffer(){ + // Get the error buffer. + wxString ErrorBuffer = wxString::FromUTF8(curlerrbuffer); return ErrorBuffer; @@ -344,6 +408,8 @@ wxString CardDAV::GetErrorBuffer(){ SSLCertCollection CardDAV::BuildSSLCollection(CURL *conn){ + // Build and return the SSL collection. + SSLCertCollection SSLCertInfo; // Grab the certificate data. @@ -405,6 +471,8 @@ SSLCertCollection CardDAV::GetCertificateData(){ wxString CardDAV::GetErrorMessage(){ + // Get the error message. + return ErrorMessage; } \ No newline at end of file -- 2.39.5