// Send permission denied by who, what, where func (c *Client) sendPermissionDenied(who *Client, where *Channel, what Permission) { pd := &mumbleproto.PermissionDenied{ Permission: proto.Uint32(uint32(what)), ChannelId: proto.Uint32(uint32(where.Id)), Session: proto.Uint32(who.Session), Type: mumbleproto.NewPermissionDenied_DenyType(mumbleproto.PermissionDenied_Permission), } err := c.sendMessage(pd) if err != nil { c.Panicf("%v", err.Error()) return } }
// Send permission denied fallback func (client *Client) sendPermissionDeniedFallback(denyType mumbleproto.PermissionDenied_DenyType, version uint32, text string) { pd := &mumbleproto.PermissionDenied{ Type: mumbleproto.NewPermissionDenied_DenyType(denyType), } if client.Version < version { pd.Reason = proto.String(text) } err := client.sendMessage(pd) if err != nil { client.Panicf("%v", err.Error()) return } }
// Send permission denied by type (and user) func (c *Client) sendPermissionDeniedTypeUser(denyType mumbleproto.PermissionDenied_DenyType, user *Client) { pd := &mumbleproto.PermissionDenied{ Type: mumbleproto.NewPermissionDenied_DenyType(denyType), } if user != nil { pd.Session = proto.Uint32(uint32(user.Session)) } err := c.sendMessage(pd) if err != nil { c.Panicf("%v", err.Error()) return } }