Changeset 261 in code for trunk/downstream.go
- Timestamp:
- Apr 16, 2020, 3:23:35 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/downstream.go
r260 r261 239 239 // that it's suitable for being sent on this downstream connection. Only 240 240 // messages that may appear in logs are supported. 241 func (dc *downstreamConn) marshalMessage(msg *irc.Message, uc *upstreamConn) *irc.Message {241 func (dc *downstreamConn) marshalMessage(msg *irc.Message, net *network) *irc.Message { 242 242 msg = msg.Copy() 243 msg.Prefix = dc.marshalUserPrefix( uc.network, msg.Prefix)243 msg.Prefix = dc.marshalUserPrefix(net, msg.Prefix) 244 244 245 245 switch msg.Command { 246 246 case "PRIVMSG", "NOTICE": 247 msg.Params[0] = dc.marshalEntity( uc.network, msg.Params[0])247 msg.Params[0] = dc.marshalEntity(net, msg.Params[0]) 248 248 case "NICK": 249 249 // Nick change for another user 250 msg.Params[0] = dc.marshalEntity( uc.network, msg.Params[0])250 msg.Params[0] = dc.marshalEntity(net, msg.Params[0]) 251 251 case "JOIN", "PART": 252 msg.Params[0] = dc.marshalEntity( uc.network, msg.Params[0])252 msg.Params[0] = dc.marshalEntity(net, msg.Params[0]) 253 253 case "KICK": 254 msg.Params[0] = dc.marshalEntity( uc.network, msg.Params[0])255 msg.Params[1] = dc.marshalEntity( uc.network, msg.Params[1])254 msg.Params[0] = dc.marshalEntity(net, msg.Params[0]) 255 msg.Params[1] = dc.marshalEntity(net, msg.Params[1]) 256 256 case "TOPIC": 257 msg.Params[0] = dc.marshalEntity( uc.network, msg.Params[0])257 msg.Params[0] = dc.marshalEntity(net, msg.Params[0]) 258 258 case "MODE": 259 msg.Params[0] = dc.marshalEntity( uc.network, msg.Params[0])259 msg.Params[0] = dc.marshalEntity(net, msg.Params[0]) 260 260 case "QUIT": 261 261 // This space is intentinally left blank … … 711 711 consumer := history.ring.NewConsumer(seq) 712 712 713 // TODO: this means all history is lost when trying to send it while the714 // upstream is disconnected. We need to store history differently so that715 // we don't need access to upstreamConn to forward it to a downstream716 // client.717 uc := net.upstream()718 if uc == nil {719 dc.logger.Printf("ignoring messages for upstream %q: upstream is disconnected", net.Addr)720 return721 }722 723 713 batchRef := "history" 724 714 if dc.caps["batch"] { … … 753 743 } 754 744 755 dc.SendMessage(dc.marshalMessage(msg, uc))745 dc.SendMessage(dc.marshalMessage(msg, net)) 756 746 } 757 747
Note:
See TracChangeset
for help on using the changeset viewer.