aboutsummaryrefslogtreecommitdiff
path: root/moderation.go
blob: 4cb3e685f0d4c5d5caf0501f437dc7c972cf86eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package proxy

import "github.com/anon55555/mt"

// Kick sends mt.ToCltDisco with the specified custom reason
// and closes the ClientConn.
func (cc *ClientConn) Kick(reason string) {
	if reason == "" {
		reason = "Kicked by proxy."
	}

	ack, _ := cc.SendCmd(&mt.ToCltDisco{
		Reason: mt.Custom,
		Custom: reason,
	})

	select {
	case <-cc.Closed():
	case <-ack:
		cc.Close()
	}
}