swift
deletepilot.cpp
1 // SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
4 #include "core/fsd/deletepilot.h"
5 
6 #include "misc/logmessage.h"
7 
8 using namespace swift::misc;
9 
10 namespace swift::core::fsd
11 {
12  DeletePilot::DeletePilot(const QString &callsign, const QString &id) : MessageBase(callsign), m_cid(id) {}
13 
15  {
16  auto tokens = QStringList {};
17  tokens.push_back(m_sender);
18  tokens.push_back(m_cid);
19  return tokens;
20  }
21 
23  {
24  if (tokens.isEmpty())
25  {
26  CLogMessage(static_cast<DeletePilot *>(nullptr)).debug(u"Wrong number of arguments.");
27  return {};
28  }
29 
30  // VATSIM FSD will always supply the CERTIFICATE ID when it rebroadcasts this PDU without regard for whether
31  // the client originally specified it. But other FSDs might not.
32  DeletePilot packet(tokens[0], (tokens.size() >= 2) ? tokens[1] : "");
33  return packet;
34  }
35 } // namespace swift::core::fsd
Used to notify the server of the intention to close the connection. If a client receives this packet ...
Definition: deletepilot.h:16
QStringList toTokens() const
Message converted to tokens.
Definition: deletepilot.cpp:14
static DeletePilot fromTokens(const QStringList &tokens)
Construct from tokens.
Definition: deletepilot.cpp:22
FSD message base class.
Definition: messagebase.h:58
QString m_sender
message sender
Definition: messagebase.h:88
Class for emitting a log message.
Definition: logmessage.h:27
Derived & debug()
Set the severity to debug.
Free functions in swift::misc.
bool isEmpty() const const
void push_back(QList< T >::parameter_type value)
qsizetype size() const const