AmendHub

Download:

jcs

/

subtext

/

amendments

/

243

session: Don't set default terminal type, if node doesn't, prompt user

This way modem users and telnet users with weird clients that don't
negotiate TTYPE will get prompted for vt100 compatibility.

jcs made amendment 243 over 2 years ago
--- console.c Sun Jul 31 21:52:00 2022 +++ console.c Sat Aug 13 14:17:38 2022 @@ -314,6 +314,8 @@ console_setup(struct session *session) struct console *console = (struct console *)session->cookie; session->terminal_columns = console->ncolumns; session->terminal_lines = console->nlines; + snprintf(session->terminal_type, sizeof(session->terminal_type), + "vt100"); } short --- session.c Mon Aug 1 22:27:59 2022 +++ session.c Sat Aug 13 14:15:58 2022 @@ -125,7 +125,6 @@ session_run(struct uthread *uthread, void *arg) /* until we negotiate otherwise */ s->terminal_columns = DEFAULT_TERMINAL_COLUMNS; s->terminal_lines = DEFAULT_TERMINAL_LINES; - snprintf(s->terminal_type, sizeof(s->terminal_type), "vt100"); if (s->node_funcs->setup) { s->node_funcs->setup(s); @@ -181,6 +180,14 @@ session_run(struct uthread *uthread, void *arg) session_today_tally.calls++; bile_write(db->sessions_bile, SL_TALLY_RTYPE, 1, (char *)&session_today_tally, sizeof(session_today_tally)); + + if (s->terminal_type[0] == '\0') { + /* per-node setup didn't fill this in, ask the user */ + session_output(s, "\r\n", 2); + user_settings_renegotiate(s); + session_output(s, "\r\n", 2); + session_flush(s); + } session_printf(s, "\r\n" "Welcome, {{B}}%s{{/B}}, you are the %ld%s caller today.\r\n", --- user_settings.c Wed Jul 20 09:42:39 2022 +++ user_settings.c Sat Aug 13 14:08:07 2022 @@ -26,7 +26,6 @@ #include "user_settings.h" #include "util.h" -void user_settings_renegotiate(struct session *s); void user_settings_password(struct session *s); void user_settings_username(struct session *s); --- user_settings.h Fri Apr 22 12:28:20 2022 +++ user_settings.h Sat Aug 13 14:08:18 2022 @@ -21,5 +21,6 @@ #include "user.h" void user_settings_menu(struct session *s); +void user_settings_renegotiate(struct session *s); #endif