downstream: drop downstreamConn.marshalUserPrefix
This is now a no-op.
This commit is contained in:
parent
00919e9412
commit
25257b8892
@ -442,24 +442,6 @@ func (dc *downstreamConn) marshalEntity(net *network, name string) string {
|
||||
return name + "/" + net.GetName()
|
||||
}
|
||||
|
||||
func (dc *downstreamConn) marshalUserPrefix(net *network, prefix *irc.Prefix) *irc.Prefix {
|
||||
if isOurNick(net, prefix.Name) {
|
||||
return dc.prefix()
|
||||
}
|
||||
prefix.Name = partialCasemap(net.casemap, prefix.Name)
|
||||
if dc.network != nil {
|
||||
if dc.network != net {
|
||||
panic("soju: tried to marshal a user prefix for another network")
|
||||
}
|
||||
return prefix
|
||||
}
|
||||
return &irc.Prefix{
|
||||
Name: prefix.Name + "/" + net.GetName(),
|
||||
User: prefix.User,
|
||||
Host: prefix.Host,
|
||||
}
|
||||
}
|
||||
|
||||
// unmarshalEntityNetwork converts a downstream entity name (ie. channel or
|
||||
// nick) into an upstream entity name.
|
||||
//
|
||||
@ -661,7 +643,6 @@ func (dc *downstreamConn) handlePong(token string) {
|
||||
// may only appear in single-upstream mode.
|
||||
func (dc *downstreamConn) marshalMessage(msg *irc.Message, net *network) *irc.Message {
|
||||
msg = msg.Copy()
|
||||
msg.Prefix = dc.marshalUserPrefix(net, msg.Prefix)
|
||||
|
||||
if dc.network != nil {
|
||||
return msg
|
||||
@ -3509,12 +3490,11 @@ func sendTopic(dc *downstreamConn, ch *upstreamChannel) {
|
||||
Params: []string{dc.nick, downstreamName, ch.Topic},
|
||||
})
|
||||
if ch.TopicWho != nil {
|
||||
topicWho := dc.marshalUserPrefix(ch.conn.network, ch.TopicWho)
|
||||
topicTime := strconv.FormatInt(ch.TopicTime.Unix(), 10)
|
||||
dc.SendMessage(&irc.Message{
|
||||
Prefix: dc.srv.prefix(),
|
||||
Command: xirc.RPL_TOPICWHOTIME,
|
||||
Params: []string{dc.nick, downstreamName, topicWho.String(), topicTime},
|
||||
Params: []string{dc.nick, downstreamName, ch.TopicWho.String(), topicTime},
|
||||
})
|
||||
}
|
||||
} else {
|
||||
|
13
upstream.go
13
upstream.go
@ -1197,7 +1197,7 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
|
||||
}
|
||||
|
||||
dc.SendMessage(&irc.Message{
|
||||
Prefix: dc.marshalUserPrefix(uc.network, msg.Prefix),
|
||||
Prefix: msg.Prefix,
|
||||
Command: "MODE",
|
||||
Params: params,
|
||||
})
|
||||
@ -1307,14 +1307,13 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
|
||||
c := uc.network.channels.Get(channel)
|
||||
if firstTopicWhoTime && (c == nil || !c.Detached) {
|
||||
uc.forEachDownstream(func(dc *downstreamConn) {
|
||||
topicWho := dc.marshalUserPrefix(uc.network, ch.TopicWho)
|
||||
dc.SendMessage(&irc.Message{
|
||||
Prefix: dc.srv.prefix(),
|
||||
Command: xirc.RPL_TOPICWHOTIME,
|
||||
Params: []string{
|
||||
dc.nick,
|
||||
dc.marshalEntity(uc.network, ch.Name),
|
||||
topicWho.String(),
|
||||
ch.TopicWho.String(),
|
||||
timeStr,
|
||||
},
|
||||
})
|
||||
@ -1551,7 +1550,7 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
|
||||
return
|
||||
}
|
||||
dc.SendMessage(&irc.Message{
|
||||
Prefix: dc.marshalUserPrefix(uc.network, msg.Prefix),
|
||||
Prefix: msg.Prefix,
|
||||
Command: "INVITE",
|
||||
Params: []string{dc.marshalEntity(uc.network, nick), dc.marshalEntity(uc.network, channel)},
|
||||
})
|
||||
@ -1651,11 +1650,7 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
|
||||
})
|
||||
case "AWAY", "ACCOUNT":
|
||||
uc.forEachDownstream(func(dc *downstreamConn) {
|
||||
dc.SendMessage(&irc.Message{
|
||||
Prefix: dc.marshalUserPrefix(uc.network, msg.Prefix),
|
||||
Command: msg.Command,
|
||||
Params: msg.Params,
|
||||
})
|
||||
dc.SendMessage(msg)
|
||||
})
|
||||
case irc.RPL_BANLIST, irc.RPL_INVITELIST, irc.RPL_EXCEPTLIST:
|
||||
var channel, mask string
|
||||
|
Loading…
Reference in New Issue
Block a user