From 17e88b6e46bbb5fa2206f36cc3203421c896ebb0 Mon Sep 17 00:00:00 2001 From: khlieng Date: Thu, 12 Feb 2015 02:44:15 +0100 Subject: [PATCH] Send the userlists to the client separately --- websocket_handler.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/websocket_handler.go b/websocket_handler.go index 733632ae..8fd1109d 100644 --- a/websocket_handler.go +++ b/websocket_handler.go @@ -47,12 +47,19 @@ func handleWS(ws *websocket.Conn) { channels := session.user.GetChannels() for i, channel := range channels { - channels[i].Users = channelStore.GetUsers(channel.Server, channel.Name) channels[i].Topic = channelStore.GetTopic(channel.Server, channel.Name) } session.sendJSON("channels", channels) session.sendJSON("servers", session.user.GetServers()) + + for _, channel := range channels { + session.sendJSON("users", Userlist{ + Server: channel.Server, + Channel: channel.Name, + Users: channelStore.GetUsers(channel.Server, channel.Name), + }) + } } else { session = NewSession() session.user = storage.NewUser(UUID)