1 // FakeConnectionObject.cpp - FakeConnectionObject class
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "FakeConnectionObject.h"
21 FakeConnectionObject::FakeConnectionObject(std::string ServerAddress, int ServerPort,
22 std::string ServerUser, std::string ServerPass, bool ServerSSL){
24 this->ServerAddress = ServerAddress;
25 this->ServerPort = ServerPort;
26 this->ServerUser = ServerUser;
27 this->ServerPass = ServerPass;
28 this->ServerSSL = ServerSSL;
32 FakeConnectionObject::FakeConnectionObject(std::string ServerAddress, int ServerPort,
33 std::string ServerUser, std::string ServerPass, bool ServerSSL,
34 std::string ServerPrefix, std::string ServerAccount){
36 this->ServerAddress = ServerAddress;
37 this->ServerPort = ServerPort;
38 this->ServerUser = ServerUser;
39 this->ServerPass = ServerPass;
40 this->ServerSSL = ServerSSL;
41 this->ServerPrefix = ServerPrefix;
42 this->ServerAccount = ServerAccount;
46 FakeConnectionObject::~FakeConnectionObject(){
50 COConnectResult FakeConnectionObject::Connect(bool DoAuthentication){
52 COConnectResult ConnectResult = ResultStatus;
53 AuthPassed = ResultAuthPassed;
54 CanProcess = ResultCanProcess;
55 SSLStatus = ResultSSLStatus;
56 SSLVerified = ResultSSLVerified;
57 ValidResponse = ResultValidResponse;
58 SSLSelfSigned = ResultSelfSigned;
59 ServerPrefix = ResultServerPrefix;
64 bool FakeConnectionObject::IsTaskCompleted(){
65 TaskCompleted = ResultTaskCompleted;
69 std::string FakeConnectionObject::GetDefaultPrefix(){
73 COServerResponse FakeConnectionObject::AddContact(std::string Location, std::string Data){
75 COServerResponse AddContactResult;
77 AddContactResult.RequestResult = TestRequestResult;
78 AddContactResult.EntityTag = TestEntityTag;
79 AddContactResult.SessionCode = TestSessionCode;
80 AddContactResult.ResultCode = TestResultCode;
81 AddContactResult.ResultMessage = TestResultMessage;
83 return AddContactResult;
87 COServerResponse FakeConnectionObject::EditContact(std::string Location, std::string Data){
89 COServerResponse EditContactResult;
91 EditContactResult.RequestResult = TestRequestResult;
92 EditContactResult.EntityTag = TestEntityTag;
93 EditContactResult.SessionCode = TestSessionCode;
94 EditContactResult.ResultCode = TestResultCode;
95 EditContactResult.ResultMessage = TestResultMessage;
97 return EditContactResult;
101 COServerResponse FakeConnectionObject::DeleteContact(std::string Location){
103 COServerResponse DeleteContactResult;
105 DeleteContactResult.RequestResult = TestRequestResult;
106 DeleteContactResult.EntityTag = TestEntityTag;
107 DeleteContactResult.SessionCode = TestSessionCode;
108 DeleteContactResult.ResultCode = TestResultCode;
109 DeleteContactResult.ResultMessage = TestResultMessage;
111 return DeleteContactResult;
115 COServerResponse FakeConnectionObject::GetServerEntityTagValue(std::string Location){
117 COServerResponse EntityTagResult;
119 EntityTagResult.RequestResult = TestRequestResult;
120 EntityTagResult.EntityTag = TestEntityTag;
121 EntityTagResult.SessionCode = TestSessionCode;
122 EntityTagResult.ResultCode = TestResultCode;
123 EntityTagResult.ResultMessage = TestResultMessage;
125 return EntityTagResult;
129 COServerResponse FakeConnectionObject::GetContact(std::string Location){
131 COServerResponse GetContactResult;
133 GetContactResult.RequestResult = TestRequestResult;
134 GetContactResult.EntityTag = TestEntityTag;
135 GetContactResult.SessionCode = TestSessionCode;
136 GetContactResult.ResultCode = TestResultCode;
137 GetContactResult.ResultMessage = TestResultMessage;
139 return GetContactResult;
143 COContactList FakeConnectionObject::GetContactList(std::string SyncToken){
145 COContactList GetContactListResult = TestContactList;
147 GetContactListResult.ServerResponse.RequestResult = TestRequestResult;
148 GetContactListResult.ServerResponse.EntityTag = TestEntityTag;
149 GetContactListResult.ServerResponse.SessionCode = TestSessionCode;
150 GetContactListResult.ServerResponse.ResultCode = TestResultCode;
151 GetContactListResult.ServerResponse.ResultMessage = TestResultMessage;
153 return GetContactListResult;
157 std::string FakeConnectionObject::GetServerAddress(){
158 return ServerAddress;
161 unsigned int FakeConnectionObject::GetServerPort(){
165 std::string FakeConnectionObject::GetServerUser(){
169 std::string FakeConnectionObject::GetServerPass(){
173 std::string FakeConnectionObject::GetServerPrefix(){
177 std::string FakeConnectionObject::GetServerAccount(){
178 return ServerAccount;
181 bool FakeConnectionObject::GetServerSSL(){
185 bool FakeConnectionObject::GetTestMode(){
186 return ResultTestMode;
189 bool FakeConnectionObject::CanDoProcessing(){
193 bool FakeConnectionObject::CanDoSSL(){
197 COSSLVerified FakeConnectionObject::SSLVerify(){
201 bool FakeConnectionObject::AbleToLogin(){
205 bool FakeConnectionObject::HasValidResponse(){
206 return ValidResponse;
209 bool FakeConnectionObject::IsSelfSigned(){
210 return SSLSelfSigned;