Commit Graph

49 Commits

Author SHA1 Message Date
Dmitry Podgorny
cba21b5598 examples/register: replace getline() with fgets()
getline(3) doesn't exist on all systems.
2020-05-31 22:05:21 +03: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
8cfb2d2a03 XEP-0077: add examples/register
XEP-0077 will not be implemented as part of libstrophe's API, but an
example is provided. The example shows how to use the "raw" connection
to register a user.

Closes #54.
2020-01-25 22:59:19 +02:00
Dmitry Podgorny
b83347b464 examples: use xmpp_iq_new() 2017-07-06 15:47:19 +03:00
Dmitry Podgorny
15e7032f0d examples/bot: handle quit message 2017-07-05 19:40:25 +03:00
Dmitry Podgorny
0bdb5f1d5b examples/vcard: fix warn_unused_result related to fwrite() 2017-06-29 18:49:54 +03:00
Steffen Jaeckel
c074a6166c enable some warnings & fix 'em 2017-06-29 16:58:11 +02:00
Dmitry Podgorny
c149caa32a examples: add vcard example
New exmaple shows how to request vCard and handle result. See XEP-0054
for details.
PHOTO element is stored to an image file.
2017-06-23 22:09:28 +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
Dmitry Podgorny
2ef432f632 conn: xmpp_conn_set_keepalive() stores parameters in conn
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.
2016-04-26 19:48:34 +00:00
Dmitry Podgorny
9e4e274c4d updated examples/README.md 2016-04-14 15:23:38 +00:00
Tusharsb
e3b9fa1e53 tips for compiling example code
Me and a few more users (at
https://groups.google.com/forum/#!topic/strophe/sPw7-Vpszxs) were struggling
to compile example files. I think this readme file will help others as well.
2016-04-14 14:20:38 +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
Tristan Le Guern
3a56d68f47 Convert active.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
Dmitry Podgorny
182803926b conn: added new API xmpp_conn_set_flags()
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.
2015-10-15 16:01:13 +03:00
Dmitry Podgorny
b7fbc81740 conn: added API xmpp_conn_is_secured()
This patch is provided by @kjkao. New API is already used in
WorksSystems/wks_xep0047.
2015-10-13 00:10:02 +03:00
Dmitry Podgorny
36af7afa27 conn: implemented old-style SSL connection
Added new API xmpp_conn_set_old_style_ssl(). This function forces
using of old-style SSL connection.
2015-10-12 22:25:39 +03:00
Dmitry Podgorny
8627fbb13f Implemented UUID generation (RFC4122)
This patch adds new API:
  * xmpp_uuid_gen()
2015-10-12 15:17:22 +03:00
Dmitry Podgorny
0fed8a55e4 examples: updated header in component.c 2014-12-15 14:47:47 +02:00
Milan Kubik
c52ba85846 XEP-0114: Added an example for component connection.
The example is based on basic.c program.
To run the example, a configured server is needed.
2014-12-15 14:42:50 +02: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
Markus Kohlhase
95fd3ea3d0 added host parameter; replaced tabs with whitespace 2012-02-15 01:26:09 +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
Jack Moffitt
9c49b16554 Fix examples to use new API and lots of compiler warnings. 2008-07-02 23:17:27 +00:00
Jack Moffitt
927c229a42 Fix a typo in error case comparison. 2006-05-03 16:02:16 +00:00
Ralph Giles
7c7e844f43 Rename basic_logging.c to basic.c, replacing the old version.
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.
2005-06-29 18:07:20 +00:00
Ralph Giles
a6d7d9ef96 remove basic.c in preparation for replacing it with basic_logging.c. svn is stupid. 2005-06-29 17:54:29 +00:00
Ralph Giles
673a1308b1 Add a new xmpp_get_default_logger(level) call to provide access to
(a filtered version of) the default logger which we implemented in
the library but was no longer accessible. This makes it much easier
for the caller to turn logging on by just passing this default
log handler callback pointer into xmpp_ctx_new() instead of having
to always implement boilerplate.

Another option would have been xmpp_get_default_log_level(ctx, level)
to change the filter level of the build in logger, which is installed
if you pass NULL to xmpp_ctx_new(). In this method the logger would 
filter everything by default.
2005-06-29 17:51:18 +00:00
Ralph Giles
83b5721607 Move the log_level_name[] definitions back to private status within the library.
Defining static data in the header causes warnings on Apple gcc, and in general
this should be the client's responsibility. The names are obvious from the
log_level enum, which is public, and it's only one line of boilerplate to
copy in implementing a custom logging function.
2005-06-29 15:36:40 +00:00
Ralph Giles
64b85aadda Make the server argument optional. Passing a NULL domain arg to xmpp_connect_client()
now derives the domain from the jid.

Is it reasonable to just remove the 'domain' (more properly server) argument directly?
The library should always handle this and I can't think why you'd want to override unless
maybe if you have a proxy.
2005-06-29 15:23:51 +00:00
Jack Moffitt
c24df2b5f0 Added a basic_logging.c which shows how to use the logging stuff. Moved
xmpp_log_level_name into strophe.h for client access.
2005-06-28 21:23:57 +00:00
Ralph Giles
76e0c6a4b3 Add the 'libstrophe' name to the copyright headers. 2005-06-15 16:58:11 +00:00
Jack Moffitt
3cf080bb2d Add library init and shutdown. 2005-06-15 05:37:24 +00:00
Ralph Giles
72699eff45 Rename xmpp.h to strophe.h and apply the name changes to the internal
header multiple include protection.
2005-06-14 14:25:42 +00:00
Ralph Giles
f27235b862 Move the xmpp library to its new name. 2005-06-14 14:10:31 +00:00