mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 00:16:51 +08:00
Long live FsdClient
This commit is contained in:
46
src/blackcore/fsd/deletepilot.cpp
Normal file
46
src/blackcore/fsd/deletepilot.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
/* Copyright (C) 2019
|
||||
* swift project community / contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated,
|
||||
* or distributed except according to the terms contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "deletepilot.h"
|
||||
|
||||
#include "blackmisc/logmessage.h"
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
namespace Fsd
|
||||
{
|
||||
DeletePilot::DeletePilot() : MessageBase()
|
||||
{ }
|
||||
|
||||
DeletePilot::DeletePilot(const QString &callsign, const QString &id)
|
||||
: MessageBase(callsign),
|
||||
m_cid(id)
|
||||
{ }
|
||||
|
||||
QStringList DeletePilot::toTokens() const
|
||||
{
|
||||
auto tokens = QStringList {};
|
||||
tokens.push_back(m_sender);
|
||||
tokens.push_back(m_cid);
|
||||
return tokens;
|
||||
}
|
||||
|
||||
DeletePilot DeletePilot::fromTokens(const QStringList &tokens)
|
||||
{
|
||||
if (tokens.size() < 1)
|
||||
{
|
||||
BlackMisc::CLogMessage(static_cast<DeletePilot *>(nullptr)).debug(u"Wrong number of arguments.");
|
||||
return {};
|
||||
};
|
||||
// VATSIM FSD will always supply the CERTIFICATE ID when it rebroadcasts this PDU without regard for whether
|
||||
// the client originally specified it. But other FSDs might not.
|
||||
DeletePilot packet(tokens[0], (tokens.size() >= 2) ? tokens[1] : "");
|
||||
return packet;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user