members as map.

This commit is contained in:
Miroslav Šedivý 2020-12-01 22:56:08 +01:00
parent b82fbae597
commit bdd8bdab72
2 changed files with 8 additions and 8 deletions

View File

@ -14,7 +14,7 @@ type SystemInit struct {
MemberId string `json:"member_id"`
ControlHost ControlHost `json:"control_host"`
ScreenSize ScreenSize `json:"screen_size"`
Members []MemberData `json:"members"`
Members map[string]MemberData `json:"members"`
}
type SystemAdmin struct {

View File

@ -23,13 +23,13 @@ func (h *MessageHandlerCtx) systemInit(session types.Session) error {
return nil
}
members := []message.MemberData{}
members := map[string]message.MemberData{}
for _, session := range h.sessions.Members() {
members = append(members, message.MemberData{
members[session.ID()] = message.MemberData{
ID: session.ID(),
Name: session.Name(),
IsAdmin: session.Admin(),
})
}
}
return session.Send(