Both transports sent an empty string as the user modes in RPL_MYINFO. On the IRC listener that left an empty parameter in the middle of the line, so a client that splits on spaces read the channel modes as the user modes. The reply now lists o and w, the user modes the server supports. Both transports read them from one constant in internal/service, next to the code that decides which user modes MODE accepts. The README and the schema notes now show what the HTTP API sends. Model: opus-5-5
This commit was merged in pull request #237.
This commit is contained in:
@@ -412,7 +412,7 @@ func (hdlr *Handlers) deliverWelcome(
|
||||
// 004 RPL_MYINFO
|
||||
hdlr.enqueueNumeric(
|
||||
ctx, clientID, irc.RplMyInfo, nick,
|
||||
[]string{srvName, version, "", "ikmnostl"},
|
||||
[]string{srvName, version, service.UserModes, "ikmnostl"},
|
||||
"",
|
||||
)
|
||||
|
||||
|
||||
@@ -6797,6 +6797,30 @@ func TestISUPPORT(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestMyInfoListsUserModes verifies the 004 numeric lists
|
||||
// the user modes o and w as its third parameter.
|
||||
func TestMyInfoListsUserModes(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tserver := newTestServer(t)
|
||||
token := tserver.createSession("myinfo")
|
||||
|
||||
msgs, _ := tserver.pollMessages(token, 0)
|
||||
|
||||
myInfo := findNumericWithParams(msgs, "004")
|
||||
if myInfo == nil {
|
||||
t.Fatal("expected 004 RPL_MYINFO")
|
||||
}
|
||||
|
||||
params := getNumericParams(myInfo)
|
||||
if len(params) != 4 || params[2] != "ow" {
|
||||
t.Fatalf(
|
||||
"004 params %v, want four with user modes ow third",
|
||||
params,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// TestNonOpCannotSetModes verifies non-operators
|
||||
// cannot set +i, +s, +k, +l, +b.
|
||||
func TestNonOpCannotSetModes(t *testing.T) {
|
||||
|
||||
@@ -605,7 +605,7 @@ func (c *Conn) deliverWelcome() {
|
||||
)
|
||||
c.sendNumeric(
|
||||
irc.RplMyInfo,
|
||||
c.serverSfx, "neoirc", "", "mnst",
|
||||
c.serverSfx, "neoirc", service.UserModes, "mnst",
|
||||
)
|
||||
c.sendNumeric(
|
||||
irc.RplIsupport,
|
||||
|
||||
@@ -486,6 +486,22 @@ func TestWelcomeContainsNick(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestMyInfoListsUserModes checks that RPL_MYINFO lists the
|
||||
// user modes o and w, with no empty parameter before the
|
||||
// channel modes.
|
||||
func TestMyInfoListsUserModes(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
env := newTestEnv(t)
|
||||
lines := env.dial(t).register("carol")
|
||||
|
||||
assertContains(
|
||||
t, lines,
|
||||
":test.irc 004 carol test.irc neoirc ow mnst",
|
||||
"RPL_MYINFO with user modes",
|
||||
)
|
||||
}
|
||||
|
||||
func TestPingPong(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
@@ -1169,6 +1169,12 @@ func (s *Service) ApplyUserMode(
|
||||
return s.QueryUserMode(ctx, sessionID)
|
||||
}
|
||||
|
||||
// UserModes lists the user modes the server supports, as
|
||||
// RPL_MYINFO sends them: o (server operator) and w
|
||||
// (receives WALLOPS). parseUserModeString must accept the
|
||||
// same letters.
|
||||
const UserModes = "ow"
|
||||
|
||||
// parseUserModeString parses a user mode string such as
|
||||
// "+w", "-o" or "+w-o" into the new value of each flag it
|
||||
// names, or nil for a flag it does not name; a later letter
|
||||
|
||||
Reference in New Issue
Block a user