Files
bbs/internal/server/oscarconfig_test.go
Claude ababf5c57d AIM and ICQ: an OSCAR server on the BBS's chat, beside IRC
[oscar] serves AIM and ICQ clients on port 5190, as a front end on the
same chat core as the IRC server: buddies are BBS users online by any
route, an IM is a private message (a PRIVMSG to an IRC user), and a chat
room is a BBS room, an IRC channel.

- FLAP, SNACs and TLVs; logins by the signon frame (roasted passwords:
  AIM 1-3, ICQ, Java AIM) and by BUCP (MD5, weak and strong digests); the
  BOS and the services' connections by cookie, all on the one port
- BOS: rate classes, versions, self info, idle; locate (profiles, away
  messages, capabilities); the client-side buddy list and the server-
  stored one (feedbag/SSI, kept in a new feedbag table); permit/deny
  lists and modes, ICQ invisibility; IMs on channels 1, 2 (rendezvous
  passed between AIM clients, chat invitations as lines to others) and 4,
  typing notices, host acks
- chat navigation and chat rooms (exchanges 4 and 5) as BBS rooms
- ICQ: numbers are uin_base plus the account's id; family 0x15's offline
  messages (none), short and full info, searches by number and name
- a connection beginning with P3's sync byte goes to Server.P3, for an
  AOL front end on the same port

BUCP digests can't be checked against bcrypt, so while [oscar] is set up
each account keeps a fixed auth key and its two digests (oscar_keys),
made when the password is set or checked in the clear and bound to the
password hash.  The chat core gains WatchPresence (users coming and
going) and Throttle; bbs gains AuthenticateBy for digest logins.

docs/wiki/AIM-and-ICQ.md describes it.

Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTAJGnEAiwGZm9ygpG
2026-11-08 12:00:14 +00:00

40 lines
1.2 KiB
Go

package server
import (
"os"
"path/filepath"
"strings"
"testing"
)
// TestOSCARConfig: [oscar] with its defaults, none without it, and bad
// addresses, names and numbers refused.
func TestOSCARConfig(t *testing.T) {
load := func(body string) (*Config, error) {
p := filepath.Join(t.TempDir(), "bbs.conf")
os.WriteFile(p, []byte("[listen telnet]\ntype = telnet\naddress = :2300\n"+body), 0600)
return Load(p)
}
c, err := load("[oscar]\nhost = aim.example.org:5190\n")
if err != nil {
t.Fatal(err)
}
if o := c.OSCAR; o.Address != ":5190" || o.Host != "aim.example.org:5190" || o.MaxPerIP != 16 ||
o.MaxClients != 256 || o.UINBase != 100000 || o.System != "OnlineHost" {
t.Errorf("oscar %+v", o)
}
if c, err := load(""); err != nil || c.OSCAR != nil {
t.Errorf("no [oscar]: %+v %v", c.OSCAR, err)
}
for body, want := range map[string]string{
"[oscar]\naddress = 5190\n": "address",
"[oscar]\nhost = aim.example.org\n": "host",
"[oscar]\nsystem = A Name Far Too Long\n": "system",
"[oscar]\nuin_base = 5\n": "uin_base",
} {
if _, err := load(body); err == nil || !strings.Contains(err.Error(), want) {
t.Errorf("%q: %v", body, err)
}
}
}