forked from ricochet-im/ricochet
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Shims were copied verbatim from libtego_ui. This is a lot of code duplication that has to be cleaned up. - The headless build mode (without QtGui) has been lost. libtego currently relies on QtGui so we will have to patch that first. - Only very minimal testing was done so far.
- Loading branch information
Showing
36 changed files
with
4,287 additions
and
456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,34 @@ | ||
# Ricochet Refresh - https://ricochetrefresh.net/ | ||
# Copyright (C) 2021, Blueprint For Free Speech <[email protected]> | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are | ||
# met: | ||
# | ||
# * Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# | ||
# * Redistributions in binary form must reproduce the above | ||
# copyright notice, this list of conditions and the following disclaimer | ||
# in the documentation and/or other materials provided with the | ||
# distribution. | ||
# | ||
# * Neither the names of the copyright owners nor the names of its | ||
# contributors may be used to endorse or promote products derived from | ||
# this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
cmake_minimum_required(VERSION 3.16) | ||
|
||
project(ricochet-irc LANGUAGES CXX) | ||
|
@@ -15,7 +46,10 @@ if (FORCE_QT5) | |
NAMES | ||
Qt5 | ||
COMPONENTS Core | ||
Gui | ||
Network | ||
Quick | ||
Widgets | ||
REQUIRED) | ||
else () | ||
find_package( | ||
|
@@ -24,14 +58,20 @@ else () | |
Qt6 | ||
Qt5 | ||
COMPONENTS Core | ||
Gui | ||
Network | ||
Quick | ||
Widgets | ||
REQUIRED) | ||
endif () | ||
|
||
find_package( | ||
Qt${QT_VERSION_MAJOR} | ||
COMPONENTS Core | ||
Gui | ||
Network | ||
Quick | ||
Widgets | ||
REQUIRED) | ||
|
||
# Require Qt >5.15 | ||
|
@@ -48,42 +88,47 @@ if (APPLE) | |
REQUIRED) | ||
endif () | ||
|
||
include(FindOpenSSL) | ||
|
||
add_executable(ricochet-irc) | ||
|
||
if (DEFINED ENV{RICOCHET_REFRESH_VERSION}) | ||
add_compile_definitions(TEGO_VERSION=$ENV{RICOCHET_REFRESH_VERSION}) | ||
endif () | ||
|
||
target_sources(ricochet-irc PRIVATE | ||
main.cpp ${RICOCHET_QML_RES} ${RICOCHET_QM_RES} | ||
add_executable( | ||
ricochet-irc | ||
main.cpp | ||
utils/Useful.h | ||
utils/Settings.cpp | ||
utils/Settings.h | ||
libtego_callbacks.cpp | ||
shims/UserIdentity.h | ||
shims/ContactsManager.cpp | ||
shims/TorCommand.h | ||
shims/UserIdentity.cpp | ||
shims/ContactUser.h | ||
shims/ContactsManager.h | ||
shims/OutgoingContactRequest.h | ||
shims/ContactIDValidator.h | ||
shims/TorControl.h | ||
shims/TorManager.h | ||
shims/TorCommand.cpp | ||
shims/TorControl.cpp | ||
shims/IncomingContactRequest.h | ||
shims/OutgoingContactRequest.cpp | ||
shims/ConversationModel.cpp | ||
shims/ContactIDValidator.cpp | ||
shims/IncomingContactRequest.cpp | ||
shims/ContactUser.cpp | ||
shims/ConversationModel.h | ||
shims/TorManager.cpp | ||
libtego_callbacks.hpp | ||
IrcChannel.cpp | ||
IrcChannel.h | ||
IrcConnection.cpp | ||
IrcConnection.h | ||
IrcConstants.h | ||
IrcServer.cpp | ||
IrcServer.h | ||
IrcUser.cpp | ||
IrcUser.h | ||
RicochetIrcServer.cpp | ||
RicochetIrcServer.h | ||
RicochetIrcServerTask.cpp | ||
# Not nice, but we can't link against libtego_ui | ||
# if we want to avoid GUI dependencies: | ||
../libtego_ui/libtego_callbacks.cpp | ||
../libtego_ui/shims/ContactIDValidator.cpp | ||
../libtego_ui/shims/ContactsManager.cpp | ||
../libtego_ui/shims/ContactUser.cpp | ||
../libtego_ui/shims/ConversationModel.cpp | ||
../libtego_ui/shims/IncomingContactRequest.cpp | ||
../libtego_ui/shims/OutgoingContactRequest.cpp | ||
../libtego_ui/shims/TorCommand.cpp | ||
../libtego_ui/shims/TorControl.cpp | ||
../libtego_ui/shims/TorManager.cpp | ||
../libtego_ui/shims/UserIdentity.cpp | ||
../libtego_ui/utils/Settings.cpp | ||
) | ||
if (STATIC_QT) | ||
include(qmake_static) | ||
target_generate_static_qml_plugins(ricochet-irc) | ||
target_generate_static_qt_plugins(ricochet-irc) | ||
endif () | ||
RicochetIrcServerTask.h) | ||
|
||
target_precompile_headers(ricochet-irc PRIVATE precomp.hpp) | ||
|
||
|
@@ -94,40 +139,30 @@ setup_compiler(ricochet-irc) | |
|
||
target_compile_features(ricochet-irc PRIVATE cxx_std_20) | ||
|
||
target_link_libraries(ricochet-irc PUBLIC tego) | ||
# Since ricochet-refresh includes libtego_callbacks.hpp as a system header file, we export the include directory twice, | ||
# once as local, once as system TODO: perhaps there's a cleaner way to go about this | ||
target_include_directories(ricochet-irc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
target_include_directories(ricochet-irc SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
# Ugly, but we need bits of libtego_ui without linking to it, | ||
# in order to avoid GUI dependencies. | ||
target_include_directories(ricochet-irc PUBLIC ../libtego_ui/) | ||
target_link_libraries(ricochet-irc PUBLIC tego) | ||
|
||
if (NOT USE_SUBMODULE_FMT) | ||
find_package(fmt REQUIRED) | ||
endif () | ||
target_link_libraries(ricochet-irc PRIVATE fmt::fmt-header-only) | ||
target_link_libraries(ricochet-irc PRIVATE OpenSSL::Crypto) | ||
|
||
# QT | ||
target_link_libraries( | ||
ricochet-irc | ||
PRIVATE Qt${QT_VERSION_MAJOR}::Core | ||
Qt${QT_VERSION_MAJOR}::Network) | ||
Qt${QT_VERSION_MAJOR}::Widgets | ||
Qt${QT_VERSION_MAJOR}::Network | ||
Qt${QT_VERSION_MAJOR}::Qml | ||
Qt${QT_VERSION_MAJOR}::Quick) | ||
if (APPLE) | ||
target_link_libraries(ricochet-irc PRIVATE Qt${QT_VERSION_MAJOR}::MacExtras) | ||
endif () | ||
|
||
if ("${CMAKE_BUILD_TYPE}" MATCHES "Rel.*" OR "${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel") | ||
target_compile_definitions(ricochet-irc PRIVATE QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT) | ||
endif () | ||
|
||
# Linux / Cygwin | ||
if (UNIX) | ||
# Again, not sure if this needs to be UNIX AND NOT WIN32, or if we should | ||
# install to /bin on Cygwin like it does now | ||
install(TARGETS ricochet-irc DESTINATION usr/bin) | ||
endif () | ||
|
||
# Move our final binary to a bin dir inside the output dir. This makes it | ||
# easier for integration with ricochet-build | ||
set_target_properties(ricochet-irc | ||
PROPERTIES | ||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ricochet-irc/" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* QtLocalIRCD - part of https://github.com/wfr/ricochet-irc/ | ||
* Copyright (C) 2016, Wolfgang Frisch <[email protected]> | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are | ||
* met: | ||
* | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* | ||
* * Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following disclaimer | ||
* in the documentation and/or other materials provided with the | ||
* distribution. | ||
* | ||
* * Neither the names of the copyright owners nor the names of its | ||
* contributors may be used to endorse or promote products derived from | ||
* this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
#ifndef IRCUSER_H | ||
#define IRCUSER_H | ||
|
||
#include <QObject> | ||
|
||
class IrcServer; | ||
|
||
class IrcUser : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit IrcUser(QObject *ircserver = 0); | ||
|
||
QString nick, user, hostname, realname; | ||
virtual QString getPrefix(); | ||
|
||
signals: | ||
void privmsg(IrcUser *user, const QString& msgtarget, const QString& text); | ||
void joined(IrcUser* user, const QString& channel); | ||
|
||
public slots: | ||
|
||
protected: | ||
IrcServer *ircserver; | ||
|
||
private: | ||
}; | ||
|
||
#endif // IRCUSER_H |
Oops, something went wrong.