repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
0759d85
parent
5a1f3d8
author
Antonio Mika
date
2023-11-15 17:29:37 +0000 UTC
Push network id with broadcasted message in soju
1 files changed,  +36, -1
M bouncer/subscriber-change.diff
+36, -1
 1@@ -1,5 +1,19 @@
 2+diff --git a/downstream.go b/downstream.go
 3+index f383212..b59dc29 100644
 4+--- a/downstream.go
 5++++ b/downstream.go
 6+@@ -2947,6 +2947,9 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc.
 7+ 				network.pushTargets.Del(target)
 8+ 			}
 9+ 			go network.broadcastWebPush(&irc.Message{
10++				Tags: irc.Tags{
11++					"bouncerNetwork": strconv.FormatInt(dc.network.ID, 10),
12++				},
13+ 				Command: "MARKREAD",
14+ 				Params:  []string{target, timestampStr},
15+ 			})
16 diff --git a/server.go b/server.go
17-index 00d7560..98f0424 100644
18+index 552104e..498d827 100644
19 --- a/server.go
20 +++ b/server.go
21 @@ -339,7 +339,7 @@ func (s *Server) sendWebPush(ctx context.Context, sub *webpush.Subscription, vap
22@@ -11,3 +25,24 @@ index 00d7560..98f0424 100644
23  		TTL:             7 * 24 * 60 * 60, // seconds
24  		Urgency:         urgency,
25  		RecordSize:      2048,
26+diff --git a/upstream.go b/upstream.go
27+index ca56a82..a7c5dbb 100644
28+--- a/upstream.go
29++++ b/upstream.go
30+@@ -682,6 +682,8 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
31+ 		}
32+ 
33+ 		if highlight || directMessage {
34++			msg.Tags["bouncerNetwork"] = strconv.FormatInt(uc.network.ID, 10)
35++
36+ 			go uc.network.broadcastWebPush(msg)
37+ 			if timestamp, err := time.Parse(xirc.ServerTimeLayout, string(msg.Tags["time"])); err == nil {
38+ 				uc.network.pushTargets.Set(bufferName, timestamp)
39+@@ -1611,6 +1613,7 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
40+ 		})
41+ 
42+ 		if weAreInvited {
43++			msg.Tags["bouncerNetwork"] = strconv.FormatInt(uc.network.ID, 10)
44+ 			go uc.network.broadcastWebPush(msg)
45+ 		}
46+ 	case irc.RPL_INVITING: