From acb37e7bee1cf5c9b8c75982ff27771975377ddc Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Sat, 12 Sep 2020 23:53:15 -0700
Subject: [PATCH] Automatically switch back from PETSCII to ANSI mode

If the user's terminal was auto-detected as being ANSI, yet they had their
account settings manually-overridden to use PETSCII, automatically switch
back to auto-terminal mode (e.g. with ANSI).
---
 src/sbbs3/logon.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/sbbs3/logon.cpp b/src/sbbs3/logon.cpp
index 8783f4455f..af92047f7b 100644
--- a/src/sbbs3/logon.cpp
+++ b/src/sbbs3/logon.cpp
@@ -180,6 +180,10 @@ bool sbbs_t::logon()
 	if(useron.misc&AUTOTERM) {
 		useron.misc&=~(ANSI|RIP|PETSCII);
 		useron.misc|=autoterm;
+	} else if((useron.misc&PETSCII) && (autoterm&ANSI)) {
+		// User manually-enabled PETSCII, but they're logging in with an ANSI (auto-detected) terminal
+		useron.misc &= ~PETSCII;
+		useron.misc |= (AUTOTERM | autoterm);
 	}
 
 	if(!chk_ar(cfg.shell[useron.shell]->ar,&useron,&client)) {
-- 
GitLab