Enable bot mode for BouncerServ
See [1] for details. [1]: https://ircv3.net/specs/extensions/bot-mode
This commit is contained in:
parent
777adbd5e1
commit
744c6e3f6d
@ -1388,6 +1388,8 @@ func (dc *downstreamConn) welcome(ctx context.Context) error {
|
|||||||
|
|
||||||
if dc.network != nil {
|
if dc.network != nil {
|
||||||
isupport = append(isupport, fmt.Sprintf("BOUNCER_NETID=%v", dc.network.ID))
|
isupport = append(isupport, fmt.Sprintf("BOUNCER_NETID=%v", dc.network.ID))
|
||||||
|
} else {
|
||||||
|
isupport = append(isupport, "BOT=B")
|
||||||
}
|
}
|
||||||
if title := dc.srv.Config().Title; dc.network == nil && title != "" {
|
if title := dc.srv.Config().Title; dc.network == nil && title != "" {
|
||||||
isupport = append(isupport, "NETWORK="+encodeISUPPORT(title))
|
isupport = append(isupport, "NETWORK="+encodeISUPPORT(title))
|
||||||
@ -2195,13 +2197,21 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc.
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if maskCM == serviceNickCM {
|
if maskCM == serviceNickCM {
|
||||||
|
flags := "H*"
|
||||||
|
if dc.network == nil {
|
||||||
|
flags += "B"
|
||||||
|
} else if uc := dc.upstream(); uc != nil {
|
||||||
|
if v := uc.isupport["BOT"]; v != nil && len(*v) == 1 {
|
||||||
|
flags += *v
|
||||||
|
}
|
||||||
|
}
|
||||||
info := whoxInfo{
|
info := whoxInfo{
|
||||||
Token: whoxToken,
|
Token: whoxToken,
|
||||||
Username: servicePrefix.User,
|
Username: servicePrefix.User,
|
||||||
Hostname: servicePrefix.Host,
|
Hostname: servicePrefix.Host,
|
||||||
Server: dc.srv.Config().Hostname,
|
Server: dc.srv.Config().Hostname,
|
||||||
Nickname: serviceNick,
|
Nickname: serviceNick,
|
||||||
Flags: "H*",
|
Flags: flags,
|
||||||
Account: serviceNick,
|
Account: serviceNick,
|
||||||
Realname: serviceRealname,
|
Realname: serviceRealname,
|
||||||
}
|
}
|
||||||
@ -2301,6 +2311,11 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc.
|
|||||||
Command: rpl_whoisaccount,
|
Command: rpl_whoisaccount,
|
||||||
Params: []string{dc.nick, serviceNick, serviceNick, "is logged in as"},
|
Params: []string{dc.nick, serviceNick, serviceNick, "is logged in as"},
|
||||||
})
|
})
|
||||||
|
dc.SendMessage(&irc.Message{
|
||||||
|
Prefix: dc.srv.prefix(),
|
||||||
|
Command: rpl_whoisbot,
|
||||||
|
Params: []string{dc.nick, serviceNick, "is a bot"},
|
||||||
|
})
|
||||||
dc.SendMessage(&irc.Message{
|
dc.SendMessage(&irc.Message{
|
||||||
Prefix: dc.srv.prefix(),
|
Prefix: dc.srv.prefix(),
|
||||||
Command: irc.RPL_ENDOFWHOIS,
|
Command: irc.RPL_ENDOFWHOIS,
|
||||||
|
Loading…
Reference in New Issue
Block a user