Make upstream.SendMessageLabeled use an uint64 id

This commit is preparatory work for code that will call
SendMessageLabeled with a direct downstream id rather than a
downstreamConnection pointer.
This commit is contained in:
delthas 2020-03-26 04:30:11 +01:00 committed by Simon Ser
parent b33e5f29ab
commit 72a285aaeb
2 changed files with 6 additions and 6 deletions

View File

@ -1099,7 +1099,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
sendNames(dc, ch)
} else {
// NAMES on a channel we have not joined, ask upstream
uc.SendMessageLabeled(dc, &irc.Message{
uc.SendMessageLabeled(dc.id, &irc.Message{
Command: "NAMES",
Params: []string{upstreamChannel},
})
@ -1146,7 +1146,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
params = []string{upstreamName}
}
uc.SendMessageLabeled(dc, &irc.Message{
uc.SendMessageLabeled(dc.id, &irc.Message{
Command: "WHO",
Params: params,
})
@ -1203,7 +1203,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
params = []string{upstreamNick}
}
uc.SendMessageLabeled(dc, &irc.Message{
uc.SendMessageLabeled(dc.id, &irc.Message{
Command: "WHOIS",
Params: params,
})
@ -1288,7 +1288,7 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
}
uc := ucChannel
uc.SendMessageLabeled(dc, &irc.Message{
uc.SendMessageLabeled(dc.id, &irc.Message{
Command: "INVITE",
Params: []string{upstreamUser, upstreamChannel},
})

View File

@ -1227,12 +1227,12 @@ func (uc *upstreamConn) SendMessage(msg *irc.Message) {
uc.outgoing <- msg
}
func (uc *upstreamConn) SendMessageLabeled(dc *downstreamConn, msg *irc.Message) {
func (uc *upstreamConn) SendMessageLabeled(downstreamID uint64, msg *irc.Message) {
if uc.labelsSupported {
if msg.Tags == nil {
msg.Tags = make(map[string]irc.TagValue)
}
msg.Tags["label"] = irc.TagValue(fmt.Sprintf("sd-%d-%d", dc.id, uc.nextLabelID))
msg.Tags["label"] = irc.TagValue(fmt.Sprintf("sd-%d-%d", downstreamID, uc.nextLabelID))
uc.nextLabelID++
}
uc.SendMessage(msg)