aboutsummaryrefslogtreecommitdiff
path: root/process.go
diff options
context:
space:
mode:
authorHimbeer <himbeer@disroot.org>2024-12-06 20:39:47 +0100
committerHimbeer <himbeer@disroot.org>2024-12-07 11:22:54 +0100
commit162faad9f636263cc27413358af18de725db66d9 (patch)
treeb8de1a5559fee82ba93edb37898a3edfcff4b1ed /process.go
parentfed47e8f13cf051c2f09b08112c513deb08b47a1 (diff)
Implement modchannel plugin API between clients and proxy
Diffstat (limited to 'process.go')
-rw-r--r--process.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/process.go b/process.go
index a68238c..05b16fe 100644
--- a/process.go
+++ b/process.go
@@ -12,6 +12,10 @@ import (
)
func (cc *ClientConn) process(pkt mt.Pkt) {
+ defer func() {
+ cltLeaveModChans(cc)
+ }()
+
srv := cc.server()
forward := func(pkt mt.Pkt) {
@@ -484,6 +488,18 @@ func (cc *ClientConn) process(pkt mt.Pkt) {
if handleOnPlayerReceiveFields(cc, cmd) {
return
}
+ case *mt.ToSrvJoinModChan:
+ modChanSubscriberMu.Lock()
+ defer modChanSubscriberMu.Unlock()
+
+ subs, _ := modChanSubscribers[cmd.Channel]
+ modChanSubscribers[cmd.Channel] = append(subs, cc)
+ case *mt.ToSrvLeaveModChan:
+ cltLeaveModChan(cc, cmd.Channel)
+ case *mt.ToSrvMsgModChan:
+ if handleCltModChanMsg(cc, cmd) {
+ return
+ }
}
forward(pkt)