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
9d8166f1
Commit
9d8166f1
authored
Apr 15, 2014
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for systemd-daemon
parent
58a2c00d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
0 deletions
+62
-0
CMakeLists.txt
CMakeLists.txt
+10
-0
cmake/Modules/FindSystemdDaemon.cmake
cmake/Modules/FindSystemdDaemon.cmake
+34
-0
src/config.h.cmake
src/config.h.cmake
+1
-0
src/xmpp/xmpp_component.cpp
src/xmpp/xmpp_component.cpp
+17
-0
No files found.
CMakeLists.txt
View file @
9d8166f1
...
...
@@ -19,6 +19,7 @@ find_package(Iconv REQUIRED)
include
(
FindEXPAT
)
find_package
(
EXPAT REQUIRED
)
find_package
(
Libidn
)
find_package
(
SystemdDaemon
)
# To be able to include the config.h file generated by cmake
include_directories
(
"src/"
)
...
...
@@ -31,6 +32,12 @@ else()
message
(
"Building without stringprep support."
)
endif
()
if
(
SYSTEMDDAEMON_FOUND
)
include_directories
(
${
SYSTEMDDAEMON_INCLUDE_DIRS
}
)
else
()
message
(
"Building without systemd daemon support."
)
endif
()
set
(
POLLER
"POLL"
CACHE STRING
"Choose the poller between POLL and EPOLL (Linux-only)"
)
if
((
NOT
${
POLLER
}
MATCHES
"POLL"
)
AND
...
...
@@ -124,6 +131,9 @@ target_link_libraries(${PROJECT_NAME}
bridge
utils
config
)
if
(
SYSTEMDDAEMON_FOUND
)
target_link_libraries
(
xmpp
${
SYSTEMDDAEMON_LIBRARIES
}
)
endif
()
if
(
WITH_DOC
)
add_dependencies
(
${
PROJECT_NAME
}
doc
)
endif
()
...
...
cmake/Modules/FindSystemdDaemon.cmake
0 → 100644
View file @
9d8166f1
# - Find SystemdDaemon
# Find the systemd daemon library
#
# This module defines the following variables:
# SYSTEMDDAEMON_FOUND - True if library and include directory are found
# If set to TRUE, the following are also defined:
# SYSTEMDDAEMON_INCLUDE_DIRS - The directory where to find the header file
# SYSTEMDDAEMON_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.
# SYSTEMDDAEMON_LIBRARY
# SYSTEMDDAEMON_INCLUDE_DIR
#
# This file is in the public domain
find_path
(
SYSTEMDDAEMON_INCLUDE_DIRS NAMES systemd/sd-daemon.h
DOC
"The Systemd Daemon include directory"
)
find_library
(
SYSTEMDDAEMON_LIBRARIES NAMES systemd-daemon
DOC
"The Systemd Daemon library"
)
# Use some standard module to handle the QUIETLY and REQUIRED arguments, and
# set SYSTEMDDAEMON_FOUND to TRUE if these two variables are set.
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
SystemdDaemon REQUIRED_VARS SYSTEMDDAEMON_LIBRARIES SYSTEMDDAEMON_INCLUDE_DIRS
)
if
(
SYSTEMDDAEMON_FOUND
)
set
(
SYSTEMDDAEMON_LIBRARY
${
SYSTEMDDAEMON_LIBRARIES
}
)
set
(
SYSTEMDDAEMON_INCLUDE_DIR
${
SYSTEMDDAEMON_INCLUDE_DIRS
}
)
endif
()
mark_as_advanced
(
SYSTEMDDAEMON_INCLUDE_DIRS SYSTEMDDAEMON_LIBRARIES
)
\ No newline at end of file
src/config.h.cmake
View file @
9d8166f1
#cmakedefine ICONV_SECOND_ARGUMENT_IS_CONST
#cmakedefine LIBIDN_FOUND
#cmakedefine SYSTEMDDAEMON_FOUND
#cmakedefine POLLER ${POLLER}
src/xmpp/xmpp_component.cpp
View file @
9d8166f1
...
...
@@ -12,6 +12,12 @@
#include <stdio.h>
#include <config.h>
#ifdef SYSTEMDDAEMON_FOUND
# include <systemd/sd-daemon.h>
#endif
#define STREAM_NS "http://etherx.jabber.org/streams"
#define COMPONENT_NS "jabber:component:accept"
#define MUC_NS "http://jabber.org/protocol/muc"
...
...
@@ -74,6 +80,9 @@ void XmppComponent::send_stanza(const Stanza& stanza)
void
XmppComponent
::
on_connection_failed
(
const
std
::
string
&
reason
)
{
log_error
(
"Failed to connect to the XMPP server: "
<<
reason
);
#ifdef SYSTEMDDAEMON_FOUND
sd_notifyf
(
0
,
"STATUS=Failed to connect to the XMPP server: %s"
,
reason
.
data
());
#endif
}
void
XmppComponent
::
on_connected
()
...
...
@@ -248,6 +257,9 @@ void XmppComponent::handle_handshake(const Stanza& stanza)
this
->
ever_auth
=
true
;
this
->
last_auth
=
true
;
log_info
(
"Authenticated with the XMPP server"
);
#ifdef SYSTEMDDAEMON_FOUND
sd_notify
(
0
,
"READY=1"
);
#endif
}
void
XmppComponent
::
handle_presence
(
const
Stanza
&
stanza
)
...
...
@@ -420,6 +432,11 @@ void XmppComponent::handle_error(const Stanza& stanza)
if
(
text
)
error_message
=
text
->
get_inner
();
log_error
(
"Stream error received from the XMPP server: "
<<
error_message
);
#ifdef SYSTEMDDAEMON_FOUND
if
(
!
this
->
ever_auth
)
sd_notifyf
(
0
,
"STATUS=Failed to authenticate to the XMPP server: %s"
,
error_message
.
data
());
#endif
}
Bridge
*
XmppComponent
::
get_user_bridge
(
const
std
::
string
&
user_jid
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment