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 void FakeConnectionObject::SetupConnectionObject(){
54 void FakeConnectionObject::BypassSSLVerification(bool EnableBypass){
58 COServerResponse FakeConnectionObject::GetDefaultPrefix(std::string *ServerPrefix){
59 COServerResponse blankResponse;
63 COServerResponse FakeConnectionObject::GetContact(std::string Location, std::string *PageData){
64 COServerResponse blankResponse;
68 std::string FakeConnectionObject::GetErrorMessage(){
72 SSLCertCollectionString FakeConnectionObject::BuildSSLCollection(){
73 SSLCertCollectionString blankString;
77 COConnectResult FakeConnectionObject::Connect(bool DoAuthentication){
79 COConnectResult ConnectResult = ResultStatus;
80 AuthPassed = ResultAuthPassed;
81 CanProcess = ResultCanProcess;
82 SSLStatus = ResultSSLStatus;
83 SSLVerified = ResultSSLVerified;
84 ValidResponse = ResultValidResponse;
85 SSLSelfSigned = ResultSelfSigned;
86 ServerPrefix = ResultServerPrefix;
91 bool FakeConnectionObject::IsTaskCompleted(){
92 TaskCompleted = ResultTaskCompleted;
96 std::string FakeConnectionObject::GetDefaultPrefix(){
100 COServerResponse FakeConnectionObject::AddContact(std::string Location, std::string Data){
102 COServerResponse AddContactResult;
104 AddContactResult.RequestResult = TestRequestResult;
105 AddContactResult.EntityTag = TestEntityTag;
106 AddContactResult.SessionCode = TestSessionCode;
107 AddContactResult.ResultCode = TestResultCode;
108 AddContactResult.ResultMessage = TestResultMessage;
110 return AddContactResult;
114 COServerResponse FakeConnectionObject::EditContact(std::string Location, std::string Data){
116 COServerResponse EditContactResult;
118 EditContactResult.RequestResult = TestRequestResult;
119 EditContactResult.EntityTag = TestEntityTag;
120 EditContactResult.SessionCode = TestSessionCode;
121 EditContactResult.ResultCode = TestResultCode;
122 EditContactResult.ResultMessage = TestResultMessage;
124 return EditContactResult;
128 COServerResponse FakeConnectionObject::DeleteContact(std::string Location){
130 COServerResponse DeleteContactResult;
132 DeleteContactResult.RequestResult = TestRequestResult;
133 DeleteContactResult.EntityTag = TestEntityTag;
134 DeleteContactResult.SessionCode = TestSessionCode;
135 DeleteContactResult.ResultCode = TestResultCode;
136 DeleteContactResult.ResultMessage = TestResultMessage;
138 return DeleteContactResult;
142 COServerResponse FakeConnectionObject::GetServerEntityTagValue(std::string Location){
144 COServerResponse EntityTagResult;
146 EntityTagResult.RequestResult = TestRequestResult;
147 EntityTagResult.EntityTag = TestEntityTag;
148 EntityTagResult.SessionCode = TestSessionCode;
149 EntityTagResult.ResultCode = TestResultCode;
150 EntityTagResult.ResultMessage = TestResultMessage;
152 return EntityTagResult;
156 COServerResponse FakeConnectionObject::GetContact(std::string Location){
158 COServerResponse GetContactResult;
160 GetContactResult.RequestResult = TestRequestResult;
161 GetContactResult.EntityTag = TestEntityTag;
162 GetContactResult.SessionCode = TestSessionCode;
163 GetContactResult.ResultCode = TestResultCode;
164 GetContactResult.ResultMessage = TestResultMessage;
166 return GetContactResult;
170 COContactList FakeConnectionObject::GetContactList(std::string SyncToken){
172 COContactList GetContactListResult = TestContactList;
174 GetContactListResult.ServerResponse.RequestResult = TestRequestResult;
175 GetContactListResult.ServerResponse.EntityTag = TestEntityTag;
176 GetContactListResult.ServerResponse.SessionCode = TestSessionCode;
177 GetContactListResult.ServerResponse.ResultCode = TestResultCode;
178 GetContactListResult.ServerResponse.ResultMessage = TestResultMessage;
180 return GetContactListResult;
184 std::string FakeConnectionObject::GetServerAddress(){
185 return ServerAddress;
188 unsigned int FakeConnectionObject::GetServerPort(){
192 std::string FakeConnectionObject::GetServerUser(){
196 std::string FakeConnectionObject::GetServerPass(){
200 std::string FakeConnectionObject::GetServerPrefix(){
204 std::string FakeConnectionObject::GetServerAccount(){
205 return ServerAccount;
208 bool FakeConnectionObject::GetServerSSL(){
212 bool FakeConnectionObject::GetTestMode(){
213 return ResultTestMode;
216 bool FakeConnectionObject::CanDoProcessing(){
220 bool FakeConnectionObject::CanDoSSL(){
224 COSSLVerified FakeConnectionObject::SSLVerify(){
228 bool FakeConnectionObject::AbleToLogin(){
232 bool FakeConnectionObject::HasValidResponse(){
233 return ValidResponse;
236 bool FakeConnectionObject::IsSelfSigned(){
237 return SSLSelfSigned;