Commit f820d86a authored by Jonas Smedegaard's avatar Jonas Smedegaard

New upstream version 4.0

parents eda4b75b 9634cdab
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# Gcov files
*.gcno
*.gcov
*.gcda
# Python files
*.pyc
*.pyo
# Build directories
build/
# Clion directory
.idea/
\ No newline at end of file
before_script:
- uname -a
- whoami
- echo $LANG
- g++ --version
- clang++ --version
- rm -rf build/
- mkdir build/
- cd build
variables:
COMPILER: "g++"
BUILD_TYPE: "Debug"
BOTAN: "-DWITH_BOTAN=1"
CARES: "-DWITH_CARES=1"
SYSTEMD: "-DWITH_SYSTEMD=1"
LIBIDN: "-DWITH_LIBIDN=1"
LITESQL: "-DWITH_LITESQL=1"
.template:basic_build: &basic_build
stage: build
script:
- "echo Running cmake with the following parameters: -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${CARES} ${SYSTEMD} ${LIBIDN} ${LITESQL}"
- cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${CARES} ${SYSTEMD} ${LIBIDN} ${LITESQL}
- make biboumi -j$(nproc)
- make check -j$(nproc)
image: biboumi-test-fedora:latest
build:1:
variables:
BOTAN: "-DWITHOUT_BOTAN=1"
<<: *basic_build
build:2:
variables:
CARES: "-DWITHOUT_CARES=1"
<<: *basic_build
build:3:
variables:
LITESQL: "-DWITHOUT_LITESQL=1"
<<: *basic_build
build:4:
variables:
LITESQL: "-DWITHOUT_LITESQL=1"
BOTAN: "-DWITHOUT_BOTAN=1"
<<: *basic_build
build:5:
variables:
LITESQL: "-DWITHOUT_LITESQL=1"
CARES: "-DWITHOUT_CARES=1"
<<: *basic_build
build:6:
variables:
BOTAN: "-DWITHOUT_BOTAN=1"
CARES: "-DWITHOUT_CARES=1"
<<: *basic_build
build:6:
variables:
LIBIDN: "-DWITHOUT_LIBIDN=1"
CARES: "-DWITHOUT_CARES=1"
<<: *basic_build
build:rpm:
stage: build
script:
- cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${CARES} ${SYSTEMD} ${LIBIDN} ${LITESQL}
- make rpm -j$(nproc)
artifacts:
paths:
- build/rpmbuild/RPMS
- build/rpmbuild/SRPMS
when: always
.template:basic_test: &basic_test
stage: test
script:
- cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${CARES} ${SYSTEMD} ${LIBIDN} ${LITESQL}
- make biboumi -j$(nproc)
- make check
- make coverage
- mkdir tests_outputs && pushd tests_outputs && make e2e -j$(nproc) -C .. && popd
artifacts:
paths:
- build/coverage/
- build/tests_outputs/
when: always
test:debian:
stage: test
image: biboumi-test-debian:latest
<<: *basic_test
test:fedora:
stage: test
image: biboumi-test-fedora:latest
<<: *basic_test
\ No newline at end of file
Version 4.0 - 2016-11-09
========================
- The separator between the IRC nickname and the IRC server is now '%'
instead of '!'. This makes things simpler (only one separator to
remember). The distinction between a JID referring to a channel and a JID
refering to a nickname is based on the first character (# or & by
default, but this can be customized by the server with the ISUPPORT
extension).
- Handle channel invitations in both directions.
- Add support for `JID escaping <.http://www.xmpp.org/extensions/xep-0106.html>`.
- Save all channel messages into the database, with an ad-hoc option to
disable this feature.
- When joining a room, biboumi sends an history of the most recents messages
found in the database.
- Channel history can be retrieved using Message Archive Management.
- Result Set Management can be used to request only parts of the IRC channel
list.
Version 3.0 - 2016-08-03
========================
......
......@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
project(biboumi)
set(${PROJECT_NAME}_VERSION_MAJOR 3)
set(${PROJECT_NAME}_VERSION_MAJOR 4)
set(${PROJECT_NAME}_VERSION_MINOR 0)
set(${PROJECT_NAME}_VERSION_SUFFIX "")
......@@ -96,7 +96,7 @@ if(LITESQL_FOUND)
add_library(database STATIC src/database/database.cpp
${LITESQL_GENERATED_SOURCES})
target_link_libraries(database ${LITESQL_LIBRARIES})
target_link_libraries(database ${LITESQL_LIBRARIES} utils)
if(BOTAN_FOUND)
target_link_libraries(database ${BOTAN_LIBRARIES})
endif()
......@@ -215,7 +215,7 @@ if(NOT EXISTS ${CMAKE_SOURCE_DIR}/tests/catch.hpp)
)
add_dependencies(test_suite catch)
endif()
add_custom_target(check COMMAND "test_suite" "-s"
add_custom_target(check COMMAND "test_suite"
DEPENDS test_suite biboumi)
add_custom_target(e2e COMMAND "python3" "${CMAKE_CURRENT_SOURCE_DIR}/tests/end_to_end/"
DEPENDS biboumi)
......@@ -232,6 +232,10 @@ if(CMAKE_BUILD_TYPE MATCHES Debug)
test_suite
coverage
)
SETUP_TARGET_FOR_COVERAGE(coverage_e2e
make
coverage_e2e
e2e)
endif()
#
......@@ -246,8 +250,8 @@ install(FILES conf/biboumi.cfg DESTINATION /etc/bib
## Dist target
## Generate a release tarball from the git sources
#
add_custom_target(dist
COMMAND git archive --prefix=${ARCHIVE_NAME}/ --format=tar HEAD
add_custom_command(OUTPUT ${ARCHIVE_NAME}.tar.xz
COMMAND git archive --prefix=${ARCHIVE_NAME}/ --format=tar HEAD^{tree}
> ${CMAKE_CURRENT_BINARY_DIR}/${ARCHIVE_NAME}.tar
# Append this specific file that is not part of the git repo
COMMAND tar -rf ${CMAKE_CURRENT_BINARY_DIR}/${ARCHIVE_NAME}.tar -P ${SOURCE_DIR}/single_include/catch.hpp --xform 's|/.*/|${ARCHIVE_NAME}/tests/|g'
......@@ -258,13 +262,15 @@ add_custom_target(dist
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "${ARCHIVE_NAME}.tar.xz created."
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
add_dependencies(dist catch)
add_custom_target(dist
DEPENDS ${ARCHIVE_NAME}.tar.xz
DEPENDS catch)
add_custom_target(rpm
DEPENDS dist
COMMAND mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
COMMAND rpmbuild --define "_topdir `pwd`/rpmbuild/" --define "_sourcedir `pwd`" -ba biboumi.spec
)
add_dependencies(rpm dist)
if(BOTAN_FOUND)
set(STR_WITH_BOTAN "Botan: yes")
......
Contributing to biboumi
=======================
Biboumi’s main workplace is at https://lab.louiz.org/louiz/biboumi
The repository is also mirrored on other websites, for example on github,
but that’s mainly for the convenience of users.
Before doing anything, you can come on the `XMPP chatroom`_ to discuss your
changes, issues or ideas.
Bug reports, feature requests
-----------------------------
To open a bug report, or a feature request, please do so on `our gitlab’s
bug tracker`_.
If the issue you’re reporting may have security implications, please select
the “confidential” flag in your bug report.
Code
----
To contribute code, you can do so using git: commit your changes on any
publicly available git repository and communicate us its address. This can
be done with a `gitlab merge request`_, or a `github pull request`_ or just
by sending a message into the `XMPP chatroom`_.
It is suggested that you use gitlab’s merge requests: this will
automatically run our continuous integration tests.
It is also recommended to add some unit or end-to-end tests for the proposed
changes.
Coding style
------------
Please try to follow the existing style:
- Use only spaces, not tabs.
- Curly brackets are on their own lines.
- Use this-> everywhere it’s possible.
- Don’t start class attributes with “m_” or similar.
- Type names are in PascalCase.
- Everything else is in snake_case.
.. _our gitlab’s bug tracker: https://lab.louiz.org/louiz/biboumi/issues/new
.. _gitlab merge request: https://lab.louiz.org/louiz/biboumi/merge_requests/new
.. _github pull request: https://github.com/louiz/biboumi/pulls
.. _XMPP chatroom: xmpp:biboumi@muc.poez.io
Copyright (c) 2015 Florent Le Coz
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
......
Biboumi
=======
.. image:: https://lab.louiz.org/louiz/biboumi/badges/master/build.svg
:target: https://lab.louiz.org/louiz/biboumi/commits/master
.. image:: https://lab.louiz.org/louiz/biboumi/badges/master/coverage.svg
:target: https://lab.louiz.org/louiz/biboumi/commits/master
.. image:: https://sonarqube.com/api/badges/gate?key=biboumi
:target: https://sonarqube.com/component_issues/index?id=biboumi
.. image:: https://scan.coverity.com/projects/3726/badge.svg
:target: https://scan.coverity.com/projects/louiz-biboumi
.. image:: https://bestpractices.coreinfrastructure.org/projects/450/badge
:target: https://bestpractices.coreinfrastructure.org/projects/450
Biboumi is an XMPP gateway that connects to IRC servers and translates
between the two protocols. It can be used to access IRC channels using any
XMPP client as if these channels were XMPP MUCs.
......@@ -29,6 +44,7 @@ Usage
-----
Read `the documentation`_.
Authors
-------
Florent Le Coz (louiz’) <louiz@louiz.org>
......@@ -37,17 +53,9 @@ Florent Le Coz (louiz’) <louiz@louiz.org>
Contact/Support
---------------
* XMPP ChatRoom: biboumi@muc.poez.io
* Report a bug: https://dev.louiz.org/projects/biboumi/issues/new
To contribute, the preferred way is to commit your changes on some
publicly-available git repository (your own, or github
(https://github.com/louiz/biboumi), or a fork on https://lab.louiz.org) and
to notify the developers with a ticket on the bug tracker
(https://dev.louiz.org/projects/biboumi/issues/new), a pull request on
github or a merge request on gitlab.
* Report a bug: https://lab.louiz.org/louiz/biboumi/issues/new
Optionally you can come discuss your changes on the XMPP chat room,
beforehand.
Also, see the `contributing`_ page.
Licence
......@@ -60,3 +68,4 @@ Please read the COPYING file for details.
.. _INSTALL: INSTALL.rst
.. _the documentation: doc/biboumi.1.rst
.. _contributing: CONTRIBUTING.rst
......@@ -47,23 +47,23 @@
#
# 3. Set compiler flags to turn off optimization and enable coverage:
# SET(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
# SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
# SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
#
# 3. Use the function SETUP_TARGET_FOR_COVERAGE to create a custom make target
# which runs your test executable and produces a lcov code coverage report:
# Example:
# SETUP_TARGET_FOR_COVERAGE(
# my_coverage_target # Name for custom target.
# test_driver # Name of the test driver executable that runs the tests.
# # NOTE! This should always have a ZERO as exit code
# # otherwise the coverage generation will not complete.
# coverage # Name of output directory.
# )
# SETUP_TARGET_FOR_COVERAGE(
# my_coverage_target # Name for custom target.
# test_driver # Name of the test driver executable that runs the tests.
# # NOTE! This should always have a ZERO as exit code
# # otherwise the coverage generation will not complete.
# coverage # Name of output directory.
# )
#
# 4. Build a Debug build:
# cmake -DCMAKE_BUILD_TYPE=Debug ..
# make
# make my_coverage_target
# cmake -DCMAKE_BUILD_TYPE=Debug ..
# make
# make my_coverage_target
#
#
......@@ -76,9 +76,9 @@ FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests)
# Display an error when the target is called. If no error is found, this
# function will be overridden by the real one later in this file
FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
ADD_CUSTOM_TARGET(${_targetname}
ADD_CUSTOM_TARGET(${_targetname}
COMMAND echo "Coverage is not available: ${ERROR_MSG}"
)
)
ENDFUNCTION()
IF(NOT GCOV_PATH)
......@@ -130,50 +130,50 @@ ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
# Param _targetname The name of new the custom make target
# Param _testrunner The name of the target which runs the tests.
# MUST return ZERO always, even on errors.
# If not, no coverage report will be created!
# MUST return ZERO always, even on errors.
# If not, no coverage report will be created!
# Param _outputname lcov output is generated as _outputname.info
# HTML report is generated in _outputname/index.html
# Optional fifth parameter is passed as arguments to _testrunner
# Pass them in list form, e.g.: "-j;2" for -j 2
FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
# Setup target
ADD_CUSTOM_TARGET(${_targetname}
# Setup target
ADD_CUSTOM_TARGET(${_targetname}
# Cleanup lcov
COMMAND ${LCOV_PATH} --directory . --zerocounters
# Cleanup lcov
COMMAND ${LCOV_PATH} --directory . --zerocounters
# Create baseline coverage data file
COMMAND ${LCOV_PATH} -c -i -d . -o ${_outputname}.baseline.info -q
# Create baseline coverage data file
COMMAND ${LCOV_PATH} -c -i -d . -o ${_outputname}.baseline.info -q
# Run tests
COMMAND ${_testrunner} ${ARGV3}
# Run tests
COMMAND ${_testrunner} ${ARGV3}
# Capturing lcov counters and generating report
COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info -q
# Combine the baseline and the test data
COMMAND ${LCOV_PATH} -a ${_outputname}.info -a ${_outputname}.baseline.info -o ${_outputname}.info -q
# Capturing lcov counters and generating report
COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info -q
# Combine the baseline and the test data
COMMAND ${LCOV_PATH} -a ${_outputname}.info -a ${_outputname}.baseline.info -o ${_outputname}.info -q
# Remove information about source files that are not part of
# the test (system file, external libraries, etc)
COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' 'external/*' --output-file ${_outputname}.info.cleaned -q
# Remove information about source files that are not part of
# the test (system file, external libraries, etc)
COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' 'external/*' 'build/*' --output-file ${_outputname}.info.cleaned -q
# Generate the report
COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned
# Generate the report
COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned
# Clean the temporary files we created
COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned
# Clean the temporary files we created
COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
)
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
)
# Show info where to find the report
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
COMMAND ;
COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report."
)
# Show info where to find the report
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
COMMAND ;
COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report."
)
ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE
......@@ -184,30 +184,30 @@ ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE
# Pass them in list form, e.g.: "-j;2" for -j 2
FUNCTION(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname)
IF(NOT PYTHON_EXECUTABLE)
MESSAGE(FATAL_ERROR "Python not found! Aborting...")
ENDIF() # NOT PYTHON_EXECUTABLE
IF(NOT PYTHON_EXECUTABLE)
MESSAGE(FATAL_ERROR "Python not found! Aborting...")
ENDIF() # NOT PYTHON_EXECUTABLE
IF(NOT GCOVR_PATH)
MESSAGE(FATAL_ERROR "gcovr not found! Aborting...")
ENDIF() # NOT GCOVR_PATH
IF(NOT GCOVR_PATH)
MESSAGE(FATAL_ERROR "gcovr not found! Aborting...")
ENDIF() # NOT GCOVR_PATH
MARK_AS_ADVANCED(GCOVR_PATH)
ADD_CUSTOM_TARGET(${_targetname}
ADD_CUSTOM_TARGET(${_targetname}
# Run tests
${_testrunner} ${ARGV3}
# Run tests
${_testrunner} ${ARGV3}
# Running gcovr
COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} -e '${CMAKE_SOURCE_DIR}/tests/' -o ${_outputname}.xml
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Running gcovr to produce Cobertura code coverage report."
)
# Running gcovr
COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} -e '${CMAKE_SOURCE_DIR}/tests/' -o ${_outputname}.xml
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Running gcovr to produce Cobertura code coverage report."
)
# Show info where to find the report
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
COMMAND ;
COMMENT "Cobertura code coverage report saved in ${_outputname}.xml."
)
# Show info where to find the report
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
COMMAND ;
COMMENT "Cobertura code coverage report saved in ${_outputname}.xml."
)
ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE_COBERTURA
......@@ -2,6 +2,16 @@
<!DOCTYPE database SYSTEM "litesql.dtd">
<database name="BibouDB" namespace="db">
<object name="GlobalOptions">
<field name="owner" type="string" length="3071"/>
<field name="maxHistoryLength" type="integer" default="20"/>
<field name="recordHistory" type="boolean" default="true"/>
<index unique="true">
<indexfield name="owner"/>
</index>
</object>
<object name="IrcServerOptions">
<field name="owner" type="string" length="3071"/>
<field name="server" type="string" length="3071"/>
......@@ -18,6 +28,7 @@
<field name="encodingOut" type="string" default="ISO-8859-1"/>
<field name="encodingIn" type="string" default="ISO-8859-1"/>
<field name="maxHistoryLength" type="integer" default="20"/>
<index unique="true">
<indexfield name="owner"/>
<indexfield name="server"/>
......@@ -32,6 +43,8 @@
<field name="encodingOut" type="string"/>
<field name="encodingIn" type="string"/>
<field name="maxHistoryLength" type="integer" default="20"/>
<index unique="true">
<indexfield name="owner"/>
<indexfield name="server"/>
......@@ -39,8 +52,17 @@
</index>
</object>
<object name="LogLine">
<field name="date" type="date" />
<field name="body" type="string" length="4096"/>
<object name="MucLogLine">
<field name="uuid" type="string" length="36" />
<!-- The bare JID of the user for which we stored the line. It's
the JID associated with the Bridge -->
<field name="owner" type="string" length="4096" />
<!-- The room IID -->
<field name="ircChanName" type="string" length="4096" />
<field name="ircServerName" type="string" length="4096" />
<field name="date" type="datetime" />
<field name="body" type="string" length="65536"/>
<field name="nick" type="string" length="4096" />
</object>
</database>
......@@ -19,7 +19,7 @@ XMPP client as if these channels were XMPP MUCs.
Synopsis
========
biboumi [*config_filename*\ ]
biboumi [*config_filename*]
Options
=======
......@@ -86,16 +86,13 @@ irc.example.org), then biboumi will enforce the connexion to that IRC
server only. This means that a JID like "#chan@biboumi.example.com" must
be used instead of "#chan%irc.example.org@biboumi.example.com". In that
mode, the virtual channel (see `Connect to an IRC server`_) is not
available and you still need to use the ! separator to send message to an
IRC user (for example "foo!@biboumi.example.com" to send a message to
foo), although the in-room JID still work as expected
("#channel@biboumi.example.com/Nick"). On the other hand, the '%' lose
any meaning. It can appear in the JID but will not be interpreted as a
separator (thus the JID "#channel%hello@biboumi.example.com" points to the
channel named "#channel%hello" on the configured IRC server) This option
can for example be used by an administrator that just wants to let their
users join their own IRC server using an XMPP client, while forbidding
access to any other IRC server.
available. The '%' character loses any meaning in the JIDs. It can appear
in the JID but will not be interpreted as a separator (thus the JID
"#channel%hello@biboumi.example.com" points to the channel named
"#channel%hello" on the configured IRC server) This option can for example
be used by an administrator that just wants to let their users join their own
IRC server using an XMPP client, while forbidding access to any other IRC
server.
realname_customization
----------------------
......@@ -142,7 +139,7 @@ default is 0, but a more practical value for production use is 1.
ca_file
-------
Specifies which file should be use as the list of trusted CA when
Specifies which file should be used as the list of trusted CA when
negociating a TLS session. By default this value is unset and biboumi
tries a list of well-known paths.
......@@ -201,26 +198,21 @@ the domain served by biboumi (the part after the ``@``, biboumi.example.com in
the examples), and the local part (the part before the ``@``) depends on the
concerned entity.
IRC channels have a local part formed like this:
``channel_name`` % ``irc_server``.
IRC channels and IRC users have a local part formed like this:
``name`` % ``irc_server``.
If the IRC channel you want to adress starts with the ``'#'`` character (or an
other character, announced by the IRC server, like ``'&'``, ``'+'`` or ``'!'``),
then you must include it in the JID. Some other gateway implementations, as
well as some IRC clients, do not require them to be started by one of these
characters, adding an implicit ``'#'`` in that case. Biboumi does not do that
because this gets confusing when trying to understand the difference between
the channels *#foo*, and *##foo*. Note that biboumi does not use the
presence of these special characters to identify an IRC channel, only the
presence of the separator `%` is used for that.
``name`` can be a channel name or an user nickname. The distinction between
the two is based on the first character: by default, if the name starts with
``'#'`` or ``'&'`` (but this can be overridden by the server, using the
ISUPPORT extension) then it’s a channel name, otherwise this is a nickname.