upstream: improve server message detection
Stop relying on user/host being unset: this is fragile, some servers send messages coming from users without these.
This commit is contained in:
parent
ebe209b3a4
commit
ca3557d9ef
@ -503,9 +503,12 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if msg.Prefix.User == "" && msg.Prefix.Host == "" { // server message
|
if msg.Prefix.Name == uc.serverPrefix.Name || msg.Prefix.Name == "*" || strings.HasPrefix(target, "$") {
|
||||||
|
// This is a server message
|
||||||
uc.produce("", msg, 0)
|
uc.produce("", msg, 0)
|
||||||
} else { // regular user message
|
break
|
||||||
|
}
|
||||||
|
|
||||||
bufferName := target
|
bufferName := target
|
||||||
if uc.isOurNick(target) {
|
if uc.isOurNick(target) {
|
||||||
bufferName = msg.Prefix.Name
|
bufferName = msg.Prefix.Name
|
||||||
@ -532,7 +535,6 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
|
|||||||
}
|
}
|
||||||
|
|
||||||
uc.produce(bufferName, msg, downstreamID)
|
uc.produce(bufferName, msg, downstreamID)
|
||||||
}
|
|
||||||
case "CAP":
|
case "CAP":
|
||||||
var subCmd string
|
var subCmd string
|
||||||
if err := parseMessageParams(msg, nil, &subCmd); err != nil {
|
if err := parseMessageParams(msg, nil, &subCmd); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user