Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
biboumi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
88
Issues
88
List
Boards
Labels
Service Desk
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
louiz’
biboumi
Commits
d600a284
Commit
d600a284
authored
Feb 27, 2015
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove all the libs that are now in louloulibs
parent
1028d4d5
Changes
50
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
50 changed files
with
713 additions
and
3722 deletions
+713
-3722
CMakeLists.txt
CMakeLists.txt
+18
-105
cmake/Modules/FindBOTAN.cmake
cmake/Modules/FindBOTAN.cmake
+0
-35
cmake/Modules/FindCARES.cmake
cmake/Modules/FindCARES.cmake
+0
-37
cmake/Modules/FindICONV.cmake
cmake/Modules/FindICONV.cmake
+0
-60
cmake/Modules/FindLIBIDN.cmake
cmake/Modules/FindLIBIDN.cmake
+0
-41
cmake/Modules/FindLIBUUID.cmake
cmake/Modules/FindLIBUUID.cmake
+0
-41
cmake/Modules/FindSYSTEMD.cmake
cmake/Modules/FindSYSTEMD.cmake
+0
-39
src/bridge/bridge.cpp
src/bridge/bridge.cpp
+2
-2
src/bridge/bridge.hpp
src/bridge/bridge.hpp
+3
-3
src/config.h.cmake
src/config.h.cmake
+0
-8
src/config/config.cpp
src/config/config.cpp
+0
-122
src/config/config.hpp
src/config/config.hpp
+0
-103
src/irc/irc_client.cpp
src/irc/irc_client.cpp
+1
-1
src/logger/logger.cpp
src/logger/logger.cpp
+0
-38
src/logger/logger.hpp
src/logger/logger.hpp
+0
-81
src/main.cpp
src/main.cpp
+2
-2
src/network/dns_handler.cpp
src/network/dns_handler.cpp
+0
-112
src/network/dns_handler.hpp
src/network/dns_handler.hpp
+0
-62
src/network/dns_socket_handler.cpp
src/network/dns_socket_handler.cpp
+0
-45
src/network/dns_socket_handler.hpp
src/network/dns_socket_handler.hpp
+0
-46
src/network/poller.cpp
src/network/poller.cpp
+0
-203
src/network/poller.hpp
src/network/poller.hpp
+0
-95
src/network/socket_handler.hpp
src/network/socket_handler.hpp
+0
-45
src/network/tcp_socket_handler.cpp
src/network/tcp_socket_handler.cpp
+0
-572
src/network/tcp_socket_handler.hpp
src/network/tcp_socket_handler.hpp
+0
-297
src/utils/encoding.cpp
src/utils/encoding.cpp
+0
-221
src/utils/encoding.hpp
src/utils/encoding.hpp
+0
-29
src/utils/reload.cpp
src/utils/reload.cpp
+0
-13
src/utils/reload.hpp
src/utils/reload.hpp
+0
-10
src/utils/revstr.cpp
src/utils/revstr.cpp
+0
-9
src/utils/revstr.hpp
src/utils/revstr.hpp
+0
-11
src/utils/scopeguard.hpp
src/utils/scopeguard.hpp
+0
-89
src/utils/sha1.cpp
src/utils/sha1.cpp
+0
-154
src/utils/sha1.hpp
src/utils/sha1.hpp
+0
-35
src/utils/split.cpp
src/utils/split.cpp
+0
-18
src/utils/split.hpp
src/utils/split.hpp
+0
-13
src/utils/timed_events.cpp
src/utils/timed_events.cpp
+0
-62
src/utils/timed_events.hpp
src/utils/timed_events.hpp
+0
-132
src/utils/timed_events_manager.cpp
src/utils/timed_events_manager.cpp
+0
-81
src/utils/tolower.cpp
src/utils/tolower.cpp
+0
-13
src/utils/tolower.hpp
src/utils/tolower.hpp
+0
-11
src/xmpp/adhoc_command.cpp
src/xmpp/adhoc_command.cpp
+7
-3
src/xmpp/adhoc_commands_handler.cpp
src/xmpp/adhoc_commands_handler.cpp
+0
-143
src/xmpp/adhoc_commands_handler.hpp
src/xmpp/adhoc_commands_handler.hpp
+0
-69
src/xmpp/adhoc_session.cpp
src/xmpp/adhoc_session.cpp
+0
-37
src/xmpp/adhoc_session.hpp
src/xmpp/adhoc_session.hpp
+0
-70
src/xmpp/biboumi_component.cpp
src/xmpp/biboumi_component.cpp
+568
-0
src/xmpp/biboumi_component.hpp
src/xmpp/biboumi_component.hpp
+111
-0
src/xmpp/jid.cpp
src/xmpp/jid.cpp
+1
-1
src/xmpp/xmpp_component.hpp
src/xmpp/xmpp_component.hpp
+0
-303
No files found.
CMakeLists.txt
View file @
d600a284
...
...
@@ -15,35 +15,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILENAME__='\"$(subst ${CMAKE_SOURCE
#
## Look for external libraries
#
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
CMAKE_SOURCE_DIR
}
/cmake/Modules/"
)
include
(
FindEXPAT
)
find_package
(
EXPAT REQUIRED
)
find_package
(
ICONV REQUIRED
)
find_package
(
LIBUUID REQUIRED
)
if
(
WITH_LIBIDN
)
find_package
(
LIBIDN REQUIRED
)
elseif
(
NOT WITHOUT_LIBIDN
)
find_package
(
LIBIDN
)
endif
()
if
(
WITH_SYSTEMD
)
find_package
(
SYSTEMD REQUIRED
)
elseif
(
NOT WITHOUT_SYSTEMD
)
find_package
(
SYSTEMD
)
endif
()
if
(
WITH_BOTAN
)
find_package
(
BOTAN REQUIRED
)
elseif
(
NOT WITHOUT_BOTAN
)
find_package
(
BOTAN
)
endif
()
if
(
WITH_CARES
)
find_package
(
CARES REQUIRED
)
elseif
(
NOT WITHOUT_CARES
)
find_package
(
CARES
)
endif
()
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/Modules/"
)
#
## Get the software version
...
...
@@ -68,42 +40,12 @@ if(${PROJECT_NAME}_VERSION_SUFFIX MATCHES "^~dev$")
endif
()
endif
()
set
(
BIBOUMI
_VERSION
set
(
SOFTWARE
_VERSION
${${
PROJECT_NAME
}
_VERSION_MAJOR
}
.
${${
PROJECT_NAME
}
_VERSION_MINOR
}${${
PROJECT_NAME
}
_VERSION_SUFFIX
}
)
# To be able to include the config.h file generated by cmake
include_directories
(
"
${
CMAKE_CURRENT_BINARY_DIR
}
/src/"
)
include_directories
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/"
)
include_directories
(
${
EXPAT_INCLUDE_DIRS
}
)
include_directories
(
${
ICONV_INCLUDE_DIRS
}
)
include_directories
(
${
LIBUUID_INCLUDE_DIRS
}
)
if
(
LIBIDN_FOUND
)
include_directories
(
${
LIBIDN_INCLUDE_DIRS
}
)
endif
()
if
(
SYSTEMD_FOUND
)
include_directories
(
${
SYSTEMD_INCLUDE_DIRS
}
)
endif
()
if
(
BOTAN_FOUND
)
include_directories
(
SYSTEM
${
BOTAN_INCLUDE_DIRS
}
)
endif
()
if
(
CARES_FOUND
)
include_directories
(
${
CARES_INCLUDE_DIRS
}
)
endif
()
set
(
POLLER_DOCSTRING
"Choose the poller between POLL and EPOLL (Linux-only)"
)
if
(
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Linux"
)
set
(
POLLER
"EPOLL"
CACHE STRING
${
POLLER_DOCSTRING
}
)
else
()
set
(
POLLER
"POLL"
CACHE STRING
${
POLLER_DOCSTRING
}
)
endif
()
if
((
NOT
${
POLLER
}
MATCHES
"POLL"
)
AND
(
NOT
${
POLLER
}
MATCHES
"EPOLL"
))
message
(
FATAL_ERROR
"POLLER must be either POLL or EPOLL"
)
endif
()
#
## Documentation
...
...
@@ -121,43 +63,21 @@ if(RONN_EXECUTABLE)
add_custom_target
(
doc DEPENDS
${
MAN_PAGE
}
)
endif
()
#
## utils
#
file
(
GLOB source_utils
src/utils/*.[hc]pp
)
add_library
(
utils STATIC
${
source_utils
}
)
target_link_libraries
(
utils
${
ICONV_LIBRARIES
}
)
#
## config
#
file
(
GLOB source_config
src/config/*.[hc]pp
)
add_library
(
config STATIC
${
source_config
}
)
target_link_libraries
(
config utils
)
if
(
NOT IS_DIRECTORY
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/louloulibs"
)
message
(
FATAL_ERROR
"louloulibs/ directory not found. Make sure you fetched the submodules with 'git submodule init && git submodule update'"
)
endif
()
add_subdirectory
(
"louloulibs"
)
include_directories
(
"louloulibs"
)
#
## logger
#
file
(
GLOB source_logger
src/logger/*.[hc]pp
)
add_library
(
logger STATIC
${
source_logger
}
)
target_link_libraries
(
logger config
)
include_directories
(
${
EXPAT_INCLUDE_DIRS
}
)
include_directories
(
${
ICONV_INCLUDE_DIRS
}
)
include_directories
(
${
LIBUUID_INCLUDE_DIRS
}
)
#
## network
#
file
(
GLOB source_network
src/network/*.[hc]pp
)
add_library
(
network STATIC
${
source_network
}
)
target_link_libraries
(
network logger
)
if
(
BOTAN_FOUND
)
target_link_libraries
(
network
${
BOTAN_LIBRARIES
}
)
endif
()
if
(
CARES_FOUND
)
target_link_libraries
(
network
${
CARES_LIBRARIES
}
)
endif
()
# If they are found in louloulibs CMakeLists.txt, we inherite these values
include_directories
(
${
LIBIDN_INCLUDE_DIRS
}
)
include_directories
(
${
SYSTEMD_INCLUDE_DIRS
}
)
include_directories
(
SYSTEM
${
BOTAN_INCLUDE_DIRS
}
)
include_directories
(
${
CARES_INCLUDE_DIRS
}
)
#
## irclib
...
...
@@ -168,17 +88,12 @@ add_library(irc STATIC ${source_irc})
target_link_libraries
(
irc network utils logger
)
#
## xmpp
lib
## xmpp
#
file
(
GLOB source_xmpp
src/xmpp/*.[hc]pp
)
add_library
(
xmpp STATIC
${
source_xmpp
}
)
target_link_libraries
(
xmpp bridge network utils logger
${
EXPAT_LIBRARIES
}
${
LIBUUID_LIBRARIES
}
)
if
(
LIBIDN_FOUND
)
target_link_libraries
(
xmpp
${
LIBIDN_LIBRARIES
}
)
endif
()
target_link_libraries
(
xmpp xmpplib bridge network utils logger
)
#
## bridge
...
...
@@ -209,6 +124,7 @@ endif()
add_executable
(
test_suite EXCLUDE_FROM_ALL
src/test.cpp
)
target_link_libraries
(
test_suite
xmpplib
xmpp
irc
bridge
...
...
@@ -216,9 +132,6 @@ target_link_libraries(test_suite
config
logger
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/config.h.cmake
${
CMAKE_CURRENT_BINARY_DIR
}
/src/config.h
)
#
## Install target
#
...
...
cmake/Modules/FindBOTAN.cmake
deleted
100644 → 0
View file @
1028d4d5
# - Find botan
# Find the botan cryptographic library
#
# This module defines the following variables:
# BOTAN_FOUND - True if library and include directory are found
# If set to TRUE, the following are also defined:
# BOTAN_INCLUDE_DIRS - The directory where to find the header file
# BOTAN_LIBRARIES - Where to find the library file
#
# For conveniance, these variables are also set. They have the same values
# than the variables above. The user can thus choose his/her prefered way
# to write them.
# BOTAN_LIBRARY
# BOTAN_INCLUDE_DIR
#
# This file is in the public domain
find_path
(
BOTAN_INCLUDE_DIRS NAMES botan/botan.h
PATH_SUFFIXES botan-1.11
DOC
"The botan include directory"
)
find_library
(
BOTAN_LIBRARIES NAMES botan botan-1.11
DOC
"The botan library"
)
# Use some standard module to handle the QUIETLY and REQUIRED arguments, and
# set BOTAN_FOUND to TRUE if these two variables are set.
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
BOTAN REQUIRED_VARS BOTAN_LIBRARIES BOTAN_INCLUDE_DIRS
)
if
(
BOTAN_FOUND
)
set
(
BOTAN_LIBRARY
${
BOTAN_LIBRARIES
}
)
set
(
BOTAN_INCLUDE_DIR
${
BOTAN_INCLUDE_DIRS
}
)
endif
()
mark_as_advanced
(
BOTAN_INCLUDE_DIRS BOTAN_LIBRARIES
)
cmake/Modules/FindCARES.cmake
deleted
100644 → 0
View file @
1028d4d5
# - Find c-ares
# Find the c-ares library, and more particularly the stringprep header.
#
# This module defines the following variables:
# CARES_FOUND - True if library and include directory are found
# If set to TRUE, the following are also defined:
# CARES_INCLUDE_DIRS - The directory where to find the header file
# CARES_LIBRARIES - Where to find the library file
#
# For conveniance, these variables are also set. They have the same values
# than the variables above. The user can thus choose his/her prefered way
# to write them.
# CARES_INCLUDE_DIR
# CARES_LIBRARY
#
# This file is in the public domain
if
(
NOT CARES_FOUND
)
find_path
(
CARES_INCLUDE_DIRS NAMES ares.h
DOC
"The c-ares include directory"
)
find_library
(
CARES_LIBRARIES NAMES cares
DOC
"The c-ares library"
)
# Use some standard module to handle the QUIETLY and REQUIRED arguments, and
# set CARES_FOUND to TRUE if these two variables are set.
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
CARES REQUIRED_VARS CARES_LIBRARIES CARES_INCLUDE_DIRS
)
# Compatibility for all the ways of writing these variables
if
(
CARES_FOUND
)
set
(
CARES_INCLUDE_DIR
${
CARES_INCLUDE_DIRS
}
)
set
(
CARES_LIBRARY
${
CARES_LIBRARIES
}
)
endif
()
endif
()
mark_as_advanced
(
CARES_INCLUDE_DIRS CARES_LIBRARIES
)
cmake/Modules/FindICONV.cmake
deleted
100644 → 0
View file @
1028d4d5
# - Find iconv
# Find the iconv (character set conversion) library
#
# This module defines the following variables:
# ICONV_FOUND - True if library and include directory are found
# If set to TRUE, the following are also defined:
# ICONV_INCLUDE_DIRS - The directory where to find the header file
# ICONV_LIBRARIES - Where to find the library file
# ICONV_SECOND_ARGUMENT_IS_CONST - The second argument for iconv() is const
#
# For conveniance, these variables are also set. They have the same values
# than the variables above. The user can thus choose his/her prefered way
# to write them.
# ICONV_LIBRARY
# ICONV_INCLUDE_DIR
#
# This file is in the public domain
find_path
(
ICONV_INCLUDE_DIRS NAMES iconv.h
DOC
"The iconv include directory"
)
find_library
(
ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c
DOC
"The iconv library"
)
# Use some standard module to handle the QUIETLY and REQUIRED arguments, and
# set ICONV_FOUND to TRUE if these two variables are set.
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
Iconv REQUIRED_VARS ICONV_LIBRARIES ICONV_INCLUDE_DIRS
)
# Check if the prototype is
# size_t iconv(iconv_t cd, char** inbuf, size_t* inbytesleft,
# char** outbuf, size_t* outbytesleft);
# or
# size_t iconv (iconv_t cd, const char** inbuf, size_t* inbytesleft,
# char** outbuf, size_t* outbytesleft);
if
(
ICONV_FOUND
)
include
(
CheckCXXSourceCompiles
)
# Set the parameters needed to compile the following code.
set
(
CMAKE_REQUIRED_INCLUDES
${
ICONV_INCLUDE_DIRS
}
)
set
(
CMAKE_REQUIRED_LIBRARIES
${
ICONV_LIBRARIES
}
)
check_cxx_source_compiles
(
"
#include <iconv.h>
int main(){
iconv_t conv = 0;
const char* in = 0;
size_t ilen = 0;
char* out = 0;
size_t olen = 0;
iconv(conv, &in, &ilen, &out, &olen);
return 0;}"
ICONV_SECOND_ARGUMENT_IS_CONST
)
# Compatibility for all the ways of writing these variables
set
(
ICONV_LIBRARY
${
ICONV_LIBRARIES
}
)
set
(
ICONV_INCLUDE_DIR
${
ICONV_INCLUDE_DIRS
}
)
endif
()
mark_as_advanced
(
ICONV_INCLUDE_DIRS ICONV_LIBRARIES ICONV_SECOND_ARGUMENT_IS_CONST
)
\ No newline at end of file
cmake/Modules/FindLIBIDN.cmake
deleted
100644 → 0
View file @
1028d4d5
# - Find libidn
# Find the libidn library, and more particularly the stringprep header.
#
# This module defines the following variables:
# LIBIDN_FOUND - True if library and include directory are found
# If set to TRUE, the following are also defined:
# LIBIDN_INCLUDE_DIRS - The directory where to find the header file
# LIBIDN_LIBRARIES - Where to find the library file
#
# For conveniance, these variables are also set. They have the same values
# than the variables above. The user can thus choose his/her prefered way
# to write them.
# LIBIDN_INCLUDE_DIR
# LIBIDN_LIBRARY
#
# This file is in the public domain
include
(
FindPkgConfig
)
pkg_check_modules
(
LIBIDN libidn
)
if
(
NOT LIBIDN_FOUND
)
find_path
(
LIBIDN_INCLUDE_DIRS NAMES stringprep.h
DOC
"The libidn include directory"
)
# The library containing the stringprep module is libidn
find_library
(
LIBIDN_LIBRARIES NAMES idn
DOC
"The libidn library"
)
# Use some standard module to handle the QUIETLY and REQUIRED arguments, and
# set LIBIDN_FOUND to TRUE if these two variables are set.
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
LIBIDN REQUIRED_VARS LIBIDN_LIBRARIES LIBIDN_INCLUDE_DIRS
)
# Compatibility for all the ways of writing these variables
if
(
LIBIDN_FOUND
)
set
(
LIBIDN_INCLUDE_DIR
${
LIBIDN_INCLUDE_DIRS
}
)
set
(
LIBIDN_LIBRARY
${
LIBIDN_LIBRARIES
}
)
endif
()
endif
()
mark_as_advanced
(
LIBIDN_INCLUDE_DIRS LIBIDN_LIBRARIES
)
\ No newline at end of file
cmake/Modules/FindLIBUUID.cmake
deleted
100644 → 0
View file @
1028d4d5
# - Find libuuid
# Find the libuuid library
#
# This module defines the following variables:
# LIBUUID_FOUND - True if library and include directory are found
# If set to TRUE, the following are also defined:
# LIBUUID_INCLUDE_DIRS - The directory where to find the header file
# LIBUUID_LIBRARIES - Where to find the library file
#
# For conveniance, these variables are also set. They have the same values
# than the variables above. The user can thus choose his/her prefered way
# to write them.
# LIBUUID_INCLUDE_DIR
# LIBUUID_LIBRARY
#
# This file is in the public domain
include
(
FindPkgConfig
)
pkg_check_modules
(
LIBUUID uuid
)
if
(
NOT LIBUUID_FOUND
)
find_path
(
LIBUUID_INCLUDE_DIRS NAMES uuid.h
PATH_SUFFIXES uuid
DOC
"The libuuid include directory"
)
find_library
(
LIBUUID_LIBRARIES NAMES uuid
DOC
"The libuuid library"
)
# Use some standard module to handle the QUIETLY and REQUIRED arguments, and
# set LIBUUID_FOUND to TRUE if these two variables are set.
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
LIBUUID REQUIRED_VARS LIBUUID_LIBRARIES LIBUUID_INCLUDE_DIRS
)
# Compatibility for all the ways of writing these variables
if
(
LIBUUID_FOUND
)
set
(
LIBUUID_INCLUDE_DIR
${
LIBUUID_INCLUDE_DIRS
}
)
set
(
LIBUUID_LIBRARY
${
LIBUUID_LIBRARIES
}
)
endif
()
endif
()
mark_as_advanced
(
LIBUUID_INCLUDE_DIRS LIBUUID_LIBRARIES
)
cmake/Modules/FindSYSTEMD.cmake
deleted
100644 → 0
View file @
1028d4d5
# - Find SystemdDaemon
# Find the systemd daemon library
#
# This module defines the following variables:
# SYSTEMD_FOUND - True if library and include directory are found
# If set to TRUE, the following are also defined:
# SYSTEMD_INCLUDE_DIRS - The directory where to find the header file
# SYSTEMD_LIBRARIES - Where to find the library file
#
# For conveniance, these variables are also set. They have the same values
# than the variables above. The user can thus choose his/her prefered way
# to write them.
# SYSTEMD_LIBRARY
# SYSTEMD_INCLUDE_DIR
#
# This file is in the public domain
include
(
FindPkgConfig
)
pkg_check_modules
(
SYSTEMD libsystemd
)
if
(
NOT SYSTEMD_FOUND
)
find_path
(
SYSTEMD_INCLUDE_DIRS NAMES systemd/sd-daemon.h
DOC
"The Systemd include directory"
)
find_library
(
SYSTEMD_LIBRARIES NAMES systemd
DOC
"The Systemd library"
)
# Use some standard module to handle the QUIETLY and REQUIRED arguments, and
# set SYSTEMD_FOUND to TRUE if these two variables are set.
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
SYSTEMD REQUIRED_VARS SYSTEMD_LIBRARIES SYSTEMD_INCLUDE_DIRS
)
if
(
SYSTEMD_FOUND
)
set
(
SYSTEMD_LIBRARY
${
SYSTEMD_LIBRARIES
}
)
set
(
SYSTEMD_INCLUDE_DIR
${
SYSTEMD_INCLUDE_DIRS
}
)
endif
()
endif
()
mark_as_advanced
(
SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES
)
\ No newline at end of file
src/bridge/bridge.cpp
View file @
d600a284
#include <bridge/bridge.hpp>
#include <bridge/colors.hpp>
#include <bridge/list_element.hpp>
#include <xmpp/
xmpp
_component.hpp>
#include <xmpp/
biboumi
_component.hpp>
#include <xmpp/xmpp_stanza.hpp>
#include <irc/irc_message.hpp>
#include <network/poller.hpp>
...
...
@@ -20,7 +20,7 @@ using namespace std::string_literals;
static
const
char
*
action_prefix
=
"
\01
ACTION "
;
Bridge
::
Bridge
(
const
std
::
string
&
user_jid
,
Xmpp
Component
*
xmpp
,
std
::
shared_ptr
<
Poller
>
poller
)
:
Bridge
::
Bridge
(
const
std
::
string
&
user_jid
,
Biboumi
Component
*
xmpp
,
std
::
shared_ptr
<
Poller
>
poller
)
:
user_jid
(
user_jid
),
xmpp
(
xmpp
),
poller
(
poller
)
...
...
src/bridge/bridge.hpp
View file @
d600a284
...
...
@@ -12,7 +12,7 @@
#include <string>
#include <memory>
class
Xmpp
Component
;
class
Biboumi
Component
;
class
Poller
;
/**
...
...
@@ -32,7 +32,7 @@ using irc_responder_callback_t = std::function<bool(const std::string& irc_hostn
class
Bridge
{
public:
explicit
Bridge
(
const
std
::
string
&
user_jid
,
Xmpp
Component
*
xmpp
,
std
::
shared_ptr
<
Poller
>
poller
);
explicit
Bridge
(
const
std
::
string
&
user_jid
,
Biboumi
Component
*
xmpp
,
std
::
shared_ptr
<
Poller
>
poller
);
~
Bridge
();
/**
* QUIT all connected IRC servers.
...
...
@@ -211,7 +211,7 @@ private:
* but we still need to communicate with it, when sending messages from
* IRC to XMPP.
*/
Xmpp
Component
*
xmpp
;
Biboumi
Component
*
xmpp
;
/**
* Poller, to give it the IrcClients that we spawn, to make it manage
* their sockets.
...
...
src/config.h.cmake
deleted
100644 → 0
View file @
1028d4d5
#define SYSTEM_NAME "${CMAKE_SYSTEM}"
#cmakedefine ICONV_SECOND_ARGUMENT_IS_CONST
#cmakedefine LIBIDN_FOUND
#cmakedefine SYSTEMD_FOUND
#cmakedefine POLLER ${POLLER}
#cmakedefine BOTAN_FOUND
#cmakedefine CARES_FOUND
#cmakedefine BIBOUMI_VERSION "${BIBOUMI_VERSION}"
src/config/config.cpp
deleted
100644 → 0
View file @
1028d4d5
#include <config/config.hpp>
#include <iostream>
#include <sstream>
#include <stdlib.h>
std
::
string
Config
::
filename
=
"./biboumi.cfg"
;
bool
Config
::
file_must_exist
=
false
;
std
::
string
Config
::
get
(
const
std
::
string
&
option
,
const
std
::
string
&
def
)
{
Config
*
self
=
Config
::
instance
().
get
();
auto
it
=
self
->
values
.
find
(
option
);
if
(
it
==
self
->
values
.
end
())
return
def
;
return
it
->
second
;
}
int
Config
::
get_int
(
const
std
::
string
&
option
,
const
int
&
def
)
{
Config
*
self
=
Config
::
instance
().
get
();
std
::
string
res
=
self
->
get
(
option
,
""
);
if
(
!
res
.
empty
())
return
atoi
(
res
.
c_str
());
else
return
def
;
}
void
Config
::
set
(
const
std
::
string
&
option
,
const
std
::
string
&
value
,
bool
save
)
{
Config
*
self
=
Config
::
instance
().
get
();
self
->
values
[
option
]
=
value
;
if
(
save
)
{
self
->
save_to_file
();
self
->
trigger_configuration_change
();
}
}
void
Config
::
connect
(
t_config_changed_callback
callback
)
{
Config
*
self
=
Config
::
instance
().
get
();
self
->
callbacks
.
push_back
(
callback
);
}
void
Config
::
close
()
{
Config
*
self
=
Config
::
instance
().
get
();
self
->
values
.
clear
();
Config
::
instance
().
reset
();
}
/**
* Private methods
*/
void
Config
::
trigger_configuration_change
()
{
std
::
vector
<
t_config_changed_callback
>::
iterator
it
;
for
(
it
=
this
->
callbacks
.
begin
();
it
<
this
->
callbacks
.
end
();
++
it
)
(
*
it
)();
}
std
::
unique_ptr
<
Config
>&
Config
::
instance
()
{
static
std
::
unique_ptr
<
Config
>
instance
;
if
(
!
instance
)
{
instance
=
std
::
make_unique
<
Config
>
();
instance
->
read_conf
();
}
return
instance
;
}
bool
Config
::
read_conf
()
{
std
::
ifstream
file
;
file
.
open
(
filename
.
data
());
if
(
!
file
.
is_open
())
{
if
(
Config
::
file_must_exist
)
{
perror
((
"Error while opening file "
+
filename
+
" for reading."
).
c_str
());
file
.
exceptions
(
std
::
ifstream
::
failbit
);
}
return
false
;
}
std
::
string
line
;
size_t
pos
;
std
::
string
option
;
std
::
string
value
;
while
(
file
.
good
())
{
std
::
getline
(
file
,
line
);
if
(
line
==
""
||
line
[
0
]
==
'#'
)
continue
;
pos
=
line
.
find
(
'='
);
if
(
pos
==
std
::
string
::
npos
)
continue
;
option
=
line
.
substr
(
0
,
pos
);
value
=
line
.
substr
(
pos
+
1
);
this
->
values
[
option
]
=
value
;
}
return
true
;
}
void
Config
::
save_to_file
()
const
{
std
::
ofstream
file
(
this
->
filename
.
data
());
if
(
file
.
fail
())
{
std
::
cerr
<<
"Could not save config file."
<<
std
::
endl
;
return
;
}
for
(
auto
&
it
:
this
->
values
)
file
<<
it
.
first
<<
"="
<<
it
.
second
<<
std
::
endl
;
file
.
close
();
}
src/config/config.hpp
deleted
100644 → 0
View file @
1028d4d5
/**
* Read the config file and save all the values in a map.
* Also, a singleton.
*
* Use Config::filename = "bla" to set the filename you want to use.
*
* If you want to exit if the file does not exist when it is open for
* reading, set Config::file_must_exist = true.
*
* Config::get() can the be used to access the values in the conf.
*
* Use Config::close() when you're done getting/setting value. This will
* save the config into the file.
*/
#ifndef CONFIG_INCLUDED
# define CONFIG_INCLUDED
#include <functional>
#include <fstream>
#include <memory>
#include <vector>
#include <string>
#include <map>
typedef
std
::
function
<
void
()
>
t_config_changed_callback
;