Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

Commit

Permalink
Merge branch 'libstrophe-0.9.2' into libstrophe-0.9.2-merge
Browse files Browse the repository at this point in the history
Conflicts:
	Makefile.am
	configure.ac
	mesode.h
	rpm/README
	rpm/libstrophe.spec
	src/auth.c
	src/conn.c
	src/parser_libxml2.c
	src/resolver.c
	src/stanza.c
	src/thread.c
	src/thread.h
	src/tls.h
	src/tls_gnutls.c
	src/tls_openssl.c
	src/tls_schannel.c
  • Loading branch information
boothj5 committed Sep 18, 2018
2 parents b91872c + a4b05cf commit 4eb3642
Show file tree
Hide file tree
Showing 33 changed files with 1,358 additions and 682 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ examples/bot
examples/component
examples/roster
examples/uuid
examples/vcard
test_stamp
test-suite.log
tests/*.o
Expand Down
16 changes: 10 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ language: c
install:
- sudo apt-get update
- sudo apt-get -y install libtool pkg-config libexpat1-dev libxml2-dev libssl-dev check
script:
before_script:
- ./bootstrap.sh
- ./configure --without-libxml2 && make CFLAGS="-Wall -Werror" && make CFLAGS="-Wall -Werror" check-TESTS
- make clean
- ./configure --with-libxml2 && make CFLAGS="-Wall -Werror" && make CFLAGS="-Wall -Werror" check-TESTS
- make clean
- ./configure --disable-tls && make CFLAGS="-Wall -Werror" && make CFLAGS="-Wall -Werror" check-TESTS
script:
- ./configure ${CONFIGURE_OPT} && make && make check-TESTS
env:
- CONFIGURE_OPT="--without-libxml2"
- CONFIGURE_OPT="--with-libxml2"
- CONFIGURE_OPT="--disable-tls --without-libxml2"
- CONFIGURE_OPT="--disable-tls --with-libxml2"
matrix:
fast_finish: true
17 changes: 17 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
0.9.2
- OpenSSL tls module verifies certificate by default. Set flag
XMPP_CONN_FLAG_TRUST_TLS to ignore result of the verification
- Certificate hostname verification is forced for openssl-1.0.2 and
newer
- OpenSSL tls module disables insecure SSLv2 SSLv3 and TLSv1
- Support of handlers with the same callback function, but different
userdata
- System handlers are deleted on xmpp_conn_t reconnection. Old system
handlers could cause problems
- Default timeout for xmpp_run() is increased from 1 millisecond to 1
second in order to reduce CPU consumption
- Reduced memory usage in expat module
- New functions:
- xmpp_ctx_set_timeout()
- xmpp_sha1_digest()

0.9.1
- Fixed bug #95 (DNS lookup failing on Cygwin)
- Removed dependency on the check package
Expand Down
103 changes: 83 additions & 20 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SSL_LIBS = @openssl_LIBS@

RESOLV_LIBS = @RESOLV_LIBS@

MESODE_FLAGS = -I$(top_srcdir)
MESODE_FLAGS = -I$(top_srcdir) -Wall -Wextra -Wno-unused-parameter
MESODE_LIBS = libmesode.la

## Main build targets
Expand All @@ -21,14 +21,42 @@ libmesode_la_CFLAGS = $(SSL_CFLAGS) $(MESODE_FLAGS) $(PARSER_CFLAGS)
libmesode_la_LDFLAGS = $(SSL_LIBS) $(PARSER_LIBS) $(RESOLV_LIBS) -no-undefined
# Export only public API
libmesode_la_LDFLAGS += -export-symbols-regex '^xmpp_'
libmesode_la_SOURCES = src/auth.c src/conn.c src/crypto.c src/ctx.c \
src/event.c src/handler.c src/hash.c src/jid.c src/md5.c \
src/resolver.c src/sasl.c src/scram.c src/sha1.c \
src/snprintf.c src/sock.c src/stanza.c src/util.c \
src/rand.c src/uuid.c \
src/common.h src/hash.h src/md5.h src/ostypes.h src/parser.h \
src/resolver.h src/sasl.h src/scram.h src/sha1.h src/snprintf.h \
src/sock.h src/tls.h src/util.h src/rand.h

libmesode_la_SOURCES = \
src/auth.c \
src/conn.c \
src/crypto.c \
src/ctx.c \
src/event.c \
src/handler.c \
src/hash.c \
src/jid.c \
src/md5.c \
src/rand.c \
src/resolver.c \
src/sasl.c \
src/scram.c \
src/sha1.c \
src/snprintf.c \
src/sock.c \
src/stanza.c \
src/util.c \
src/uuid.c
libmesode_la_SOURCES += \
src/common.h \
src/hash.h \
src/md5.h \
src/ostypes.h \
src/parser.h \
src/rand.h \
src/resolver.h \
src/sasl.h \
src/scram.h \
src/sha1.h \
src/snprintf.h \
src/sock.h \
src/tls.h \
src/util.h

if DISABLE_TLS
libmesode_la_SOURCES += src/tls_dummy.c
Expand All @@ -42,19 +70,32 @@ include_HEADERS = mesode.h

pkgconfig_DATA = libmesode.pc

EXTRA_DIST = docs rpm Doxyfile LICENSE.txt GPL-LICENSE.txt MIT-LICENSE.txt \
src/tls_dummy.c src/tls_gnutls.c src/tls_schannel.c \
examples/README.md
EXTRA_DIST = \
Doxyfile \
GPL-LICENSE.txt \
LICENSE.txt \
MIT-LICENSE.txt \
bootstrap.sh \
build-android.sh \
docs/footer.html \
examples/README.md \
jni/Android.mk \
jni/Application.mk \
tests/res_query_dump.c

## Examples
noinst_PROGRAMS = examples/active examples/roster examples/basic examples/bot \
examples/component examples/uuid
noinst_PROGRAMS = \
examples/active \
examples/basic \
examples/bot \
examples/component \
examples/roster \
examples/uuid \
examples/vcard

examples_active_SOURCES = examples/active.c
examples_active_CFLAGS = $(MESODE_FLAGS)
examples_active_LDADD = $(MESODE_LIBS)
examples_roster_SOURCES = examples/roster.c
examples_roster_CFLAGS = $(MESODE_FLAGS)
examples_roster_LDADD = $(MESODE_LIBS)
examples_basic_SOURCES = examples/basic.c
examples_basic_CFLAGS = $(MESODE_FLAGS)
examples_basic_LDADD = $(MESODE_LIBS)
Expand All @@ -64,14 +105,31 @@ examples_bot_LDADD = $(MESODE_LIBS)
examples_component_SOURCES = examples/component.c
examples_component_CFLAGS = $(MESODE_FLAGS)
examples_component_LDADD = $(MESODE_LIBS)
examples_roster_SOURCES = examples/roster.c
examples_roster_CFLAGS = $(MESODE_FLAGS)
examples_roster_LDADD = $(MESODE_LIBS)
examples_uuid_SOURCES = examples/uuid.c
examples_uuid_CFLAGS = $(MESODE_FLAGS)
examples_uuid_LDADD = $(MESODE_LIBS)
examples_vcard_SOURCES = examples/vcard.c
examples_vcard_CFLAGS = $(MESODE_FLAGS)
examples_vcard_LDADD = $(MESODE_LIBS)

## Tests
TESTS = tests/check_parser tests/test_sha1 tests/test_md5 tests/test_rand \
tests/test_scram tests/test_ctx tests/test_base64 tests/test_jid \
tests/test_snprintf tests/test_string tests/test_resolver
TESTS = \
tests/check_parser \
tests/test_sha1 \
tests/test_md5 \
tests/test_rand \
tests/test_scram \
tests/test_ctx \
tests/test_base64 \
tests/test_hash \
tests/test_jid \
tests/test_snprintf \
tests/test_string \
tests/test_resolver

check_PROGRAMS = $(TESTS)

tests_check_parser_SOURCES = tests/check_parser.c tests/test.h
Expand All @@ -90,6 +148,11 @@ tests_test_base64_CFLAGS = $(MESODE_FLAGS) -I$(top_srcdir)/src
tests_test_base64_LDADD = $(MESODE_LIBS)
tests_test_base64_LDFLAGS = -static

tests_test_hash_SOURCES = tests/test_hash.c
tests_test_hash_CFLAGS = $(MESODE_FLAGS) -I$(top_srcdir)/src
tests_test_hash_LDADD = $(MESODE_LIBS)
tests_test_hash_LDFLAGS = -static

tests_test_jid_SOURCES = tests/test_jid.c
tests_test_jid_CFLAGS = $(MESODE_FLAGS) -I$(top_srcdir)/src
tests_test_jid_LDADD = $(MESODE_LIBS)
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([libmesode], [0.9.1], [[email protected]])
AC_INIT([libmesode], [0.9.2], [[email protected]])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign])
LT_INIT([dlopen])
Expand Down
5 changes: 1 addition & 4 deletions examples/active.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ void conn_handler(xmpp_conn_t * const conn, const xmpp_conn_event_t status,
fprintf(stderr, "DEBUG: connected\n");

/* create iq stanza for request */
iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, "iq");
xmpp_stanza_set_type(iq, "get");
xmpp_stanza_set_id(iq, "active1");
iq = xmpp_iq_new(ctx, "get", "active1");
xmpp_stanza_set_to(iq, "xxxxxxxxx.com");

query = xmpp_stanza_new(ctx);
Expand Down
27 changes: 20 additions & 7 deletions examples/bot.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,31 +73,44 @@ int version_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void
int message_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata)
{
xmpp_ctx_t *ctx = (xmpp_ctx_t*)userdata;
xmpp_stanza_t *reply;
xmpp_stanza_t *body, *reply;
const char *type;
char *intext, *replytext;
int quit = 0;

if (!xmpp_stanza_get_child_by_name(stanza, "body"))
body = xmpp_stanza_get_child_by_name(stanza, "body");
if (body == NULL)
return 1;
if (xmpp_stanza_get_type(stanza) != NULL && !strcmp(xmpp_stanza_get_type(stanza), "error"))
type = xmpp_stanza_get_type(stanza);
if (type != NULL && strcmp(type, "error") == 0)
return 1;

intext = xmpp_stanza_get_text(xmpp_stanza_get_child_by_name(stanza, "body"));
intext = xmpp_stanza_get_text(body);

printf("Incoming message from %s: %s\n", xmpp_stanza_get_from(stanza), intext);

reply = xmpp_stanza_reply(stanza);
if (xmpp_stanza_get_type(reply) == NULL)
xmpp_stanza_set_type(reply, "chat");

replytext = (char *) malloc(strlen(" to you too!") + strlen(intext) + 1);
strcpy(replytext, intext);
strcat(replytext, " to you too!");
if (strcmp(intext, "quit") == 0) {
replytext = strdup("bye!");
quit = 1;
} else {
replytext = (char *) malloc(strlen(" to you too!") + strlen(intext) + 1);
strcpy(replytext, intext);
strcat(replytext, " to you too!");
}
xmpp_free(ctx, intext);
xmpp_message_set_body(reply, replytext);

xmpp_send(conn, reply);
xmpp_stanza_release(reply);
free(replytext);

if (quit)
xmpp_disconnect(conn);

return 1;
}

Expand Down
5 changes: 1 addition & 4 deletions examples/roster.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ void conn_handler(xmpp_conn_t * const conn, const xmpp_conn_event_t status,
fprintf(stderr, "DEBUG: connected\n");

/* create iq stanza for request */
iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, "iq");
xmpp_stanza_set_type(iq, "get");
xmpp_stanza_set_id(iq, "roster1");
iq = xmpp_iq_new(ctx, "get", "roster1");

query = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(query, "query");
Expand Down
Loading

0 comments on commit 4eb3642

Please sign in to comment.