From 71dcf590a74da5c14b465a25f8d91ed7ef5c342d Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Thu, 25 Feb 2016 18:39:56 +0000 Subject: [PATCH] Added the CalDAVObjectValidSettings subroutine. --- source/objects/CalDAV/CalDAV.cpp | 56 ++++++++++++++++++++++++++++++++ source/objects/CalDAV/CalDAV.h | 5 +++ 2 files changed, 61 insertions(+) diff --git a/source/objects/CalDAV/CalDAV.cpp b/source/objects/CalDAV/CalDAV.cpp index ec931d4..33c81b4 100644 --- a/source/objects/CalDAV/CalDAV.cpp +++ b/source/objects/CalDAV/CalDAV.cpp @@ -1,2 +1,58 @@ #include "CalDAV.h" +bool CalDAVObjectValidSettings(CalDAVConnectionData *ConnData){ + + // Check if the passed CalDAV Connection Data is has + // an address set. Return false if nullptr is used. + + if (ConnData == nullptr){ + + return false; + + } + + // Check the server hostname. Return false + // if no value has been set. + + if (ConnData->Hostname.size() > 0){ + + return false; + + } + + // Check the server port. Return false if + // no value has been set or the port number + // is less than 1 or higher than 65535. + + if (ConnData->Port < 1 || ConnData->Port > 65535){ + + return false; + + } + + // Check the server username. Return false + // if no value has been set. + + if (ConnData->Username.size() > 0){ + return false; + } + + // Check the server password. Return false + // if no value has been set. + + if (ConnData->Password.size() > 0){ + return false; + } + + // Cannot check UseSSL: It is either true + // or false. + + // Cannot check Prefix: The prefix may need + // to be worked out first. + + // No errors were found whilst checking so + // return true. + + return true; + +} \ No newline at end of file diff --git a/source/objects/CalDAV/CalDAV.h b/source/objects/CalDAV/CalDAV.h index 760caff..8a9c06c 100644 --- a/source/objects/CalDAV/CalDAV.h +++ b/source/objects/CalDAV/CalDAV.h @@ -57,4 +57,9 @@ class CalDAV{ }; +// Subroutines that are used with the +// CalDAVConnectionData struct. + +bool CalDAVObjectValidSettings(CalDAVConnectionData *ConnData); + #endif -- 2.39.5