diff --git a/CMakeLists.txt b/CMakeLists.txt index ce6a309cd..65e45a9dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -230,6 +230,8 @@ set(${PROJECT_NAME}_SOURCES src/core/core.h src/core/corestructs.cpp src/core/corestructs.h + src/core/dhtserver.cpp + src/core/dhtserver.h src/core/indexedlist.h src/core/recursivesignalblocker.cpp src/core/recursivesignalblocker.h diff --git a/src/core/corestructs.cpp b/src/core/corestructs.cpp index 2351c5e3d..d414ef66f 100644 --- a/src/core/corestructs.cpp +++ b/src/core/corestructs.cpp @@ -16,27 +16,6 @@ * @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 */ diff --git a/src/core/corestructs.h b/src/core/corestructs.h index 71ebbfcf7..f37fd47f3 100644 --- a/src/core/corestructs.h +++ b/src/core/corestructs.h @@ -15,17 +15,6 @@ enum class Status 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 { enum FileStatus diff --git a/src/core/dhtserver.cpp b/src/core/dhtserver.cpp new file mode 100644 index 000000000..3921879b0 --- /dev/null +++ b/src/core/dhtserver.cpp @@ -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 . +*/ + +#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); +} diff --git a/src/core/dhtserver.h b/src/core/dhtserver.h new file mode 100644 index 000000000..cb53ccab1 --- /dev/null +++ b/src/core/dhtserver.h @@ -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 . +*/ + +#ifndef DHT_SERVER_H +#define DHT_SERVER_H + +#include + +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 diff --git a/src/persistence/settings.h b/src/persistence/settings.h index 4c1408eb0..cde81b871 100644 --- a/src/persistence/settings.h +++ b/src/persistence/settings.h @@ -23,6 +23,8 @@ #include "src/core/corestructs.h" #include "src/core/toxencrypt.h" +#include "src/core/dhtserver.h" + #include #include #include