Marshal NOTICE user prefixes and channels
NOTICE messages can be both special messages from the server (with no prefix nick), or regular PRIVMSG-like messages from users. This commit adds support for marshaling channel and user prefixes in the latter case.
This commit is contained in:
parent
2966723ab4
commit
8c56e610ff
15
upstream.go
15
upstream.go
@ -204,9 +204,24 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
|
||||
case "NOTICE":
|
||||
uc.logger.Print(msg)
|
||||
|
||||
if msg.Prefix.User == "" && msg.Prefix.Host == "" { // server message
|
||||
uc.forEachDownstream(func(dc *downstreamConn) {
|
||||
dc.SendMessage(msg)
|
||||
})
|
||||
} else { // regular user NOTICE
|
||||
var nick, text string
|
||||
if err := parseMessageParams(msg, &nick, &text); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
uc.forEachDownstream(func(dc *downstreamConn) {
|
||||
dc.SendMessage(&irc.Message{
|
||||
Prefix: dc.marshalUserPrefix(uc, msg.Prefix),
|
||||
Command: "NOTICE",
|
||||
Params: []string{dc.marshalEntity(uc, nick), text},
|
||||
})
|
||||
})
|
||||
}
|
||||
case "CAP":
|
||||
var subCmd string
|
||||
if err := parseMessageParams(msg, nil, &subCmd); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user