AmendHub

Download:

jcs

/

subtext

/

amendments

/

478

session: When a sysop logs in, if someone paged, ask to answer


jcs made amendment 478 about 1 year ago
--- session.c Mon Apr 10 21:17:10 2023 +++ session.c Mon Apr 10 22:18:54 2023 @@ -115,11 +115,12 @@ void session_run(struct uthread *uthread, void *arg) { struct session *s = (struct session *)arg; + struct session *waiting; char date[9]; struct tm *date_tm; unsigned short c, last_c = 0; bool done = false; - short auth, i, action; + short auth, i, action, sc; /* until we negotiate otherwise */ s->terminal_columns = DEFAULT_TERMINAL_COLUMNS; @@ -201,6 +202,23 @@ session_run(struct uthread *uthread, void *arg) session_today_tally.calls, ordinal(session_today_tally.calls)); session_flush(s); uthread_yield(); + + if (s->user && s->user->is_sysop && + (waiting = session_first_waiting_for_sysop())) { + session_printf(s, "\r\n{{B}}%s{{/B}} paged sysop, answer? [Y/n] ", + waiting->user ? waiting->user->username : "guest"); + session_flush(s); + + sc = session_input_char(s); + if (sc == 'N' || sc == 'n') { + session_printf(s, "%c\r\n", sc == 'N' ? 'N' : 'n'); + session_flush(s); + } else { + session_output(s, "\r\n", 2); + session_flush(s); + session_answer_page(s); + } + } session_print_motd(s, false);