Add support for STATUSMSG
This passes the STATUSMSG isupport through, and it ignores statusmsg prefix when routing messages through the PRIVMSG, NOTICE, and TAGMSG handler so they will show up in the correct history. Because it doesn't modify the message the statusmsg sigils show up correctly for the user on receipt. Without this PR the statusmsg messages still come through to the client, but they get misrouted by clients expecting STATUSMSG to be specified in 005 and they don't go into the right channel history. Closes: https://todo.sr.ht/~emersion/soju/124
This commit is contained in:
parent
01b28fa85d
commit
be3c6d72c1
@ -282,6 +282,7 @@ var passthroughIsupport = map[string]bool{
|
||||
"NICKLEN": true,
|
||||
"PREFIX": true,
|
||||
"SAFELIST": true,
|
||||
"STATUSMSG": true,
|
||||
"TARGMAX": true,
|
||||
"TOPICLEN": true,
|
||||
"USERLEN": true,
|
||||
|
11
upstream.go
11
upstream.go
@ -199,6 +199,7 @@ type upstreamConn struct {
|
||||
availableUserModes string
|
||||
availableChannelModes map[byte]channelModeType
|
||||
availableChannelTypes string
|
||||
availableStatusMsg string
|
||||
availableMemberships []xirc.Membership
|
||||
isupport map[string]*string
|
||||
|
||||
@ -373,6 +374,7 @@ func connectToUpstream(ctx context.Context, network *network) (*upstreamConn, er
|
||||
batches: make(map[string]upstreamBatch),
|
||||
serverPrefix: &irc.Prefix{Name: "*"},
|
||||
availableChannelTypes: stdChannelTypes,
|
||||
availableStatusMsg: "",
|
||||
availableChannelModes: stdChannelModes,
|
||||
availableMemberships: stdMemberships,
|
||||
isupport: make(map[string]*string),
|
||||
@ -632,6 +634,9 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
|
||||
}
|
||||
}
|
||||
|
||||
// remove statusmsg sigils from target
|
||||
target = strings.TrimLeft(target, uc.availableStatusMsg)
|
||||
|
||||
if uc.network.equalCasemap(msg.Prefix.Name, serviceNick) {
|
||||
uc.logger.Printf("skipping %v from soju's service: %v", msg.Command, msg)
|
||||
break
|
||||
@ -973,6 +978,12 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
|
||||
} else {
|
||||
uc.availableChannelTypes = stdChannelTypes
|
||||
}
|
||||
case "STATUSMSG":
|
||||
if !negate {
|
||||
uc.availableStatusMsg = value
|
||||
} else {
|
||||
uc.availableStatusMsg = ""
|
||||
}
|
||||
case "PREFIX":
|
||||
if !negate {
|
||||
err = uc.handleMemberships(value)
|
||||
|
Loading…
Reference in New Issue
Block a user