Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/active.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ int main(int argc, char **argv)
*/

/* setup authentication information */
xmpp_conn_set_jid(conn, argv[1]);
xmpp_conn_set_pass(conn, argv[2]);
xmpp_conn_set_string(conn, XMPP_SETTING_JID, argv[1]);
xmpp_conn_set_string(conn, XMPP_SETTING_PASS, argv[2]);

/* initiate connection */
xmpp_connect_client(conn, NULL, 0, conn_handler, ctx);
Expand Down
4 changes: 2 additions & 2 deletions examples/basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ int main(int argc, char **argv)

/* setup authentication information */
if (jid)
xmpp_conn_set_jid(conn, jid);
xmpp_conn_set_string(conn, XMPP_SETTING_JID, jid);
if (password)
xmpp_conn_set_pass(conn, password);
xmpp_conn_set_string(conn, XMPP_SETTING_PASS, password);

/* initiate connection */
if (xmpp_connect_client(conn, host, port, conn_handler, ctx) == XMPP_EOK) {
Expand Down
18 changes: 11 additions & 7 deletions examples/bot.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,20 +293,24 @@ int main(int argc, char **argv)
xmpp_conn_set_flags(conn, flags);

/* ask for a password if key is protected */
xmpp_conn_set_password_callback(conn, password_callback, NULL);
xmpp_conn_set_functionpointer(conn, XMPP_SETTING_PASSWORD_CALLBACK,
password_callback);
/* try at max 3 times in case the user enters the password wrong */
xmpp_conn_set_password_retries(conn, 3);
xmpp_conn_set_int(conn, XMPP_SETTING_PASSWORD_RETRIES, 3);
/* setup authentication information */
if (key)
xmpp_conn_set_client_cert(conn, cert, key);
if (key) {
xmpp_conn_set_string(conn, XMPP_SETTING_CLIENT_CERT, cert);
xmpp_conn_set_string(conn, XMPP_SETTING_CLIENT_KEY, key);
}
if (jid)
xmpp_conn_set_jid(conn, jid);
xmpp_conn_set_string(conn, XMPP_SETTING_JID, jid);
if (password)
xmpp_conn_set_pass(conn, password);
xmpp_conn_set_string(conn, XMPP_SETTING_PASS, password);

/* enable TCP keepalive, using canned callback function */
if (tcp_keepalive)
xmpp_conn_set_sockopt_callback(conn, xmpp_sockopt_cb_keepalive);
xmpp_conn_set_functionpointer(conn, XMPP_SETTING_SOCKOPT_CALLBACK,
xmpp_sockopt_cb_keepalive);

/* set Stream-Mangement state if available */
if (sm_state) {
Expand Down
22 changes: 13 additions & 9 deletions examples/complex.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,27 +331,31 @@ int main(int argc, char **argv)
xmpp_conn_set_flags(conn, flags);
/* configure TCP keepalive (optional) */
if (tcp_keepalive)
xmpp_conn_set_sockopt_callback(conn, sockopt_cb);
xmpp_conn_set_functionpointer(conn, XMPP_SETTING_SOCKOPT_CALLBACK,
sockopt_cb);

/* ask for a password if key is protected */
xmpp_conn_set_password_callback(conn, password_callback, NULL);
xmpp_conn_set_functionpointer(conn, XMPP_SETTING_PASSWORD_CALLBACK,
password_callback);
/* try at max 3 times in case the user enters the password wrong */
xmpp_conn_set_password_retries(conn, 3);
xmpp_conn_set_int(conn, XMPP_SETTING_PASSWORD_RETRIES, 3);
/* setup authentication information */
if (key) {
xmpp_conn_set_client_cert(conn, cert, key);
xmpp_conn_set_string(conn, XMPP_SETTING_CLIENT_CERT, cert);
xmpp_conn_set_string(conn, XMPP_SETTING_CLIENT_KEY, key);
}
if (jid)
xmpp_conn_set_jid(conn, jid);
xmpp_conn_set_string(conn, XMPP_SETTING_JID, jid);
if (password)
xmpp_conn_set_pass(conn, password);
xmpp_conn_set_string(conn, XMPP_SETTING_PASS, password);

if (certfail)
xmpp_conn_set_certfail_handler(conn, certfail_handler);
xmpp_conn_set_functionpointer(conn, XMPP_SETTING_CERTFAIL_HANDLER,
certfail_handler);
if (capath)
xmpp_conn_set_capath(conn, capath);
xmpp_conn_set_string(conn, XMPP_SETTING_CAPATH, capath);
if (cafile)
xmpp_conn_set_cafile(conn, cafile);
xmpp_conn_set_string(conn, XMPP_SETTING_CAFILE, cafile);

/* initiate connection */
if (xmpp_connect_client(conn, host, port, conn_handler, ctx) == XMPP_EOK) {
Expand Down
4 changes: 2 additions & 2 deletions examples/component.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ int main(int argc, char **argv)
conn = xmpp_conn_new(ctx);

/* setup authentication information */
xmpp_conn_set_jid(conn, jid);
xmpp_conn_set_pass(conn, pass);
xmpp_conn_set_string(conn, XMPP_SETTING_JID, jid);
xmpp_conn_set_string(conn, XMPP_SETTING_PASS, pass);

/* initiate connection */
xmpp_connect_component(conn, host, port, conn_handler, ctx);
Expand Down
2 changes: 1 addition & 1 deletion examples/register.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ int main(int argc, char **argv)

/* jid can be a jid or domain for "raw" connection */
domain = xmpp_jid_domain(ctx, jid);
xmpp_conn_set_jid(conn, domain);
xmpp_conn_set_string(conn, XMPP_SETTING_JID, domain);
xmpp_free(ctx, domain);

/* private data */
Expand Down
4 changes: 2 additions & 2 deletions examples/roster.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ int main(int argc, char **argv)
*/

/* setup authentication information */
xmpp_conn_set_jid(conn, argv[1]);
xmpp_conn_set_pass(conn, argv[2]);
xmpp_conn_set_string(conn, XMPP_SETTING_JID, argv[1]);
xmpp_conn_set_string(conn, XMPP_SETTING_PASS, argv[2]);

/* initiate connection */
xmpp_connect_client(conn, NULL, 0, conn_handler, ctx);
Expand Down
4 changes: 2 additions & 2 deletions examples/vcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ int main(int argc, char **argv)
log = xmpp_get_default_logger(XMPP_LEVEL_INFO);
ctx = xmpp_ctx_new(NULL, log);
conn = xmpp_conn_new(ctx);
xmpp_conn_set_jid(conn, jid);
xmpp_conn_set_pass(conn, pass);
xmpp_conn_set_string(conn, XMPP_SETTING_JID, jid);
xmpp_conn_set_string(conn, XMPP_SETTING_PASS, pass);
vcard.ctx = ctx;
xmpp_connect_client(conn, NULL, 0, conn_handler, &vcard);
xmpp_run(ctx);
Expand Down
3 changes: 2 additions & 1 deletion src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ struct _xmpp_conn_t {

struct {
struct xmpp_compression *state;
int allowed, supported, dont_reset;
int allowed, dont_reset, level;
int supported;
} compression;

char *lang;
Expand Down
2 changes: 1 addition & 1 deletion src/compression.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ int compression_init(xmpp_conn_t *conn)

comp->compression.stream.next_out = comp->compression.buffer;
comp->compression.stream.avail_out = STROPHE_COMPRESSION_BUFFER_SIZE;
int ret = deflateInit(&comp->compression.stream, Z_DEFAULT_COMPRESSION);
int ret = deflateInit(&comp->compression.stream, conn->compression.level);
if (ret != Z_OK) {
strophe_free_and_null(conn->ctx, comp->compression.buffer);
conn->error = ret;
Expand Down
Loading
Loading