mirror of
https://github.com/D-Modem/bbs.git
synced 2026-11-28 17:38:04 -08:00
Chat rooms for callers on any node (C on the text menu, Chat on a 3270): /join, /me, /who, /rooms, /msg, the last lines of a room for who comes in, a flood limit. A line to one node, from who's online or /msg. Paging the sysop (S): sysops online and not /busy are told, the caller waits in a private room, /answer joins it; with no sysop on, page_command runs (no shell) and the caller may leave a message. On the text BBS, lines from other nodes show at whatever prompt the caller is at, above what they type; on a 3270, on the next screen's message line, and the chat screen refreshes on Enter or PF5. [finger] (RFC 1288): who is on and who a user is, no addresses, no forwarding. [gopher] (RFC 1436): about, who's online, and the message and file areas the sysop opens to it (none by default; bbs check warns), selectors naming records, not paths. Also: the TN3270 handoff set the caller's Via while who's online could read it (a data race the new test found); it is set under the lock now. Tested: the chat hub; two text callers chatting and paging; s3270 chatting with a text caller; finger with the finger program, gopher with curl. Wiki pages Chat-and-Paging and Finger-and-Gopher. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
65 lines
1.9 KiB
Go
65 lines
1.9 KiB
Go
package server
|
|
|
|
import (
|
|
"fmt"
|
|
"net"
|
|
"os"
|
|
"strconv"
|
|
|
|
"github.com/Neo-Desktop/bbs-sec/internal/config"
|
|
"github.com/Neo-Desktop/bbs-sec/internal/finger"
|
|
"github.com/Neo-Desktop/bbs-sec/internal/gopher"
|
|
)
|
|
|
|
// infoSections reads [finger] and [gopher].
|
|
func (c *Config) infoSections(cf *config.File) error {
|
|
var err error
|
|
if s := cf.Get("finger", ""); s != nil {
|
|
f := &finger.Settings{Address: s.String("address", ":79")}
|
|
if _, _, err := net.SplitHostPort(f.Address); err != nil {
|
|
return fmt.Errorf("[finger] address: %v", err)
|
|
}
|
|
if f.Online, err = s.Bool("online", true); err != nil {
|
|
return fmt.Errorf("[finger] %w", err)
|
|
}
|
|
if f.Users, err = s.Bool("users", true); err != nil {
|
|
return fmt.Errorf("[finger] %w", err)
|
|
}
|
|
if f.MaxClients, err = s.Int("max_clients", 16, 1, 1000); err != nil {
|
|
return fmt.Errorf("[finger] %w", err)
|
|
}
|
|
if f.MaxPerIP, err = s.Int("max_per_ip", 4, 0, 1000); err != nil {
|
|
return fmt.Errorf("[finger] %w", err)
|
|
}
|
|
c.Finger = f
|
|
}
|
|
if s := cf.Get("gopher", ""); s != nil {
|
|
g := &gopher.Settings{Address: s.String("address", ":70")}
|
|
_, port, err := net.SplitHostPort(g.Address)
|
|
if err != nil {
|
|
return fmt.Errorf("[gopher] address: %v", err)
|
|
}
|
|
host, _ := os.Hostname()
|
|
g.Host = s.String("hostname", host)
|
|
p, _ := strconv.Atoi(port)
|
|
if g.Port, err = s.Int("port", p, 1, 65535); err != nil {
|
|
return fmt.Errorf("[gopher] %w", err)
|
|
}
|
|
g.Areas = s.String("areas", "")
|
|
if g.Files, err = s.Bool("files", false); err != nil {
|
|
return fmt.Errorf("[gopher] %w", err)
|
|
}
|
|
if g.MaxClients, err = s.Int("max_clients", 32, 1, 1000); err != nil {
|
|
return fmt.Errorf("[gopher] %w", err)
|
|
}
|
|
if g.MaxPerIP, err = s.Int("max_per_ip", 8, 0, 1000); err != nil {
|
|
return fmt.Errorf("[gopher] %w", err)
|
|
}
|
|
if g.Areas != "" || g.Files {
|
|
c.Warnings = append(c.Warnings, "[gopher] shows message or file areas to anyone, without a login")
|
|
}
|
|
c.Gopher = g
|
|
}
|
|
return nil
|
|
}
|