28 Commits

Author SHA1 Message Date
Steffen Jaeckel
3f03de031c Re-factor into separate compression module
Introduce a `conn_interface` to simplify the decision logic which API
we must call.

This also fixes some bugs of the previous commit.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2024-01-31 20:37:30 +01:00
Steffen Jaeckel
c7d410f38b First version of XEP-0138 support
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2024-01-30 14:23:26 +01:00
Steffen Jaeckel
f49ccb3262 Fix wording of licensing terms
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>
2023-08-25 18:08:42 +02:00
Stu Tomlinson
e90a6e9f71 Add getpass() for Windows 2022-06-23 09:44:00 +01:00
Steffen Jaeckel
91d6dac985 add Stream-Management support to bot example
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-04-06 13:51:05 +02:00
Steffen Jaeckel
d7bd434f41 add client-cert support to bot example
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2022-04-06 13:51:05 +02:00
Stu Tomlinson
06afe3d1c2 Add API to register callback to set socket options
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.
2022-03-17 22:59:07 +00:00
Dmitry Podgorny
db8a511f68 style: remove extra const keyword from interfaces
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.
2021-03-19 22:12:15 +02:00
Oleg Synelnykov
198bdd77d0 Remove -Wno-unused-parameter
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.
2020-03-31 17:37:12 +03:00
Dmitry Podgorny
562a06425b Unify coding style
@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.
2020-01-31 01:16:50 +02:00
Steffen Jaeckel
abd1b08a97 trim trailing spaces 2020-01-31 01:14:32 +02:00
Dmitry Podgorny
15e7032f0d examples/bot: handle quit message 2017-07-05 19:40:25 +03:00
Alexander Krotov
443b4d3116 Use more variables in bot.c message_handler()
to avoid calling the same function twice.
2017-06-20 01:38:53 +03:00
Dmitry Podgorny
b0a1842a53 examples/bot: fix memory leaks and use stanza helpers 2016-08-30 15:32:10 +03:00
Dmitry Podgorny
a3da77b8f6 stanza: return const char* for non allocated strings
If interface function returns char* the result must be freed with
xmpp_free().

In case of const char* the result must not be changed by user. Also, the
result is valid only during stanza lifetime.
2016-04-27 11:56:50 +00:00
Tusharsb
7bbfd00344 Making bot.c compatible to C++
By this small type casting change, I am able to compile bot.c with both ``gcc`` as well as with ``g++``

I am now able to use bot.c in my c++ programs
2015-12-02 14:53:52 +05:30
Dmitry Podgorny
a54def3e92 examples/bot: fixed memory leak 2015-10-23 00:40:13 +03:00
Tristan Le Guern
d460a5eb16 Convert bot.c to the new helpers 2015-10-20 16:26:43 +03:00
Dmitry Podgorny
64d65b3aed examples: mention about xmpp_conn_set_flags()
xmpp_conn_set_flags() provides features that people sometimes look for.
Adding comment to examples will simplify the search.
2015-10-20 14:36:43 +03:00
Dariusz Dwornikowski
71f75b2e2e Closes #31 2014-10-23 08:44:52 +02:00
Dmytro Podgornyi
9af64e244e examples/bot: removed non-standard strcpy_s/strcat_s
strncpy/strncat must be used instead. But in this case they don't make
sense, because string has enough space.
2014-08-08 18:27:02 +03:00
h0ru5
4111cf772a patch to avoid crash when messages without type are sent 2014-01-06 22:46:16 +01:00
Jack Moffitt
370a371800 Dual licensed libstrophe under MIT and GPLv3.
Updated copyright headers.
2009-06-15 15:26:10 -06:00
Dustin Sallings
2b661bd1f4 Handle a case where the query has no namespace.
When I tried this sample code, it failed due to a NULL namespace being
returned (and a later strdup(NULL)).
2009-04-14 13:11:33 -07:00
Jack Moffitt
1ac33269ac Removed unneeded variables from bot.c. 2009-04-14 13:47:20 -06:00
Matthew Wild
bc5265f6c9 Bot shouldn't reply to message type="error", and also fixed comment. 2008-09-18 03:36:19 +00:00
Jack Moffitt
3b47afaac9 Fix warnings and line endings from previous SRV commit. Get rid of domain parameter of xmpp_connect_client(). Remove usused handler.c helper left over from previous commit. 2008-07-03 05:20:59 +00:00
Jack Moffitt
a1a9328698 Added bot example given to us by Matthew Wild <mwild1@gmail.com>. 2008-07-03 02:48:32 +00:00