diff options
author | Himbeer <himbeer@disroot.org> | 2024-12-06 20:39:47 +0100 |
---|---|---|
committer | Himbeer <himbeer@disroot.org> | 2024-12-07 11:22:54 +0100 |
commit | 162faad9f636263cc27413358af18de725db66d9 (patch) | |
tree | b8de1a5559fee82ba93edb37898a3edfcff4b1ed /process.go | |
parent | fed47e8f13cf051c2f09b08112c513deb08b47a1 (diff) |
Implement modchannel plugin API between clients and proxy
Diffstat (limited to 'process.go')
-rw-r--r-- | process.go | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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) |