X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcarddav%2Fcarddav-processdata.cpp;h=99337bc66d44803522c68ff4e22f322874899a5e;hb=26c542881613813bd6a671a56e78f129944f68e6;hp=f3bfdae2549c93d7cc34e6d30608f0c9999088e8;hpb=911611528b36f56f7de9b6bf027b4c2a1a54df00;p=xestiaab%2F.git diff --git a/source/carddav/carddav-processdata.cpp b/source/carddav/carddav-processdata.cpp index f3bfdae..99337bc 100644 --- a/source/carddav/carddav-processdata.cpp +++ b/source/carddav/carddav-processdata.cpp @@ -1,3 +1,21 @@ +// carddav-processdata.cpp - CardDAV Object - Process Data subroutines. +// +// (c) 2012-2015 Xestia Software Development. +// +// This file is part of Xestia Address Book. +// +// Xestia Address Book is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by the +// Free Software Foundation, version 3 of the license. +// +// Xestia Address Book is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with Xestia Address Book. If not, see + #include "carddav.h" #include "../version.h" #include @@ -12,6 +30,8 @@ void CardDAV::ProcessDataThread(){ + // Process the data (threaded). + PageData.Clear(); PageHeader.Clear(); @@ -53,26 +73,6 @@ void CardDAV::ProcessDataThread(){ ServerAddressNormal = wxT("http://") + ServerAddressURL; ServerAuth = ServerUser + wxT(":") + ServerPass; - - // Try SSL first. - - - /* - char *ServerAdrSSLChar = new char[(ServerAddressSSL.Length() - 1)]; - //memset(ServerAdrSSLChar, 0, ServerAddressSSL.Length()); - strncpy(ServerAdrSSLChar, (const char*)ServerAddressSSL.mb_str(wxConvUTF8), (ServerAddressSSL.Length() - 1)); - - char *ServerAdrNorChar = new char[(ServerAddressNormal.Length() - 1)]; - //memset(ServerAdrNorChar, 0, ServerAddressSSL.Length()); - strncpy(ServerAdrNorChar, (const char*)ServerAddressNormal.mb_str(wxConvUTF8), (ServerAddressNormal.Length() - 1)); - - char *ServerAuthChar = new char[(ServerAuth.Length() - 1)]; - //memset(ServerAuthChar, 0, ServerAddressSSL.Length()); - strncpy(ServerAuthChar, (const char*)ServerAuth.mb_str(wxConvUTF8), (ServerAuth.Length() - 1)); - - */ - - //std::string WriteDataString = std::string(ServerUploadData.mb_str()); std::map::iterator ActIter; struct UploadDataStruc UploadData; @@ -91,6 +91,8 @@ void CardDAV::ProcessDataThread(){ curl_easy_setopt(conn, CURLOPT_CUSTOMREQUEST, (const char*)ServerMethod.mb_str(wxConvUTF8)); } + + // Try SSL first. if (ServerSSL){ @@ -130,14 +132,6 @@ void CardDAV::ProcessDataThread(){ curl_easy_setopt(conn, CURLOPT_CAINFO, (const char*)ServerCertFilename.mb_str(wxConvUTF8)); } - - //UploadData.readptr = &CardDAVDataQuery; - //UploadData.sizeleft = CardDAVDataQuery.Len(); - //curl_easy_setopt(conn, CURLOPT_UPLOAD, 1); - //curl_easy_setopt(conn, CURLOPT_READDATA, &UploadData); - //curl_easy_setopt(conn, CURLOPT_READFUNCTION, UploadReadFunc); - - //curl_easy_setopt(conn, CURLOPT_WRITEFUNCTION, writefunc); claconncode = (curl_easy_perform(conn)); @@ -192,16 +186,11 @@ void CardDAV::ProcessDataThread(){ // the certificates as PEM files. if (claconncode == CURLE_SSL_CACERT && wxFile::Exists(ServerCertFilename) == TRUE){ - - //curl_easy_cleanup(conn); - //conn = curl_easy_init(); CURL *sslerrconn; sslerrconn = curl_easy_init(); CURLcode sslerrconncode; - //claconncode = (curl_easy_perform(conn)); - wxString ServerAddressOnly = wxT("https://") + ServerAddress + wxT(":") + wxString::Format(wxT("%i"), ServerPort) + wxT("/"); curl_easy_setopt(sslerrconn, CURLOPT_URL, (const char*)ServerAddressOnly.mb_str(wxConvUTF8)); @@ -488,7 +477,6 @@ void CardDAV::ProcessDataThread(){ // Catch all. - //ActIter->second = 1; *ServerResult = TRUE; return; @@ -496,6 +484,8 @@ void CardDAV::ProcessDataThread(){ void CardDAV::ProcessData(){ + // Process the data. + std::thread ConnectThread(&CardDAV::ProcessDataThread, this); ConnectThread.detach();