Instead of having a multitude of setter API functions for configuration
options, provide generic ones for the different types we have.
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
It has been pointed out that the wording of the license of this library is
not entirely clear.
The term "dual licensing" usually refers to a licence choice of two
licenses "LICENSE1 _or_ LICENSE2.
Instead the license of this library claimed "LICENSE1 _and_ LICENSE2".
After an internal discussion with @metajack and @pasis it was made clear
that the initial idea was to dual license the library in the usual way.
This was also made clear by jack on the ML in the past [0].
As of jack, these licensing terms originated from jquery, which also used
the 'and' version in the past and has since been corrected [1].
This patch changes the license terms to 'MIT or GPLv3' and also adds SPDX
headers [2].
[0] https://groups.google.com/g/libstrophe/c/JkFgr601JQc
[1] https://stackoverflow.com/q/2758409
[2] https://spdx.org
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
The registered callback function will be called before connect() is
called on the socket, allowing tweaking of much more than just keepalive
settings.
This deprecates xmpp_conn_set_keepalive().
Includes helper/example callback function to set default keepalive
parameters that some library users may find useful.
Based on the differences to libmesode this functionality has been added.
It allows a library-user to set a callback for cases where the TLS stack
can't verify a received certificate and let the end-user decide what to
do.
examples/basic implements an example handler of said functionality.
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This adds a new API function xmpp_ctx_set_verbosity() to set increased
verbosity levels.
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Const variables in prototypes don't add much value, but make the code
larger and redundant. Remove these const keywords.
Note, this doesn't apply to pointers to const memory.
Introduced UNUSED macro with cast to void in commoh.h for internal
use. Used cast to void directly in those files which do not
include common.h. Although this change doesn't fix semantic issues
with unused function parameters, it does explicitly mark all those
places, which might require attention in future.
@sjaeckel integrated clang-format with formal coding style. Run his
script and commit changes.
There are pros and cons of this commit.
Mixed coding style is a "broken window". A good single style simplifies
reading and writing code.
On the other hand, this is a big change which will lead to conflicts.
Store keepalive parameters in conn object. This allows call the function
with a disconnected conn. Also, the parameters are not cleared on
reconnect and applied once a socket is created.
xmpp_conn_set_flags() and xmpp_conn_get_flags() unify interface of
connection configuration.
This interface allows compile-time check of supported features or even
run-time check. Therefore, applications can be built with older
libstrophe which doesn't support some optional flags.
Having debugging on by default in the example seems to help
people trying out the library, and with the default_logger()
call it's not too much extra complication.
We should also write an example/complex.c that exercises
all the callback options, a custom allocator and so on.