mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
members as map.
This commit is contained in:
parent
b82fbae597
commit
bdd8bdab72
@ -10,11 +10,11 @@ type Message struct {
|
|||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
|
|
||||||
type SystemInit struct {
|
type SystemInit struct {
|
||||||
Event string `json:"event,omitempty"`
|
Event string `json:"event,omitempty"`
|
||||||
MemberId string `json:"member_id"`
|
MemberId string `json:"member_id"`
|
||||||
ControlHost ControlHost `json:"control_host"`
|
ControlHost ControlHost `json:"control_host"`
|
||||||
ScreenSize ScreenSize `json:"screen_size"`
|
ScreenSize ScreenSize `json:"screen_size"`
|
||||||
Members []MemberData `json:"members"`
|
Members map[string]MemberData `json:"members"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SystemAdmin struct {
|
type SystemAdmin struct {
|
||||||
|
@ -23,13 +23,13 @@ func (h *MessageHandlerCtx) systemInit(session types.Session) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
members := []message.MemberData{}
|
members := map[string]message.MemberData{}
|
||||||
for _, session := range h.sessions.Members() {
|
for _, session := range h.sessions.Members() {
|
||||||
members = append(members, message.MemberData{
|
members[session.ID()] = message.MemberData{
|
||||||
ID: session.ID(),
|
ID: session.ID(),
|
||||||
Name: session.Name(),
|
Name: session.Name(),
|
||||||
IsAdmin: session.Admin(),
|
IsAdmin: session.Admin(),
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return session.Send(
|
return session.Send(
|
||||||
|
Loading…
Reference in New Issue
Block a user