diff options
| author | swirl <roachh@protonmail.com> | 2021-07-05 17:44:00 -0400 |
|---|---|---|
| committer | swirl <roachh@protonmail.com> | 2021-08-17 14:09:48 -0400 |
| commit | 4d3f26154e2bcb9b975eb5236982cf8f19d9bed1 (patch) | |
| tree | 962489ba8ea05e898246b21cc1c54e8c17812e9e /src/command | |
| parent | 2cc354b6aef2f54b3f4dacc81f257c0625d5c734 (diff) | |
| download | profani-tty-4d3f26154e2bcb9b975eb5236982cf8f19d9bed1.tar.gz | |
hacky fix(?) for register
very bad and spaghetti will fix later
Diffstat (limited to 'src/command')
| -rw-r--r-- | src/command/cmd_funcs.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 07acd266..ed0a502f 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -9587,32 +9587,29 @@ cmd_register(ProfWin* window, const char* const command, gchar** args) return TRUE; } + char* username = args[0]; char* server = args[1]; - jabber_conn_status_t conn_status = cl_ev_connect_raw(server, port, tls_policy, auth_policy); + char* passwd = ui_ask_password(false); + char* confirm_passwd = ui_ask_password(true); - if (conn_status == JABBER_DISCONNECTED) { + 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); + } 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); log_info("Connection attempt to server %s port %d failed.", server, port); return TRUE; } - char* username = args[0]; - 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) { - 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(passwd); + free(confirm_passwd); //} options_destroy(options); |