1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-26 02:25:58 +01:00

Don't send permissions with each client message.

Thanks to Antonin Décimo.
This commit is contained in:
Juliusz Chroboczek 2020-11-29 15:46:22 +01:00
parent 08a2ff63fc
commit 1ed2540bd7

View file

@ -144,7 +144,7 @@ type clientMessage struct {
Dest string `json:"dest,omitempty"` Dest string `json:"dest,omitempty"`
Username string `json:"username,omitempty"` Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"` Password string `json:"password,omitempty"`
Permissions group.ClientPermissions `json:"permissions,omitempty"` Permissions *group.ClientPermissions `json:"permissions,omitempty"`
Group string `json:"group,omitempty"` Group string `json:"group,omitempty"`
Value string `json:"value,omitempty"` Value string `json:"value,omitempty"`
Time int64 `json:"time,omitempty"` Time int64 `json:"time,omitempty"`
@ -743,9 +743,10 @@ func clientLoop(c *webClient, ws *websocket.Conn) error {
} }
}() }()
perms := c.permissions
c.write(clientMessage{ c.write(clientMessage{
Type: "permissions", Type: "permissions",
Permissions: c.permissions, Permissions: &perms,
}) })
h := c.group.GetChatHistory() h := c.group.GetChatHistory()
@ -866,9 +867,10 @@ func clientLoop(c *webClient, ws *websocket.Conn) error {
} }
case permissionsChangedAction: case permissionsChangedAction:
perms := c.permissions
c.write(clientMessage{ c.write(clientMessage{
Type: "permissions", Type: "permissions",
Permissions: c.permissions, Permissions: &perms,
}) })
if !c.permissions.Present { if !c.permissions.Present {
up := getUpConns(c) up := getUpConns(c)