diff options
-rw-r--r-- | examples/basic.c | 3 | ||||
-rw-r--r-- | examples/weechat.c | 3 | ||||
-rw-r--r-- | src/rexmpp.c | 6 | ||||
-rw-r--r-- | src/rexmpp.h | 4 |
4 files changed, 9 insertions, 7 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; diff --git a/src/rexmpp.c b/src/rexmpp.c index 3064f3f..dde85f1 100644 --- a/src/rexmpp.c +++ b/src/rexmpp.c @@ -359,7 +359,9 @@ int rexmpp_sasl_cb (Gsasl *ctx, Gsasl_session *sctx, Gsasl_property prop) { return s->sasl_property_cb(s, prop); } -rexmpp_err_t rexmpp_init (rexmpp_t *s, const char *jid) +rexmpp_err_t rexmpp_init (rexmpp_t *s, + const char *jid, + log_function_t log_func) { int err; xmlSAXHandler sax = { @@ -421,7 +423,7 @@ rexmpp_err_t rexmpp_init (rexmpp_t *s, const char *jid) s->stanza_queue_size = 1024; s->send_queue_size = 1024; s->iq_queue_size = 1024; - s->log_function = NULL; + s->log_function = log_func; s->sasl_property_cb = NULL; s->xml_in_cb = NULL; s->xml_out_cb = NULL; diff --git a/src/rexmpp.h b/src/rexmpp.h index 2f21fce..93740d8 100644 --- a/src/rexmpp.h +++ b/src/rexmpp.h @@ -357,7 +357,9 @@ struct rexmpp @param[in] jid Initial bare JID. @returns ::REXMPP_SUCCESS or some ::rexmpp_err error. */ -rexmpp_err_t rexmpp_init (rexmpp_t *s, const char *jid); +rexmpp_err_t rexmpp_init (rexmpp_t *s, + const char *jid, + log_function_t log_function); /** @brief ::rexmpp structure deinitialisation. This will free all the |