X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcarddav%2Fcarddav-contactlist.cpp;h=16acdb5aaf30c4f88e6f4a3fcc2237b64cbb7eba;hb=26c542881613813bd6a671a56e78f129944f68e6;hp=188e7721ea2bc34924f99483712cf1ef4d4ca1e2;hpb=911611528b36f56f7de9b6bf027b4c2a1a54df00;p=xestiaab%2F.git diff --git a/source/carddav/carddav-contactlist.cpp b/source/carddav/carddav-contactlist.cpp index 188e772..16acdb5 100644 --- a/source/carddav/carddav-contactlist.cpp +++ b/source/carddav/carddav-contactlist.cpp @@ -1,3 +1,21 @@ +// carddav-contactlist.cpp - CardDAV Object - Contact list 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 @@ ContactListData CardDAV::GetContactList(wxString SyncTokenInc){ + // Get the contact list. + ContactListData ContactListFinal; std::map ContactList; @@ -67,10 +87,7 @@ ContactListData CardDAV::GetContactList(wxString SyncTokenInc){ SyncData.Append(wxT("\n")); SyncData.Append(wxT("")); - //SyncData.Trim(); - //SyncData.Append(wxT("data:,00378c55-1f44-44a2-a255-84f6560b5cac_580")); SyncData.Append(SyncTokenInc); - //SyncData.Trim(); SyncData.Append(wxT("\n")); SyncData.Append(wxT("1\n")); SyncData.Append(wxT("\n")); @@ -95,18 +112,7 @@ ContactListData CardDAV::GetContactList(wxString SyncTokenInc){ SyncDataBuffer = SyncData.ToUTF8(); } - - //static const char* query = SyncData.mb_str(); - - /*char *query = "\n\ - \n\ - data:,00378c55-1f44-44a2-a255-84f6560b5cac_580\n\ - 1\n\ - \n\ - \n\ - \n\ - \n";*/ + const char* query = SyncDataBuffer.data(); // Try SSL first. @@ -152,13 +158,6 @@ ContactListData CardDAV::GetContactList(wxString SyncTokenInc){ } - //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); curl_easy_setopt(conn, CURLOPT_POSTFIELDS, query); curl_easy_setopt(conn, CURLOPT_POSTFIELDSIZE, strlen(query)); @@ -210,16 +209,11 @@ ContactListData CardDAV::GetContactList(wxString SyncTokenInc){ // 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)); @@ -403,14 +397,6 @@ ContactListData CardDAV::GetContactList(wxString SyncTokenInc){ curl_easy_setopt(conn, CURLOPT_CUSTOMREQUEST, "REPORT"); curl_easy_setopt(conn, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(conn, CURLOPT_HTTPHEADER, slist); - - //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); curl_easy_setopt(conn, CURLOPT_POSTFIELDS, query); curl_easy_setopt(conn, CURLOPT_POSTFIELDSIZE, strlen(query)); @@ -910,13 +896,6 @@ ContactListData CardDAV::GetContactList(wxString SyncTokenInc){ SleepFor(2000000000); - /*timespec n1, n2; - - n1.tv_sec = 0; - n1.tv_nsec = 2000000000L; - - nanosleep(&n1, &n2);*/ - xmlFreeDoc(xmlCardDAVDoc); curl_easy_cleanup(conn);