+// 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 <http://www.gnu.org/licenses/>
+
#include "carddav.h"
#include "../version.h"
#include <wx/wx.h>
ContactListData CardDAV::GetContactList(wxString SyncTokenInc){
+ // Get the contact list.
+
ContactListData ContactListFinal;
std::map<wxString,FileSyncData> ContactList;
SyncData.Append(wxT("<D:sync-collection xmlns:D=\"DAV:\"\n"));
SyncData.Append(wxT(" xmlns:C=\"urn:ietf:params:xml:ns:carddav\">\n"));
SyncData.Append(wxT("<D:sync-token>"));
- //SyncData.Trim();
- //SyncData.Append(wxT("data:,00378c55-1f44-44a2-a255-84f6560b5cac_580"));
SyncData.Append(SyncTokenInc);
- //SyncData.Trim();
SyncData.Append(wxT("</D:sync-token>\n"));
SyncData.Append(wxT("<D:sync-level>1</D:sync-level>\n"));
SyncData.Append(wxT("<D:prop>\n"));
SyncDataBuffer = SyncData.ToUTF8();
}
-
- //static const char* query = SyncData.mb_str();
-
- /*char *query = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\
- <D:sync-collection xmlns:D=\"DAV:\"\n\
- xmlns:C=\"urn:ietf:params:xml:ns:carddav\">\n\
- <D:sync-token>data:,00378c55-1f44-44a2-a255-84f6560b5cac_580</D:sync-token>\n\
- <D:sync-level>1</D:sync-level>\n\
- <D:prop>\n\
- <D:getetag/>\n\
- </D:prop>\n\
- </D:sync-collection>\n";*/
+
const char* query = SyncDataBuffer.data();
// Try SSL first.
}
- //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));
// 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));
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));
SleepFor(2000000000);
- /*timespec n1, n2;
-
- n1.tv_sec = 0;
- n1.tv_nsec = 2000000000L;
-
- nanosleep(&n1, &n2);*/
-
xmlFreeDoc(xmlCardDAVDoc);
curl_easy_cleanup(conn);