swift
fsdidentification.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 
5 
6 #include "misc/logmessage.h"
7 
8 namespace swift::core::fsd
9 {
10  FSDIdentification::FSDIdentification() : MessageBase() {}
11 
12  FSDIdentification::FSDIdentification(const QString &callsign, const QString &receiver, const QString &serverVersion,
13  const QString &initialChallenge)
14  : MessageBase(callsign, receiver), m_serverVersion(serverVersion), m_initialChallenge(initialChallenge)
15  {}
16 
17  QStringList FSDIdentification::toTokens() const
18  {
19  QStringList tokens;
20  tokens.push_back(m_sender);
21  tokens.push_back(m_receiver);
22  tokens.push_back(m_serverVersion);
23  tokens.push_back(m_initialChallenge);
24  return tokens;
25  }
26 
28  {
29  if (tokens.size() < 4)
30  {
31  swift::misc::CLogMessage(static_cast<FSDIdentification *>(nullptr)).debug(u"Wrong number of arguments.");
32  return {};
33  };
34  return FSDIdentification(tokens[0], tokens[1], tokens[2], tokens[3]);
35  }
36 } // namespace swift::core::fsd
This packet is sent by the server immediately after a new client connection is made.
static FSDIdentification fromTokens(const QStringList &tokens)
Construct from tokens.
QStringList toTokens() const
Message converted to tokens.
FSD message base class.
Definition: messagebase.h:58
QString m_receiver
message receiver
Definition: messagebase.h:89
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.