Send the userlists to the client separately

This commit is contained in:
khlieng 2015-02-12 02:44:15 +01:00
parent b7cafc5327
commit 17e88b6e46

View File

@ -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)