diff --git a/diskwriter/diskwriter.go b/diskwriter/diskwriter.go index 03c4970..0491e7e 100644 --- a/diskwriter/diskwriter.go +++ b/diskwriter/diskwriter.go @@ -75,7 +75,7 @@ func (client *Client) Status() map[string]interface{} { return nil } -func (client *Client) PushClient(id, username string, permissions group.ClientPermissions, status map[string]interface{}, kind string) error { +func (client *Client) PushClient(id, username string, permissions *group.ClientPermissions, status map[string]interface{}, kind string) error { return nil } diff --git a/group/client.go b/group/client.go index 1b703cf..1a68212 100644 --- a/group/client.go +++ b/group/client.go @@ -101,6 +101,6 @@ type Client interface { Status() map[string]interface{} OverridePermissions(*Group) bool PushConn(g *Group, id string, conn conn.Up, tracks []conn.UpTrack, replace string) error - PushClient(id, username string, permissions ClientPermissions, status map[string]interface{}, kind string) error + PushClient(id, username string, permissions *ClientPermissions, status map[string]interface{}, kind string) error Kick(id, user, message string) error } diff --git a/group/group.go b/group/group.go index 8d7a8f0..ef8ba2c 100644 --- a/group/group.go +++ b/group/group.go @@ -507,13 +507,11 @@ func AddClient(group string, c Client) (*Group, error) { u := c.Username() p := c.Permissions() s := c.Status() - c.PushClient(c.Id(), u, p, s, "add") + c.PushClient(c.Id(), u, &p, s, "add") for _, cc := range clients { - c.PushClient( - cc.Id(), cc.Username(), cc.Permissions(), cc.Status(), - "add", - ) - cc.PushClient(id, u, p, s, "add") + pp := cc.Permissions() + c.PushClient(cc.Id(), cc.Username(), &pp, cc.Status(), "add") + cc.PushClient(id, u, &p, s, "add") } return g, nil @@ -559,7 +557,7 @@ func DelClient(c Client) { go func(clients []Client) { for _, cc := range clients { - cc.PushClient(c.Id(), c.Username(), c.Permissions(), c.Status(), "delete") + cc.PushClient(c.Id(), "", nil, nil, "delete") } }(clients) diff --git a/rtpconn/webclient.go b/rtpconn/webclient.go index b50bac3..0678bd8 100644 --- a/rtpconn/webclient.go +++ b/rtpconn/webclient.go @@ -111,13 +111,13 @@ func (c *webClient) OverridePermissions(g *group.Group) bool { return false } -func (c *webClient) PushClient(id, username string, permissions group.ClientPermissions, status map[string]interface{}, kind string) error { +func (c *webClient) PushClient(id, username string, permissions *group.ClientPermissions, status map[string]interface{}, kind string) error { return c.write(clientMessage{ Type: "user", Kind: kind, Id: id, Username: username, - Permissions: &permissions, + Permissions: permissions, Status: status, }) } @@ -989,7 +989,7 @@ func handleAction(c *webClient, a interface{}) error { clients := g.GetClients(nil) go func(clients []group.Client) { for _, cc := range clients { - cc.PushClient(id, user, perms, s, "change") + cc.PushClient(id, user, &perms, s, "change") } }(clients) case kickAction: @@ -1479,7 +1479,7 @@ func handleClientMessage(c *webClient, m clientMessage) error { status := c.Status() go func(clients []group.Client) { for _, cc := range clients { - cc.PushClient(id, user, perms, status, + cc.PushClient(id, user, &perms, status, "change") } }(g.GetClients(nil))