From 8a6f1b52d76213d213c6e43f2b1d2fa40c3d09ea Mon Sep 17 00:00:00 2001 From: swirl Date: Sun, 18 Jul 2021 17:25:07 -0400 Subject: [PATCH] progress on fixing registration doesnt segfault on register, but aborts when you type after registering need to find a way to disconnect later --- src/command/cmd_funcs.c | 5 +---- src/xmpp/connection.c | 9 +++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index ed0a502f..b7c6afad 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -9595,12 +9595,10 @@ cmd_register(ProfWin* window, const char* const command, gchar** args) if (g_strcmp0(passwd, confirm_passwd) == 0) { log_info("Attempting to register account %s on server %s.", username, server); - connection_register((server), port, tls_policy, auth_policy, username, passwd); - //iq_register_new_account(username, passwd); + connection_register(server, port, tls_policy, auth_policy, username, passwd); } else { cons_show("The two passwords do not match."); } - //jabber_conn_status_t conn_status = cl_ev_connect_raw(server, port, tls_policy, auth_policy); if (connection_get_status() == JABBER_DISCONNECTED) { cons_show_error("Connection attempt to server %s port %d failed.", server, port); @@ -9610,7 +9608,6 @@ cmd_register(ProfWin* window, const char* const command, gchar** args) free(passwd); free(confirm_passwd); - //} options_destroy(options); diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 241070e0..da381898 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -380,7 +380,7 @@ static int iq_reg2_cb(xmpp_conn_t *xmpp_conn, xmpp_stanza_t *stanza, void *userd goto quit; quit: - connection_disconnect(); + //connection_disconnect(); return 0; } @@ -506,7 +506,6 @@ _register_handle_features(xmpp_conn_t *xmpp_conn, xmpp_stanza_t *stanza, void *u log_debug("Server supports in-band registration. Attempting registration."); - domain = strdup(conn.domain); iq = xmpp_iq_new(ctx, "get", "reg1"); xmpp_stanza_set_to(iq, domain); @@ -671,7 +670,8 @@ connection_register(const char* const altdomain, int port, int connect_status = xmpp_connect_raw( conn.xmpp_conn, - strdup(altdomain), + //strdup(altdomain), + altdomain, port, _connection_certfail_cb, _register_handler, @@ -679,7 +679,8 @@ connection_register(const char* const altdomain, int port, #else int connect_status = xmpp_connect_raw( conn.xmpp_conn, - strdup(altdomain), + //strdup(altdomain), + altdomain, port, _register_handler, reg);