From 72a285aaebc83c97230a899e450acee24cf837b1 Mon Sep 17 00:00:00 2001 From: delthas Date: Thu, 26 Mar 2020 04:30:11 +0100 Subject: [PATCH] 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. --- downstream.go | 8 ++++---- upstream.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/downstream.go b/downstream.go index 006a14f..8ed0826 100644 --- a/downstream.go +++ b/downstream.go @@ -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}, }) diff --git a/upstream.go b/upstream.go index c6e34bc..fcc2be7 100644 --- a/upstream.go +++ b/upstream.go @@ -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)