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

View File

@ -1227,12 +1227,12 @@ func (uc *upstreamConn) SendMessage(msg *irc.Message) {
uc.outgoing <- msg 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 uc.labelsSupported {
if msg.Tags == nil { if msg.Tags == nil {
msg.Tags = make(map[string]irc.TagValue) 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.nextLabelID++
} }
uc.SendMessage(msg) uc.SendMessage(msg)