swift
rehost.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 "rehost.h"
5 
6 #include "serializer.h"
7 
8 #include "misc/logmessage.h"
9 
10 using namespace swift::misc;
11 using namespace swift::misc::aviation;
12 
13 namespace swift::core::fsd
14 {
15  Rehost::Rehost() : MessageBase() {}
16 
17  Rehost::Rehost(const QString &sender, const QString &hostname) : MessageBase(sender, {}), m_hostname(hostname) {}
18 
19  QStringList Rehost::toTokens() const { return { m_sender, m_hostname }; }
20 
21  Rehost Rehost::fromTokens(const QStringList &tokens)
22  {
23  if (tokens.size() < 2)
24  {
25  CLogMessage(static_cast<Rehost *>(nullptr)).debug(u"Wrong number of arguments.");
26  return {};
27  }
28 
29  return Rehost(tokens[0], tokens[1]);
30  }
31 } // namespace swift::core::fsd
FSD message base class.
Definition: messagebase.h:58
QString m_sender
message sender
Definition: messagebase.h:88
The server requests us to connect to a different server.
Definition: rehost.h:16
QString m_hostname
Properties.
Definition: rehost.h:32
QStringList toTokens() const
Message converted to tokens.
Definition: rehost.cpp:19
static Rehost fromTokens(const QStringList &tokens)
Construct from tokens.
Definition: rehost.cpp:21
Class for emitting a log message.
Definition: logmessage.h:27
Derived & debug()
Set the severity to debug.
Free functions in swift::misc.