summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2021-02-12 20:11:20 +0300
committerdefanor <defanor@uberspace.net>2021-02-12 20:11:20 +0300
commitd0d568f9bc39f9e35b6d39ecf21b5e425ea91c85 (patch)
tree1cb5e728bb80005707244038f2eacbdce01dbbf6 /examples
parent3b5806a16e4fd0a6f292050508790fc0c3f6b36f (diff)
Set log_function on initialisation
rexmpp_init may write logs itself, so a logging function should be set for that.
Diffstat (limited to 'examples')
-rw-r--r--examples/basic.c3
-rw-r--r--examples/weechat.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/examples/basic.c b/examples/basic.c
index 404b281..dbfdfa8 100644
--- a/examples/basic.c
+++ b/examples/basic.c
@@ -77,7 +77,7 @@ main (int argc, char **argv) {
structure and an initial jid. */
rexmpp_t s;
rexmpp_err_t err;
- err = rexmpp_init(&s, argv[1]);
+ err = rexmpp_init(&s, argv[1], my_logger);
if (err != REXMPP_SUCCESS) {
puts("Failed to initialise rexmpp.");
return -1;
@@ -85,7 +85,6 @@ main (int argc, char **argv) {
/* Set the primary callback functions: for logging, SASL, XML in and
out. */
- s.log_function = my_logger;
s.sasl_property_cb = my_sasl_property_cb;
s.xml_in_cb = my_xml_in_cb;
s.xml_out_cb = my_xml_out_cb;
diff --git a/examples/weechat.c b/examples/weechat.c
index 1fa4e57..cd89adb 100644
--- a/examples/weechat.c
+++ b/examples/weechat.c
@@ -531,8 +531,7 @@ command_xmpp_cb (const void *pointer, void *data,
wr->password = strdup(argv[2]);
wr->hooks = weechat_arraylist_new(42, 0, 0, NULL, NULL, hook_free_cb, NULL);
rexmpp_t *s = &wr->rexmpp_state;
- rexmpp_init(s, argv[1]);
- s->log_function = my_logger;
+ rexmpp_init(s, argv[1], my_logger);
s->sasl_property_cb = my_sasl_property_cb;
s->xml_in_cb = my_xml_in_cb;
s->xml_out_cb = my_xml_out_cb;