mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
Ref T249, using obfuscation for server/user
This commit is contained in:
@@ -33,7 +33,7 @@ namespace BlackMisc
|
|||||||
CServer::CServer(
|
CServer::CServer(
|
||||||
const QString &name, const QString &description, const QString &address, int port, const CUser &user,
|
const QString &name, const QString &description, const QString &address, int port, const CUser &user,
|
||||||
const CFsdSetup &setup, const CEcosystem &ecosytem, ServerType serverType, bool isAcceptingConnections)
|
const CFsdSetup &setup, const CEcosystem &ecosytem, ServerType serverType, bool isAcceptingConnections)
|
||||||
: m_name(name), m_description(description), m_address(address), m_port(port), m_user(user),
|
: m_name(decode(name)), m_description(decode(description)), m_address(decode(address)), m_port(port), m_user(user),
|
||||||
m_fsdSetup(setup), m_ecosystem(ecosytem),
|
m_fsdSetup(setup), m_ecosystem(ecosytem),
|
||||||
m_serverType(serverType), m_isAcceptingConnections(isAcceptingConnections)
|
m_serverType(serverType), m_isAcceptingConnections(isAcceptingConnections)
|
||||||
{}
|
{}
|
||||||
@@ -65,11 +65,12 @@ namespace BlackMisc
|
|||||||
const CServer &CServer::swiftFsdTestServer(bool withPw)
|
const CServer &CServer::swiftFsdTestServer(bool withPw)
|
||||||
{
|
{
|
||||||
// CUser("guest", "Guest Client project", "", "guest")
|
// CUser("guest", "Guest Client project", "", "guest")
|
||||||
|
// use CObfuscation::endocde to get the strings
|
||||||
static const CServer dvp("Testserver", "Client project testserver", "fsd.swift-project.org", 6809,
|
static const CServer dvp("Testserver", "Client project testserver", "fsd.swift-project.org", 6809,
|
||||||
CUser("1234567", "Test User", "", "123456"),
|
CUser("OBF:AwJ6BweZqpmtmORL", "OBF:AwI/594lQTJGZnmSwB0=", "", "OBF:AwKi3JkHNAczBno="),
|
||||||
CFsdSetup(), CEcosystem(CEcosystem::swiftTest()), CServer::FSDServerVatsim);
|
CFsdSetup(), CEcosystem(CEcosystem::swiftTest()), CServer::FSDServerVatsim);
|
||||||
static const CServer dvnp("Testserver", "Client project testserver", "fsd.swift-project.org", 6809,
|
static const CServer dvnp("Testserver", "Client project testserver", "fsd.swift-project.org", 6809,
|
||||||
CUser("1234567", "Test User", "", ""),
|
CUser("OBF:AwJ6BweZqpmtmORL", "OBF:AwI/594lQTJGZnmSwB0=", "", ""),
|
||||||
CFsdSetup(), CEcosystem(CEcosystem::swiftTest()), CServer::FSDServerVatsim);
|
CFsdSetup(), CEcosystem(CEcosystem::swiftTest()), CServer::FSDServerVatsim);
|
||||||
return withPw ? dvp : dvnp;
|
return withPw ? dvp : dvnp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,11 +12,12 @@
|
|||||||
#ifndef BLACKMISC_NETWORK_SERVER_H
|
#ifndef BLACKMISC_NETWORK_SERVER_H
|
||||||
#define BLACKMISC_NETWORK_SERVER_H
|
#define BLACKMISC_NETWORK_SERVER_H
|
||||||
|
|
||||||
#include "blackmisc/blackmiscexport.h"
|
|
||||||
#include "blackmisc/metaclass.h"
|
|
||||||
#include "blackmisc/network/user.h"
|
#include "blackmisc/network/user.h"
|
||||||
#include "blackmisc/network/fsdsetup.h"
|
#include "blackmisc/network/fsdsetup.h"
|
||||||
#include "blackmisc/network/ecosystem.h"
|
#include "blackmisc/network/ecosystem.h"
|
||||||
|
#include "blackmisc/obfuscation.h"
|
||||||
|
#include "blackmisc/blackmiscexport.h"
|
||||||
|
#include "blackmisc/metaclass.h"
|
||||||
#include "blackmisc/propertyindex.h"
|
#include "blackmisc/propertyindex.h"
|
||||||
#include "blackmisc/statusmessagelist.h"
|
#include "blackmisc/statusmessagelist.h"
|
||||||
#include "blackmisc/timestampbased.h"
|
#include "blackmisc/timestampbased.h"
|
||||||
@@ -33,7 +34,8 @@ namespace BlackMisc
|
|||||||
//! Value object encapsulating information of a server
|
//! Value object encapsulating information of a server
|
||||||
class BLACKMISC_EXPORT CServer :
|
class BLACKMISC_EXPORT CServer :
|
||||||
public CValueObject<CServer>,
|
public CValueObject<CServer>,
|
||||||
public ITimestampBased
|
public ITimestampBased,
|
||||||
|
public CObfuscation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Properties by index
|
//! Properties by index
|
||||||
@@ -90,7 +92,7 @@ namespace BlackMisc
|
|||||||
const QString &getAddress() const { return m_address; }
|
const QString &getAddress() const { return m_address; }
|
||||||
|
|
||||||
//! Set address (e.g. myserver.foo.com)
|
//! Set address (e.g. myserver.foo.com)
|
||||||
void setAddress(const QString &address) { m_address = address.trimmed(); }
|
void setAddress(const QString &address) { m_address = decode(address); }
|
||||||
|
|
||||||
//! Get user
|
//! Get user
|
||||||
const CUser &getUser() const { return m_user; }
|
const CUser &getUser() const { return m_user; }
|
||||||
@@ -105,7 +107,7 @@ namespace BlackMisc
|
|||||||
bool hasName() const { return !m_name.isEmpty(); }
|
bool hasName() const { return !m_name.isEmpty(); }
|
||||||
|
|
||||||
//! Set name
|
//! Set name
|
||||||
void setName(const QString &name) { m_name = name.trimmed(); }
|
void setName(const QString &name) { m_name = decode(name); }
|
||||||
|
|
||||||
//! Matches server name?
|
//! Matches server name?
|
||||||
bool matchesName(const QString &name) const;
|
bool matchesName(const QString &name) const;
|
||||||
@@ -120,7 +122,7 @@ namespace BlackMisc
|
|||||||
const QString &getDescription() const { return m_description; }
|
const QString &getDescription() const { return m_description; }
|
||||||
|
|
||||||
//! Set description
|
//! Set description
|
||||||
void setDescription(const QString &description) { m_description = description.trimmed().simplified(); }
|
void setDescription(const QString &description) { m_description = decode(description).simplified(); }
|
||||||
|
|
||||||
//! Get port
|
//! Get port
|
||||||
int getPort() const { return m_port; }
|
int getPort() const { return m_port; }
|
||||||
|
|||||||
@@ -35,17 +35,17 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
|
|
||||||
CUser::CUser(const QString &id, const QString &realname, const CCallsign &callsign)
|
CUser::CUser(const QString &id, const QString &realname, const CCallsign &callsign)
|
||||||
: m_id(id.trimmed()), m_realname(realname), m_callsign(callsign)
|
: m_id(decode(id)), m_realname(decode(realname)), m_callsign(callsign)
|
||||||
{
|
{
|
||||||
this->deriveHomeBaseFromCallsign();
|
this->deriveHomeBaseFromCallsign();
|
||||||
this->setRealName(realname); // extracts homebase if this is included in real name
|
this->setRealName(m_realname); // extracts homebase if this is included in real name
|
||||||
}
|
}
|
||||||
|
|
||||||
CUser::CUser(const QString &id, const QString &realname, const QString &email, const QString &password, const CCallsign &callsign)
|
CUser::CUser(const QString &id, const QString &realname, const QString &email, const QString &password, const CCallsign &callsign)
|
||||||
: m_id(id.trimmed()), m_realname(realname), m_email(email), m_password(password), m_callsign(callsign)
|
: m_id(decode(id)), m_realname(decode(realname)), m_email(decode(email)), m_password(decode(password)), m_callsign(callsign)
|
||||||
{
|
{
|
||||||
this->deriveHomeBaseFromCallsign();
|
this->deriveHomeBaseFromCallsign();
|
||||||
this->setRealName(realname); // extracts homebase
|
this->setRealName(m_realname); // extracts homebase
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CUser::getRealNameAndHomeBase(const QString &separator) const
|
QString CUser::getRealNameAndHomeBase(const QString &separator) const
|
||||||
@@ -64,7 +64,7 @@ namespace BlackMisc
|
|||||||
QString CUser::convertToQString(bool i18n) const
|
QString CUser::convertToQString(bool i18n) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(i18n);
|
Q_UNUSED(i18n);
|
||||||
if (m_realname.isEmpty()) return "<no realname>";
|
if (m_realname.isEmpty()) return QStringLiteral("<no realname>");
|
||||||
QString s = m_realname;
|
QString s = m_realname;
|
||||||
if (this->hasId())
|
if (this->hasId())
|
||||||
{
|
{
|
||||||
@@ -91,7 +91,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
void CUser::setRealName(const QString &realname)
|
void CUser::setRealName(const QString &realname)
|
||||||
{
|
{
|
||||||
QString rn(removeAccents(realname.trimmed().simplified()));
|
QString rn(removeAccents(decode(realname).simplified()));
|
||||||
if (rn.isEmpty())
|
if (rn.isEmpty())
|
||||||
{
|
{
|
||||||
m_realname.clear();
|
m_realname.clear();
|
||||||
|
|||||||
@@ -14,13 +14,14 @@
|
|||||||
|
|
||||||
#include "blackmisc/aviation/airporticaocode.h"
|
#include "blackmisc/aviation/airporticaocode.h"
|
||||||
#include "blackmisc/aviation/callsign.h"
|
#include "blackmisc/aviation/callsign.h"
|
||||||
#include "blackmisc/blackmiscexport.h"
|
#include "blackmisc/obfuscation.h"
|
||||||
#include "blackmisc/icon.h"
|
#include "blackmisc/icon.h"
|
||||||
#include "blackmisc/metaclass.h"
|
#include "blackmisc/metaclass.h"
|
||||||
#include "blackmisc/propertyindex.h"
|
#include "blackmisc/propertyindex.h"
|
||||||
#include "blackmisc/statusmessagelist.h"
|
#include "blackmisc/statusmessagelist.h"
|
||||||
#include "blackmisc/valueobject.h"
|
#include "blackmisc/valueobject.h"
|
||||||
#include "blackmisc/variant.h"
|
#include "blackmisc/variant.h"
|
||||||
|
#include "blackmisc/blackmiscexport.h"
|
||||||
|
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@@ -32,7 +33,9 @@ namespace BlackMisc
|
|||||||
/*!
|
/*!
|
||||||
* Value object encapsulating information of a user.
|
* Value object encapsulating information of a user.
|
||||||
*/
|
*/
|
||||||
class BLACKMISC_EXPORT CUser : public CValueObject<CUser>
|
class BLACKMISC_EXPORT CUser :
|
||||||
|
public CValueObject<CUser>,
|
||||||
|
public CObfuscation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
@@ -70,7 +73,7 @@ namespace BlackMisc
|
|||||||
const QString &getPassword() const { return m_password; }
|
const QString &getPassword() const { return m_password; }
|
||||||
|
|
||||||
//! Set password
|
//! Set password
|
||||||
void setPassword(const QString &pw) { m_password = pw.trimmed(); }
|
void setPassword(const QString &pw) { m_password = decode(pw); }
|
||||||
|
|
||||||
//! Valid user object?
|
//! Valid user object?
|
||||||
bool isValid() const { return !isNull(); }
|
bool isValid() const { return !isNull(); }
|
||||||
@@ -109,7 +112,7 @@ namespace BlackMisc
|
|||||||
const QString &getEmail() const { return m_email; }
|
const QString &getEmail() const { return m_email; }
|
||||||
|
|
||||||
//! Set email.
|
//! Set email.
|
||||||
void setEmail(const QString &email) { m_email = email.trimmed(); }
|
void setEmail(const QString &email) { m_email = decode(email); }
|
||||||
|
|
||||||
//! Valid email?
|
//! Valid email?
|
||||||
bool hasValidEmail() const { return !m_email.isEmpty(); }
|
bool hasValidEmail() const { return !m_email.isEmpty(); }
|
||||||
@@ -118,7 +121,7 @@ namespace BlackMisc
|
|||||||
const QString &getId() const { return m_id; }
|
const QString &getId() const { return m_id; }
|
||||||
|
|
||||||
//! Set id
|
//! Set id
|
||||||
void setId(const QString &id) { m_id = id.trimmed(); }
|
void setId(const QString &id) { m_id = decode(id); }
|
||||||
|
|
||||||
//! Homebase
|
//! Homebase
|
||||||
const Aviation::CAirportIcaoCode &getHomeBase() const { return m_homebase; }
|
const Aviation::CAirportIcaoCode &getHomeBase() const { return m_homebase; }
|
||||||
|
|||||||
Reference in New Issue
Block a user