Merge branch 'insp3' into master.

This commit is contained in:
Sadie Powell 2022-04-26 17:05:12 +01:00
commit 4f58176bc2
13 changed files with 81 additions and 100 deletions

View File

@ -20,6 +20,7 @@ jobs:
- name: Install libraries
working-directory: ${{ github.workspace }}/win/build
run: |
(Get-Content ../conanfile.txt).replace('##', '') | Set-Content ../conanfile.txt
conan install .. --build=missing
- name: Run CMake

View File

@ -12,7 +12,7 @@ InspIRCd is supported on the following platforms:
- The most recent three major releases of macOS using the AppleClang 10, Clang 5+, or GCC 7+ (*not* LLVM-GCC) compilers and the GNU toolchain.
- Windows 7 or newer using the MSVC 19.15+ (Visual Studio 15.8 2017) compiler and CMake 2.8+.
- Windows 10 or newer using the MSVC 19.15+ (Visual Studio 15.8 2017) compiler and CMake 3.8 or newer.
Alternate platforms and toolchains may also work but are not officially supported by the InspIRCd team. Generally speaking if you are using a reasonably modern UNIX-like system you should be able to build InspIRCd on it.

View File

@ -7,7 +7,6 @@ OUTPUT_DIRECTORY = docs/doxygen
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
OUTPUT_TEXT_DIRECTION = None
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
@ -64,6 +63,7 @@ INTERNAL_DOCS = NO
CASE_SENSE_NAMES = NO
HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
SHOW_HEADERFILE = YES
SHOW_INCLUDE_FILES = YES
SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
@ -90,6 +90,7 @@ QUIET = NO
WARNINGS = NO
WARN_IF_UNDOCUMENTED = NO
WARN_IF_DOC_ERROR = YES
WARN_IF_INCOMPLETE_DOC = YES
WARN_NO_PARAMDOC = NO
WARN_AS_ERROR = NO
WARN_FORMAT = "$file:$line: $text"
@ -123,10 +124,6 @@ REFERENCES_LINK_SOURCE = YES
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
CLANG_ASSISTED_PARSING = NO
CLANG_ADD_INC_PATHS = YES
CLANG_OPTIONS =
CLANG_DATABASE_PATH =
ALPHABETICAL_INDEX = YES
IGNORE_PREFIX =
GENERATE_HTML = YES
@ -146,6 +143,7 @@ HTML_DYNAMIC_SECTIONS = NO
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated documentation"
DOCSET_FEEDURL =
DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
@ -168,14 +166,17 @@ GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
GENERATE_TREEVIEW = NO
FULL_SIDEBAR = NO
ENUM_VALUES_PER_LINE = 4
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
OBFUSCATE_EMAILS = YES
HTML_FORMULA_FORMAT = png
FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
FORMULA_MACROFILE =
USE_MATHJAX = NO
MATHJAX_VERSION = MathJax_2
MATHJAX_FORMAT = HTML-CSS
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
MATHJAX_EXTENSIONS =
@ -203,7 +204,6 @@ PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
LATEX_BIB_STYLE = plain
LATEX_TIMESTAMP = NO
LATEX_EMOJI_DIRECTORY =
@ -213,7 +213,6 @@ COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
RTF_SOURCE_CODE = NO
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
@ -225,7 +224,6 @@ XML_PROGRAMLISTING = YES
XML_NS_MEMB_FILE_SCOPE = NO
GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
DOCBOOK_PROGRAMLISTING = NO
GENERATE_AUTOGEN_DEF = NO
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
@ -246,7 +244,6 @@ GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
CLASS_DIAGRAMS = YES
DIA_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
@ -268,6 +265,7 @@ CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DIR_GRAPH_MAX_DEPTH = 1
DOT_IMAGE_FORMAT = png
INTERACTIVE_SVG = NO
DOT_PATH =

View File

@ -33,7 +33,6 @@ class ConfigTag;
class Extensible;
class FakeUser;
class InspIRCd;
class Invitation;
class IOHookProvider;
class LocalUser;
class Membership;

View File

@ -28,7 +28,7 @@
/// $PackageInfo: require_system("ubuntu" "16.04") libmaxminddb-dev pkg-config
#ifdef _WIN32
# pragma comment(lib, "libmaxminddb.lib")
# pragma comment(lib, "maxminddb.lib")
#endif
#include "inspircd.h"

View File

@ -48,8 +48,8 @@
#include <openssl/dh.h>
#ifdef _WIN32
# pragma comment(lib, "ssleay32.lib")
# pragma comment(lib, "libeay32.lib")
# pragma comment(lib, "libcrypto.lib")
# pragma comment(lib, "libssl.lib")
#endif
#if OPENSSL_VERSION_NUMBER >= 0x30000000L

View File

@ -48,7 +48,7 @@ public:
{
User* const user = msg.GetSourceUser();
if (user && user->IsModeSet(botmode))
msg.AddTag("inspircd.org/bot", this, "");
msg.AddTag("bot", this, "");
}
bool ShouldSendTag(LocalUser* user, const ClientProtocol::MessageTagData& tagdata) override

View File

@ -26,6 +26,7 @@
#include "inspircd.h"
#include "modules/invite.h"
enum
{
@ -57,8 +58,10 @@ enum KnockNotify : uint8_t
class CommandKnock final
: public Command
{
private:
SimpleChannelMode& noknockmode;
ChanModeReference inviteonlymode;
Invite::API inviteapi;
public:
int notify;
@ -67,6 +70,7 @@ public:
: Command(Creator,"KNOCK", 2, 2)
, noknockmode(Noknockmode)
, inviteonlymode(Creator, "inviteonly")
, inviteapi(Creator)
{
syntax = { "<channel> :<reason>" };
Penalty = 5;
@ -99,9 +103,33 @@ public:
return CmdResult::FAILURE;
}
// Work out who we should send the knock to.
char status;
switch (inviteapi->GetAnnounceState())
{
case Invite::ANNOUNCE_ALL:
{
status = 0;
break;
}
case Invite::ANNOUNCE_DYNAMIC:
{
PrefixMode* mh = ServerInstance->Modes.FindNearestPrefixMode(HALFOP_VALUE);
status = mh->GetPrefix() ? mh->GetPrefix() : '@';
break;
}
default:
{
status = '@';
break;
}
}
if (notify & KN_SEND_NOTICE)
{
c->WriteNotice(InspIRCd::Format("User %s is KNOCKing on %s (%s)", user->nick.c_str(), c->name.c_str(), parameters[1].c_str()));
c->WriteNotice(InspIRCd::Format("User %s is KNOCKing on %s (%s)", user->nick.c_str(), c->name.c_str(), parameters[1].c_str()), status);
user->WriteNotice("KNOCKing on " + c->name);
}
@ -111,7 +139,7 @@ public:
numeric.push(c->name).push(user->GetFullHost()).push("is KNOCKing: " + parameters[1]);
ClientProtocol::Messages::Numeric numericmsg(numeric, c->name);
c->Write(ServerInstance->GetRFCEvents().numeric, numericmsg);
c->Write(ServerInstance->GetRFCEvents().numeric, numericmsg, status);
user->WriteNumeric(RPL_KNOCKDLVR, c->name, "KNOCKing on channel");
}

View File

@ -44,7 +44,7 @@ if(MSVC)
set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "${CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL} /SAFESEH:NO")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO")
endif(MSVC)
endif()
file(GLOB INSPIRCD_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"${INSPIRCD_BASE}/win/inspircd_win32wrapper.cpp"
@ -60,7 +60,7 @@ link_directories(${EXTRA_LIBS})
if(MSVC)
add_library(win32_memory STATIC "${INSPIRCD_BASE}/win/inspircd_memory_functions.cpp")
endif(MSVC)
endif()
configure_file("${INSPIRCD_BASE}/win/inspircd.rc.cmake" "${INSPIRCD_BASE}/win/inspircd.rc")
configure_file("${INSPIRCD_BASE}/make/template/config.h" "${INSPIRCD_BASE}/include/config.h")
@ -77,8 +77,8 @@ file(GLOB EXTRA_DLLS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${INSPIRCD_BASE}/win/
install(FILES ${EXTRA_DLLS} DESTINATION .)
# Install example configs
file(GLOB_RECURSE EXAMPLE_CONFIGS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${INSPIRCD_BASE}/docs/conf/*.example")
install(FILES ${EXAMPLE_CONFIGS} DESTINATION conf)
install(DIRECTORY "${INSPIRCD_BASE}/docs/conf/" DESTINATION "${CONFIG_DIR}/examples")
install(DIRECTORY "${INSPIRCD_BASE}/docs/sql/" DESTINATION "${CONFIG_DIR}/sql")
# Create an empty data and logs directory and install them
file(MAKE_DIRECTORY ${DATA_DIR})
@ -109,4 +109,4 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
set(CPACK_NSIS_COMPRESSOR "/SOLID zlib")
include(CPack)
endif(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
endif()

View File

@ -119,7 +119,7 @@ Var AR_RegFlags
"exit_${SecName}:"
!macroend
!macro RemoveSection SecName
!macro RemoveSection_CPack SecName
; This macro is used to call section's Remove_... macro
;from the uninstaller.
;Input: section index constant name specified in Section command.
@ -847,7 +847,7 @@ Section "Uninstall"
DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
; Removes all optional components
!insertmacro SectionList "RemoveSection"
!insertmacro SectionList "RemoveSection_CPack"
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP

View File

@ -1,56 +0,0 @@
Building InspIRCd for Windows:
Prerequisites:
Visual Studio 2015 or newer (https://www.visualstudio.com)
CMake 2.8 or newer (https://cmake.org)
If building the installer, NSIS (https://nsis.sourceforge.io)
Configuring:
First copy any extra modules from extras (such as m_mysql) to the modules directory that you want to build.
Run CMake to generate build files. This can be done using the CMake GUI by setting the source code path to "win",
and the binary path to "win/build", followed by pressing "Configure". Modify any variables you need, such as install
prefix, and then press "Generate".
Alternatively CMake can be run from Command Prompt from the "win\build" directory, eg:
c:\Users\Adam\Desktop\inspircd\win\build>cmake -G "Visual Studio 11" ..
-- Check for working CXX compiler using: Visual Studio 11
-- Check for working CXX compiler using: Visual Studio 11 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Adam/Desktop/inspircd/win/build
This generates project files for Visual Studio 11 (2012). Available generators can be seen in cmake --help,
such as Visual Studio 10 and NMake Makefiles.
If some of the modules you are building require libraries that are not in the default system path
(and thus not found by CMake), you can inform CMake about them by defining EXTRA_INCLUDES and
EXTRA_LIBS when configuring, eg;
cmake -DEXTRA_INCLUDES:STRING="C:\inspircd-includes" -DEXTRA_LIBS:STRING="C:\inspircd-libs" -G "Visual Studio 11" ..
See the CMake GUI for a full list of variables that can be set.
Additionally, place any DLL files required by any extra modules in to the win directory for the installer to pick up.
Building:
Open the InspIRCd Microsoft Visual Studio Solution file. If you are building a release, be sure to change
the Solution Configuration to Release before starting the build. Start the build by right clicking the
InspIRCd solution in the solution explorer and clicking "Build Solution"
If you are building using NMake Makefiles, simply use "nmake".
Installing:
If you do not want to build the installer you can simply build the INSTALL target, which will probably install
InspIRCd into C:\Program Files\InspIRCd. This may require administrative privileges by Visual Studio.
If you are building using NMake Makefiles, simply use "nmake install".
Building the installer:
Locate the PACKAGE project on Visual Studio's Solution Explorer and build it. This will generate an InspIRCd-x.x.x.exe
installer in the build directory which is ready to be distributed.
If you are building using NMake Makefiles or do not want to build the installer in Visual Studio, simply use "cpack".

View File

@ -1,4 +1,4 @@
# Last updated: 2022-04-05
# Last updated: 2022-04-24
#
# Modules we can't legally ship: geo_maxmind, ssl_mbedtls, ssl_openssl
# Modules which don't apply to Windows: regex_posix, sslrehashsignal
@ -6,12 +6,12 @@
[requires]
argon2/20190702
# libmaxminddb/1.6.0
## libmaxminddb/1.6.0
libmysqlclient/8.0.25
libpq/14.2
# mbedtls/3.1.0
# openssl/3.0.2
pcre2/10.39
## mbedtls/3.1.0
## openssl/1.1.1n # unable to upgrade yet because of dependency issues
pcre2/10.40
re2/20220201
sqlite3/3.38.1
zlib/1.2.12 # force override to fix a conflict between libmysqlclient and pcre
@ -21,7 +21,6 @@ argon2:shared=True
libmaxminddb:shared=True
libmysqlclient:shared=True
libpq:shared=True
mbedtls:shared=True
openssl:shared=True
pcre2:shared=True
re2:shared=True

View File

@ -1,14 +1,26 @@
if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_argon2.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/")
file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_pgsql.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/")
file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_mysql.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/")
file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_regex_pcre.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/")
file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_regex_re2.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/")
file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_sqlite3.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/")
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
link_directories("${CMAKE_BINARY_DIR}/extradll" "${CMAKE_BINARY_DIR}/extralib")
function(enable_extra NAME PACKAGE)
if(DEFINED "CONAN_${PACKAGE}_ROOT")
message("Enabling the ${NAME} module")
file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_${NAME}.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/")
else()
message("Unable to enable the ${NAME} module (missing library)")
endif()
endfunction()
enable_extra("argon2" "ARGON2")
enable_extra("geo_maxmind" "LIBMAXMINDDB")
enable_extra("mysql" "LIBMYSQLCLIENT")
enable_extra("pgsql" "LIBPQ")
enable_extra("regex_pcre" "PCRE2")
enable_extra("regex_re2" "RE2")
enable_extra("ssl_mbedtls" "MBEDTLS")
enable_extra("ssl_openssl" "OPENSSL")
enable_extra("sqlite3" "SQLITE3")
link_directories("${CMAKE_BINARY_DIR}/extradll" "${CMAKE_BINARY_DIR}/extralib")
file(GLOB EXTRA_DLLS "${CMAKE_BINARY_DIR}/extradll/*.dll")
install(FILES ${EXTRA_DLLS} DESTINATION .)
@ -25,18 +37,18 @@ add_definitions("-DDLL_BUILD")
foreach(MODULE_NAME ${INSPIRCD_MODULES})
if(IS_DIRECTORY "${MODULE_NAME}")
string(REGEX REPLACE "^.*[/\\](.*)$" "\\1" BASE_NAME ${MODULE_NAME})
else(IS_DIRECTORY "${MODULE_NAME}")
else()
string(REGEX REPLACE "^.*[/\\](.*).cpp$" "\\1" BASE_NAME ${MODULE_NAME})
endif(IS_DIRECTORY "${MODULE_NAME}")
endif()
set(SO_NAME "${BASE_NAME}.dll")
if(IS_DIRECTORY "${MODULE_NAME}")
file(GLOB MODULES_SUBDIR_SRCS "${MODULE_NAME}/*.cpp")
list(SORT MODULES_SUBDIR_SRCS)
add_library(${SO_NAME} MODULE ${MODULES_SUBDIR_SRCS})
else(IS_DIRECTORY "${MODULE_NAME}")
else()
add_library(${SO_NAME} MODULE ${MODULE_NAME})
endif(IS_DIRECTORY "${MODULE_NAME}")
endif()
# Generate the module and set its linker flags, also set it to depend on the main executable to be built beforehand
target_link_libraries(${SO_NAME} inspircd)
@ -44,7 +56,7 @@ foreach(MODULE_NAME ${INSPIRCD_MODULES})
if(MSVC)
target_link_libraries(${SO_NAME} win32_memory)
add_dependencies(${SO_NAME} win32_memory)
endif(MSVC)
endif()
if(CONAN_CXX_FLAGS)
conan_target_link_libraries("${SO_NAME}")
@ -58,4 +70,4 @@ foreach(MODULE_NAME ${INSPIRCD_MODULES})
# Set the module to be installed to the module directory
install(TARGETS ${SO_NAME} DESTINATION ${MODULE_DIR})
endforeach(MODULE_NAME ${INSPIRCD_MODULES})
endforeach()