mirror of
https://github.com/D-Modem/bbs.git
synced 2026-11-28 17:38:04 -08:00
A registered room's ops set its modes with MODE (/mode in the BBS's chat): n t s p m i z g T, the key (k) and limit (l), and the lists: bans (b), quiets (q), exceptions (e) and invite exceptions (I), with masks nick!how@nodeN and the extbans $a, $a:mask and $o (~ negates). c and C are always on, as the rooms always were. MODE b/q/e/I with no mask lists them (367, 728, 348, 346). Modes and lists are kept in room_reg and the new room_lists table, and are the room's: a caller on the text BBS, AOL or Yahoo is kept out or quiet as an IRC user is. INVITE (an op, or anyone in a +g room) gets one past i, k and l for the hour; KNOCK asks the ops of a room one is kept out of, once a minute, but not in a +p room. ChanServ gains INVITE and GETKEY (the i flag, which also gets past i, k and l), and INFO shows the modes. JOIN takes keys; /join ROOM KEY, /invite and /knock come to the BBS's chat. ISUPPORT gives CHANMODES=Ibeq,k,l,CcTgimnpstz, EXCEPTS, INVEX, EXTBAN, MAXLIST, KEYLEN and KNOCK. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRTXE7MNm3r3hHAmTG2
59 lines
1.5 KiB
Go
59 lines
1.5 KiB
Go
package ircd
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/D-Modem/bbs/internal/bbs"
|
|
)
|
|
|
|
// ChanServ: the rooms' registration and access lists. The commands are
|
|
// the BBS's own (bbs.Node.ChanServ, which the BBS chat's /cs runs too);
|
|
// here they come as messages to the bot, or its own IRC command (/CS).
|
|
|
|
// newChanServ is the rooms' service under nick name.
|
|
func newChanServ(name string) *service {
|
|
short := "CS"
|
|
if fold(name) != "chanserv" {
|
|
short = strings.ToUpper(name)
|
|
}
|
|
return &service{Name: name, ShortName: short, CommandAliases: []string{strings.ToUpper(name), short},
|
|
raw: csLine}
|
|
}
|
|
|
|
// csLine runs a line sent to ChanServ, its answers as notices.
|
|
func csLine(svc *service, c *client, line string) {
|
|
for _, l := range c.n.ChanServ(line) {
|
|
if l == "" {
|
|
l = " "
|
|
}
|
|
svc.notice(c, l)
|
|
}
|
|
}
|
|
|
|
// serviceReal is a service's real name, as WHO and WHOIS give it.
|
|
func (s *Server) serviceReal(svc *service) string {
|
|
if svc == s.cs {
|
|
return "The registered rooms and their access lists"
|
|
}
|
|
return "Your BBS account and the permanent rooms"
|
|
}
|
|
|
|
// eventSource is who a Mode or Kicked came from: a service, or someone on
|
|
// a node.
|
|
func (c *client) eventSource(e bbs.Event) string {
|
|
if svc := c.s.service(e.From); svc != nil && e.Node == 0 {
|
|
return svc.source(c)
|
|
}
|
|
return c.sourceOf(e.From, e.Node)
|
|
}
|
|
|
|
// nodeOfUser is a node a user is on (0: none).
|
|
func (c *client) nodeOfUser(name string) int {
|
|
for _, n := range c.s.B.Nodes() {
|
|
if n.User == name {
|
|
return n.Num
|
|
}
|
|
}
|
|
return 0
|
|
}
|