Skip to content
Snippets Groups Projects
Commit c3eec746 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Use shared code for sending login information.

The option from the menu (ALT-Z/CTRL-S) was copy/pasted years ago
and never updated while the keyboard shortcut (ALT-L) was updated
quite a bit.

This extracts the ALT-L code into a function and calls it from the
menu.
parent fd0b6150
No related branches found
No related tags found
No related merge requests found
Pipeline #5915 passed
......@@ -221,16 +221,7 @@ syncmenu(struct bbslist *bbs, int *speed)
break;
case 2: /* Login */
ret = 1;
conn_send(bbs->user, strlen(bbs->user), 0);
conn_send("\r", 1, 0);
SLEEP(10);
conn_send(bbs->password, strlen(bbs->password), 0);
conn_send("\r", 1, 0);
if (bbs->syspass[0]) {
SLEEP(10);
conn_send(bbs->syspass, strlen(bbs->syspass), 0);
conn_send("\r", 1, 0);
}
send_login(bbs);
break;
case 5: /* Output rate */
if ((bbs->conn_type == CONN_TYPE_MODEM) || (bbs->conn_type == CONN_TYPE_SERIAL)
......
......@@ -3649,6 +3649,38 @@ do_paste(void)
}
}
void
send_login(struct bbslist *bbs) {
if ((bbs->conn_type != CONN_TYPE_RLOGIN)
&& (bbs->conn_type != CONN_TYPE_RLOGIN_REVERSED)
&& (bbs->conn_type != CONN_TYPE_SSH)) {
if (bbs->conn_type != CONN_TYPE_SSHNA) {
if (bbs->user[0]) {
conn_send(bbs->user, strlen(bbs->user), 0);
conn_send(
cterm->emulation == CTERM_EMULATION_ATASCII ? "\x9b" : "\r",
1,
0);
SLEEP(10);
}
}
if (bbs->password[0]) {
conn_send(bbs->password, strlen(bbs->password), 0);
conn_send(
cterm->emulation == CTERM_EMULATION_ATASCII ? "\x9b" : "\r",
1,
0);
SLEEP(10);
}
}
if (bbs->syspass[0]) {
conn_send(bbs->syspass, strlen(bbs->syspass), 0);
conn_send(cterm->emulation == CTERM_EMULATION_ATASCII ? "\x9b" : "\r",
1,
0);
}
}
bool
doterm(struct bbslist *bbs)
{
......@@ -4069,34 +4101,7 @@ doterm(struct bbslist *bbs)
key = 0;
break;
case 0x2600: /* ALT-L */
if ((bbs->conn_type != CONN_TYPE_RLOGIN)
&& (bbs->conn_type != CONN_TYPE_RLOGIN_REVERSED)
&& (bbs->conn_type != CONN_TYPE_SSH)) {
if (bbs->conn_type != CONN_TYPE_SSHNA) {
if (bbs->user[0]) {
conn_send(bbs->user, strlen(bbs->user), 0);
conn_send(
cterm->emulation == CTERM_EMULATION_ATASCII ? "\x9b" : "\r",
1,
0);
SLEEP(10);
}
}
if (bbs->password[0]) {
conn_send(bbs->password, strlen(bbs->password), 0);
conn_send(
cterm->emulation == CTERM_EMULATION_ATASCII ? "\x9b" : "\r",
1,
0);
SLEEP(10);
}
}
if (bbs->syspass[0]) {
conn_send(bbs->syspass, strlen(bbs->syspass), 0);
conn_send(cterm->emulation == CTERM_EMULATION_ATASCII ? "\x9b" : "\r",
1,
0);
}
send_login(bbs);
key = 0;
break;
case 0x3200: /* ALT-M */
......
......@@ -32,5 +32,6 @@ void mousedrag(struct vmem_cell *scrollback);
void get_cterm_size(int *cols, int *rows, int ns);
int get_cache_fn_base(struct bbslist *bbs, char *fn, size_t fnsz);
int get_cache_fn_subdir(struct bbslist *bbs, char *fn, size_t fnsz, const char *subdir);
void send_login(struct bbslist *bbs);
#endif // ifndef _TERM_H_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment