diff --git a/Server.cpp b/Server.cpp index f12b0c19..f2d2dfbb 100644 --- a/Server.cpp +++ b/Server.cpp @@ -10,6 +10,22 @@ CServer::CServer(const string& sName, unsigned short uPort, const string& sPass, CServer::~CServer() {} +bool CServer::IsValidHostName(const string& sHostName) { + const char* p = sHostName.c_str(); + + if (sHostName.empty()) { + return false; + } + + while (*p) { + if (*p++ == ' ') { + return false; + } + } + + return true; +} + const string& CServer::GetName() const { return m_sName; } unsigned short CServer::GetPort() const { return m_uPort; } const string& CServer::GetPass() const { return m_sPass; } diff --git a/Server.h b/Server.h index 802abdb2..b3c843f1 100644 --- a/Server.h +++ b/Server.h @@ -12,6 +12,7 @@ public: unsigned short GetPort() const; const string& GetPass() const; bool IsSSL() const; + static bool IsValidHostName(const string& sHostName); private: protected: string m_sName;