- Timestamp:
- Jul 8, 2020, 4:21:52 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/upstream.go
r353 r355 1316 1316 } 1317 1317 1318 if downstreamID != 0 { 1319 uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) { 1320 dc.SendMessage(&irc.Message{ 1321 Prefix: uc.srv.prefix(), 1322 Command: msg.Command, 1323 Params: []string{dc.nick, command, reason}, 1324 }) 1325 }) 1326 } 1318 uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) { 1319 dc.SendMessage(&irc.Message{ 1320 Prefix: uc.srv.prefix(), 1321 Command: msg.Command, 1322 Params: []string{dc.nick, command, reason}, 1323 }) 1324 }) 1327 1325 case "ACK": 1328 1326 // Ignore … … 1348 1346 default: 1349 1347 uc.logger.Printf("unhandled message: %v", msg) 1350 if downstreamID != 0 { 1351 uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) { 1352 // best effort marshaling for unknown messages, replies and errors: 1353 // most numerics start with the user nick, marshal it if that's the case 1354 // otherwise, conservately keep the params without marshaling 1355 params := msg.Params 1356 if _, err := strconv.Atoi(msg.Command); err == nil { // numeric 1357 if len(msg.Params) > 0 && isOurNick(uc.network, msg.Params[0]) { 1358 params[0] = dc.nick 1359 } 1348 1349 uc.forEachDownstreamByID(downstreamID, func(dc *downstreamConn) { 1350 // best effort marshaling for unknown messages, replies and errors: 1351 // most numerics start with the user nick, marshal it if that's the case 1352 // otherwise, conservately keep the params without marshaling 1353 params := msg.Params 1354 if _, err := strconv.Atoi(msg.Command); err == nil { // numeric 1355 if len(msg.Params) > 0 && isOurNick(uc.network, msg.Params[0]) { 1356 params[0] = dc.nick 1360 1357 } 1361 dc.SendMessage(&irc.Message{1362 Prefix: uc.srv.prefix(),1363 Command: msg.Command,1364 Params: params,1365 })1366 }) 1367 } 1358 } 1359 dc.SendMessage(&irc.Message{ 1360 Prefix: uc.srv.prefix(), 1361 Command: msg.Command, 1362 Params: params, 1363 }) 1364 }) 1368 1365 } 1369 1366 return nil
Note:
See TracChangeset
for help on using the changeset viewer.