mirror of
https://github.com/mumble-voip/grumble.git
synced 2025-12-29 22:21:58 -08:00
Handle UserState and UserRemove (with a few exceptions!)
This commit is contained in:
parent
4903558e4a
commit
925e23b0f9
4 changed files with 235 additions and 28 deletions
37
client.go
37
client.go
|
|
@ -37,12 +37,21 @@ type Client struct {
|
|||
udp bool
|
||||
|
||||
// Personal
|
||||
UserId int
|
||||
Session uint32
|
||||
Username string
|
||||
Hash string
|
||||
Tokens []string
|
||||
Channel *Channel
|
||||
UserId int
|
||||
Session uint32
|
||||
Username string
|
||||
Hash string
|
||||
Tokens []string
|
||||
Channel *Channel
|
||||
SelfMute bool
|
||||
SelfDeaf bool
|
||||
Mute bool
|
||||
Deaf bool
|
||||
Suppress bool
|
||||
PrioritySpeaker bool
|
||||
Recording bool
|
||||
PluginContext []byte
|
||||
PluginIdentity string
|
||||
}
|
||||
|
||||
// Something invalid happened on the wire.
|
||||
|
|
@ -51,18 +60,28 @@ func (client *Client) Panic(reason string) {
|
|||
client.Disconnect()
|
||||
}
|
||||
|
||||
func (client *Client) Disconnect() {
|
||||
// Internal disconnect function
|
||||
func (client *Client) disconnect(kicked bool) {
|
||||
if !client.disconnected {
|
||||
client.disconnected = true
|
||||
close(client.udprecv)
|
||||
close(client.msgchan)
|
||||
|
||||
client.conn.Close()
|
||||
|
||||
client.server.RemoveClient(client)
|
||||
client.server.RemoveClient(client, kicked)
|
||||
}
|
||||
}
|
||||
|
||||
// Disconnect a client (client disconnected)
|
||||
func (client *Client) Disconnect() {
|
||||
client.disconnect(false)
|
||||
}
|
||||
|
||||
// Disconnect a client (kick/ban)
|
||||
func (client *Client) ForceDisconnect() {
|
||||
client.disconnect(true)
|
||||
}
|
||||
|
||||
// Read a protobuf message from a client
|
||||
func (client *Client) readProtoMessage() (msg *Message, err os.Error) {
|
||||
var length uint32
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue