return;
}
- std::map<int,CardDAV*>::iterator CDAVter;
-
- CDAVter = ActivityListConn.find(intSelectedData);
-
// Restart the task.
//CDAVter->second.Abort();
ActListProcTimer.SetupPointers(&ActivityList, &ActivityListIndex, &ActivityListTaskDetail,
&TasksActive, lstActivity, lblDetails, GauProgress, this, &AnimationTimer,
- &ActProcessTimer, &ActivityListFinDate, &ActivityListConn);
+ &ActProcessTimer, &ActivityListFinDate, &ActivityListConnObject);
AnimationTimer.SetBitmap(bmpActivity);
AnimationTimer.SetSleepBitmap(&SleepBitmap);
wxArrayString vCardUpdateRemote;
wxArrayString vCardUpdateLog;
std::map<wxString,wxString> vCardETag;
- ContactListData ServerContactList;
std::map<wxString,vCardDownloadDataFileClass> vCardDownloadData;
COConnectResult ConnectResponse = ConnObjectIter->second->Connect(false);
bool ExitLoop = FALSE;
-
- std::map<wxString,FileSyncData> *SCListData = NULL;
while (ExitLoop == FALSE){
COServerResponse ServerEntityTag = ConnObjectIter->second->GetServerEntityTagValue(additer->first.ToStdString());
+ if (ServerEntityTag.RequestResult != COREQUEST_OK){
+ iter->second = 2;
+ break;
+ }
+
ServerETag = wxString::FromUTF8(ServerEntityTag.EntityTag.c_str());
// Add to the ETag Database.
COServerResponse ServerEntityTag = ConnObjectIter->second->GetServerEntityTagValue(additer->first.ToStdString());
+ if (ServerEntityTag.RequestResult != COREQUEST_OK){
+ iter->second = 2;
+ break;
+ }
+
ServerETag = wxString::FromUTF8(ServerEntityTag.EntityTag.c_str());
// Add to the ETag Database.
}
}
+
+ // Check if any errors occured before continuing.
+
+ if (iter->second != 1){
+ break;
+ }
// Look for vCard files which aren't in the ETagDB.
COServerResponse ServerEntityTag = ConnObjectIter->second->GetServerEntityTagValue(vCardAdd[vi].ToStdString());
+ if (ServerEntityTag.RequestResult != COREQUEST_OK){
+ iter->second = 2;
+ break;
+ }
+
+ // TODO: Continue from here!
+
ETagServer = wxString::FromUTF8(ServerEntityTag.EntityTag.c_str());
if (ETagOriginal != ETagServer){
COServerResponse GetContactResponse = ConnObjectIter->second->GetContact(vCardAdd[vi].ToStdString(), &ServerContactDataString);
+ if (GetContactResponse.RequestResult != COREQUEST_OK){
+ iter->second = 2;
+ break;
+ }
+
ServerContactData = wxString::FromUTF8(ServerContactDataString.c_str());
// Process v3 version into v4 version.
COServerResponse EditContactResponse = ConnObjectIter->second->EditContact(vCardAdd[vi].ToStdString(), ClientData.WriteString().ToStdString());
+ if (EditContactResponse.RequestResult != COREQUEST_OK){
+ iter->second = 2;
+ break;
+ }
+
iter->second = 4;
} else if (ConflictResult == 2){
COServerResponse AddContactResponse = ConnObjectIter->second->AddContact(vCardAdd[vi].ToStdString(), TaskData.ToStdString());
+ if (AddContactResponse.RequestResult != COREQUEST_OK){
+ iter->second = 2;
+ break;
+ }
+
// Get the Server ETag and put it in the ETag database.
COServerResponse EntityTagResponse = ConnObjectIter->second->GetServerEntityTagValue(vCardAdd[vi].ToStdString());
+ if (EntityTagResponse.RequestResult != COREQUEST_OK){
+ iter->second = 2;
+ break;
+ }
+
ETagServer = wxString::FromUTF8(EntityTagResponse.EntityTag.c_str());
ETagDBPtr->AddETag(vCardAdd[vi], ETagServer, ETagServer);
COServerResponse GetContactResponse = ConnObjectIter->second->GetContact(vCardAdd[vi].ToStdString(), &ServerContactDataString);
+ if (GetContactResponse.RequestResult != COREQUEST_OK){
+ iter->second = 2;
+ break;
+ }
+
ServerContactData = wxString::FromUTF8(ServerContactDataString.c_str());
ClientData.LoadFile(FullFilename);
// Decided to use client version.
COServerResponse EditContactResponse = ConnObjectIter->second->EditContact(vCardAdd[vi].ToStdString(), ClientData.WriteString().ToStdString());
-
+
+ if (EditContactResponse.RequestResult != COREQUEST_OK){
+ iter->second = 2;
+ break;
+ }
+
iter->second = 4;
} else if (ConflictResult == 2){
// Upload the data to the server.
COServerResponse AddContactResponse = ConnObjectIter->second->AddContact(vCardAdd[vi].ToStdString(), TaskData.ToStdString());
-
+
+ if (AddContactResponse.RequestResult != COREQUEST_OK){
+ iter->second = 2;
+ break;
+ }
+
// Get the Server ETag and put it in the ETag database.
COServerResponse EntityTagResponse = ConnObjectIter->second->GetServerEntityTagValue(vCardAdd[vi].ToStdString());
+ if (EntityTagResponse.RequestResult != COREQUEST_OK){
+ iter->second = 2;
+ break;
+ }
+
ETagDBPtr->AddETag(vCardAdd[vi], ETagServer, ETagServer);
}
}
+ if (iter->second != 1){
+ break;
+ }
+
// Process the vCards to delete locally.
for (int vi = 0; vi < vCardDelete.GetCount(); vi++){
std::map<int,wxString> ActivityListAccount;
std::map<int,wxString> ActivityListFilename;
std::map<int,wxString> ActivityListFullFilename;
- std::map<int,CardDAV*> ActivityListConn;
std::map<int,ConnectionObject*> ActivityListConnObject;
std::map<int,ActivityMgrAccountSettings> ActivityListAccSettings;
std::map<int,wxString> ActivityListETag;
ueventdata->ItemLabel = _("Stopped");
wxPostEvent(static_cast<frmActivityMgr*>(ActMgrPtr), uevent);
- iter->second = 5;
+ iter->second = 6;
} else if (iter->second == 4){
}
+ // Delete the connection object if finished.
+
+ if (iter->second > 4){
+
+ std::map<int,ConnectionObject*>::iterator ConnObjectIter = ActListConnObjectsPtr->find(iter->first);
+
+ delete ConnObjectIter->second;
+ ConnObjectIter->second = nullptr;
+
+ }
+
// Insert a finish date.
wxDateTime adt;
std::map<int,wxString> *ActListDetail, bool *TasksActive,
wxListCtrl *lstActivity, wxStaticText *lblDetails, wxGauge *GauProgress,
void *ActMgr, wxActTimer *ActTimer, wxActProcessTimer *ActProcessTimer,
- std::map<int,wxDateTime> *ActListFinDT, std::map<int, CardDAV*> *ActListConn){
+ std::map<int,wxDateTime> *ActListFinDT, std::map<int,ConnectionObject*> *ActListConnObjects){
// Setup the pointers for wxActListProcTimer.
ActTimerPtr = ActTimer;
ActProcessTimerPtr = ActProcessTimer;
ActListFinDTPtr = ActListFinDT;
- ActListConnPtr = ActListConn;
+ ActListConnObjectsPtr = ActListConnObjects;
}
#include <atomic>
#include "../actmgr/frmActivityMgr.h"
#include "../contacteditor/frmContactEditor.h"
+#include "../connobject/ConnectionObject.h"
#include "etag.h"
#ifndef TIMERS_H
struct ETagDB;
struct frmContactEditor;
-struct CardDAV;
class wxActTimer : public wxTimer
{
{
private:
- std::map<int,int> *ActListPtr;
- std::map<int,long> *ActListUIPtr;
- std::map<int,wxString> *ActListDetailPtr;
- std::map<int,CardDAV*> *ActListConnPtr;
- wxListCtrl *lstActivityPtr;
- wxStaticText *lblDetailsPtr;
- bool *TasksActivePtr;
- wxGauge *GauProgressPtr;
- void *ActMgrPtr;
+ std::map<int,int> *ActListPtr = nullptr;
+ std::map<int,long> *ActListUIPtr = nullptr;
+ std::map<int,wxString> *ActListDetailPtr = nullptr;
+ wxListCtrl *lstActivityPtr = nullptr;
+ wxStaticText *lblDetailsPtr = nullptr;
+ bool *TasksActivePtr = nullptr;
+ wxGauge *GauProgressPtr = nullptr;
+ void *ActMgrPtr = nullptr;
int intActivityTotal = 0;
int intActivityCompleted = 0;
- wxActTimer *ActTimerPtr;
- wxActProcessTimer *ActProcessTimerPtr;
- std::map<int,wxDateTime> *ActListFinDTPtr;
+ wxActTimer *ActTimerPtr = nullptr;
+ wxActProcessTimer *ActProcessTimerPtr = nullptr;
+ std::map<int,wxDateTime> *ActListFinDTPtr = nullptr;
+ std::map<int,ConnectionObject*> *ActListConnObjectsPtr = nullptr;
bool ClearupProcessed = FALSE;
public:
wxActListProcTimer():wxTimer()
std::map<int,wxString> *ActListDetail, bool *TasksActive,
wxListCtrl *lstActivity, wxStaticText *lblDetails, wxGauge *GauProgress,
void *ActMgr, wxActTimer *ActTimer, wxActProcessTimer *ActProcessTimer,
- std::map<int,wxDateTime> *ActListFinDT, std::map<int, CardDAV*> *ActListConn);
+ std::map<int,wxDateTime> *ActListFinDT, std::map<int,ConnectionObject*> *ActListConnObjects);
void EnableClearup();
};