From 2cc354b6aef2f54b3f4dacc81f257c0625d5c734 Mon Sep 17 00:00:00 2001 From: swirl Date: Sun, 4 Jul 2021 19:02:38 -0400 Subject: fixed some bugs, added some more - Added JABBER_RAW_CONNECT[ING/ED] connection states - Added cl_ev_connect_raw and session_connect_raw to conform to normal connection functions - Fixed SIGABRT during registration - Added a check in cmd_register to ensure it's actually connected before registering--but this will always fail atm --- src/command/cmd_funcs.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'src/command/cmd_funcs.c') diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 68eec91b..07acd266 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -9589,7 +9589,7 @@ cmd_register(ProfWin* window, const char* const command, gchar** args) char* server = args[1]; - jabber_conn_status_t conn_status = connection_connect_raw(server, port, tls_policy, auth_policy); + jabber_conn_status_t conn_status = cl_ev_connect_raw(server, port, tls_policy, auth_policy); if (conn_status == JABBER_DISCONNECTED) { cons_show_error("Connection attempt to server %s port %d failed.", server, port); @@ -9598,19 +9598,26 @@ cmd_register(ProfWin* window, const char* const command, gchar** args) } char* username = args[0]; - char* passwd = ui_ask_password(false); - char* confirm_passwd = ui_ask_password(true); + if (connection_get_status() != JABBER_RAW_CONNECTED) { // FIXME: this is ALWAYS the case, as the connection doesn't finish by this time. + cons_show_error("Raw connection attempt failed or not yet completed."); + log_info("Raw connection attempt failed or not yet completed."); + } //else { + char* passwd = ui_ask_password(false); + char* confirm_passwd = ui_ask_password(true); - if (g_strcmp0(passwd, confirm_passwd) == 0) { - iq_register_new_account(username, passwd); - } else { - cons_show("The two passwords do not match."); - } + if (g_strcmp0(passwd, confirm_passwd) == 0) { + log_info("Attempting to register account %s on server %s.", username, server); + iq_register_new_account(username, passwd); + } else { + cons_show("The two passwords do not match."); + } + free(passwd); + free(confirm_passwd); + //} - free(username); - free(passwd); - free(confirm_passwd); + options_destroy(options); + log_info("we are leaving the registration process"); return TRUE; } -- cgit 1.4.1-2-gfad0