mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: Extract DhtServer in separate file
This commit is contained in:
parent
256b24ff21
commit
0c8c16e743
|
@ -230,6 +230,8 @@ set(${PROJECT_NAME}_SOURCES
|
||||||
src/core/core.h
|
src/core/core.h
|
||||||
src/core/corestructs.cpp
|
src/core/corestructs.cpp
|
||||||
src/core/corestructs.h
|
src/core/corestructs.h
|
||||||
|
src/core/dhtserver.cpp
|
||||||
|
src/core/dhtserver.h
|
||||||
src/core/indexedlist.h
|
src/core/indexedlist.h
|
||||||
src/core/recursivesignalblocker.cpp
|
src/core/recursivesignalblocker.cpp
|
||||||
src/core/recursivesignalblocker.h
|
src/core/recursivesignalblocker.h
|
||||||
|
|
|
@ -16,27 +16,6 @@
|
||||||
* @brief Data file (default) or avatar
|
* @brief Data file (default) or avatar
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Compare equal operator
|
|
||||||
* @param other the compared instance
|
|
||||||
* @return true, if equal; false otherwise
|
|
||||||
*/
|
|
||||||
bool DhtServer::operator==(const DhtServer& other) const
|
|
||||||
{
|
|
||||||
return this == &other || (port == other.port && address == other.address
|
|
||||||
&& userId == other.userId && name == other.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Compare not equal operator
|
|
||||||
* @param other the compared instance
|
|
||||||
* @return true, if not equal; false otherwise
|
|
||||||
*/
|
|
||||||
bool DhtServer::operator!=(const DhtServer& other) const
|
|
||||||
{
|
|
||||||
return !(*this == other);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ToxFile constructor
|
* @brief ToxFile constructor
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -15,17 +15,6 @@ enum class Status
|
||||||
Offline
|
Offline
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DhtServer
|
|
||||||
{
|
|
||||||
QString name;
|
|
||||||
QString userId;
|
|
||||||
QString address;
|
|
||||||
quint16 port;
|
|
||||||
|
|
||||||
bool operator==(const DhtServer& other) const;
|
|
||||||
bool operator!=(const DhtServer& other) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ToxFile
|
struct ToxFile
|
||||||
{
|
{
|
||||||
enum FileStatus
|
enum FileStatus
|
||||||
|
|
41
src/core/dhtserver.cpp
Normal file
41
src/core/dhtserver.cpp
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
Copyright © 2017 by The qTox Project Contributors
|
||||||
|
|
||||||
|
This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||||
|
|
||||||
|
qTox is libre software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
qTox is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with qTox. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "dhtserver.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Compare equal operator
|
||||||
|
* @param other the compared instance
|
||||||
|
* @return true, if equal; false otherwise
|
||||||
|
*/
|
||||||
|
bool DhtServer::operator==(const DhtServer& other) const
|
||||||
|
{
|
||||||
|
return this == &other || (port == other.port && address == other.address
|
||||||
|
&& userId == other.userId && name == other.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Compare not equal operator
|
||||||
|
* @param other the compared instance
|
||||||
|
* @return true, if not equal; false otherwise
|
||||||
|
*/
|
||||||
|
bool DhtServer::operator!=(const DhtServer& other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
36
src/core/dhtserver.h
Normal file
36
src/core/dhtserver.h
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
Copyright © 2017 by The qTox Project Contributors
|
||||||
|
|
||||||
|
This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
qTox is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with qTox. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DHT_SERVER_H
|
||||||
|
#define DHT_SERVER_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
struct DhtServer
|
||||||
|
{
|
||||||
|
QString name;
|
||||||
|
QString userId;
|
||||||
|
QString address;
|
||||||
|
quint16 port;
|
||||||
|
|
||||||
|
bool operator==(const DhtServer& other) const;
|
||||||
|
bool operator!=(const DhtServer& other) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DHT_SERVER_H
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
#include "src/core/corestructs.h"
|
#include "src/core/corestructs.h"
|
||||||
#include "src/core/toxencrypt.h"
|
#include "src/core/toxencrypt.h"
|
||||||
|
#include "src/core/dhtserver.h"
|
||||||
|
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QFlags>
|
#include <QFlags>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user