|
@@ -53,6 +53,8 @@ const MOUSE_X10_OFF = "\x1b[?9l"
|
|
const MOUSE_DRAG = "\x1b[?1000h"
|
|
const MOUSE_DRAG = "\x1b[?1000h"
|
|
const MOUSE_DRAG_OFF = "\x1b[?1000l"
|
|
const MOUSE_DRAG_OFF = "\x1b[?1000l"
|
|
|
|
|
|
|
|
+// Move these into the door structure, instead of having globals.
|
|
|
|
+
|
|
var Unicode bool // Unicode support detected
|
|
var Unicode bool // Unicode support detected
|
|
var CP437 bool // CP437 support detected
|
|
var CP437 bool // CP437 support detected
|
|
var Full_CP437 bool // Full CP437 support detected (handles control codes properly)
|
|
var Full_CP437 bool // Full CP437 support detected (handles control codes properly)
|
|
@@ -88,7 +90,7 @@ g00r00 Line 7 : User's handle/alias
|
|
|
|
|
|
// Door32 information
|
|
// Door32 information
|
|
type DropfileConfig struct {
|
|
type DropfileConfig struct {
|
|
- Comm_type int // (not used)
|
|
|
|
|
|
+ Comm_type int // Comm type (0 local, 2 telnet "linux fd")
|
|
Comm_handle int // Handle to use to talk to the user
|
|
Comm_handle int // Handle to use to talk to the user
|
|
Baudrate int // (not used)
|
|
Baudrate int // (not used)
|
|
BBSID string // BBS Software name
|
|
BBSID string // BBS Software name
|
|
@@ -235,8 +237,15 @@ func (d *Door) ReadDropfile(filename string) {
|
|
log.Panicf("Door32 Node Number (expected integer): %s\n", err)
|
|
log.Panicf("Door32 Node Number (expected integer): %s\n", err)
|
|
}
|
|
}
|
|
|
|
|
|
- d.READFD = d.Config.Comm_handle
|
|
|
|
- d.WRITEFD = d.Config.Comm_handle
|
|
|
|
|
|
+ if d.Config.Comm_type == 0 {
|
|
|
|
+ d.READFD = 1
|
|
|
|
+ d.WRITEFD = 2
|
|
|
|
+ } else if d.Config.Comm_type == 2 {
|
|
|
|
+ d.READFD = d.Config.Comm_handle
|
|
|
|
+ d.WRITEFD = d.Config.Comm_handle
|
|
|
|
+ } else {
|
|
|
|
+ log.Panic("Unsupported Comm type %d\n", d.Config.Comm_type)
|
|
|
|
+ }
|
|
|
|
|
|
d.StartTime = time.Now()
|
|
d.StartTime = time.Now()
|
|
// Calculate when time expires.
|
|
// Calculate when time expires.
|
|
@@ -336,80 +345,6 @@ func (d *Door) Detect() bool {
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
|
|
|
|
-// Detect client terminal capabilities, Unicode, CP437, Full_CP437,
|
|
|
|
-// screen Height and Width.
|
|
|
|
-// Full_CP437 means the terminal understands control codes as CP437.
|
|
|
|
-/*
|
|
|
|
-func (d *Door) old_detect() {
|
|
|
|
- d.Write("\x1b[0;30;40m\x1b[2J\x1b[H") // black on black, clrscr, go home
|
|
|
|
- d.Write("\x03\x04\x1b[6n") // hearts and diamonds does CP437 work?
|
|
|
|
- d.Write(CRNL + "\u2615\x1b[6n") // hot beverage
|
|
|
|
- d.Write("\x1b[999C\x1b[999B\x1b[6n" + Reset + "\x1b[2J\x1b[H") // goto end of screen + cursor pos
|
|
|
|
- // Yuck!
|
|
|
|
- time.Sleep(250 * time.Millisecond)
|
|
|
|
-
|
|
|
|
- // read everything
|
|
|
|
- var results string
|
|
|
|
-
|
|
|
|
- for {
|
|
|
|
- var r int = d.getch()
|
|
|
|
- if r < 0 {
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
- results += string(byte(r))
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if len(results) > 0 {
|
|
|
|
- output := strings.Replace(results, "\x1b", "^[", -1)
|
|
|
|
- log.Println("DETECT:", output)
|
|
|
|
- } else {
|
|
|
|
- log.Println("DETECT: Nothing received.")
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (strings.Contains(results, "1;1R") ||
|
|
|
|
- strings.Contains(results, "1;3R")) &&
|
|
|
|
- (strings.Contains(results, "2:2R") ||
|
|
|
|
- strings.Contains(results, "2;3R")) {
|
|
|
|
- Unicode = true
|
|
|
|
- } else {
|
|
|
|
- Unicode = false
|
|
|
|
- CP437 = true
|
|
|
|
- }
|
|
|
|
- if strings.Contains(results, "1;3R") {
|
|
|
|
- Full_CP437 = true
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // get screen size
|
|
|
|
- var pos int = strings.LastIndex(results, "\x1b")
|
|
|
|
- if pos != -1 {
|
|
|
|
- pos++
|
|
|
|
- if results[pos] == '[' {
|
|
|
|
- pos++
|
|
|
|
- results = results[pos:]
|
|
|
|
- pos = strings.Index(results, ";")
|
|
|
|
- if pos != -1 {
|
|
|
|
- var height string = results[:pos]
|
|
|
|
- Height, _ = strconv.Atoi(height)
|
|
|
|
- pos++
|
|
|
|
- results = results[pos:]
|
|
|
|
-
|
|
|
|
- pos = strings.Index(results, "R")
|
|
|
|
- if pos != -1 {
|
|
|
|
- width := results[:pos]
|
|
|
|
-
|
|
|
|
- Width, _ = strconv.Atoi(width)
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- Height = 0
|
|
|
|
- Width = 0
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- log.Printf("Unicode %v Screen: %d X %d\n", Unicode, Width, Height)
|
|
|
|
-}
|
|
|
|
-*/
|
|
|
|
-
|
|
|
|
// Initialize door framework. Parse commandline, read dropfile,
|
|
// Initialize door framework. Parse commandline, read dropfile,
|
|
// detect terminal capabilities.
|
|
// detect terminal capabilities.
|
|
func (d *Door) Init(doorname string) {
|
|
func (d *Door) Init(doorname string) {
|