Commit 8a2357de authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Only send chat history when joining.

When we moved the chat history to the client goroutine back in 0.6,
we started sending the history whenever the group configuration changed.
Only send it when first joining the group.  Thanks to Rémi Nollet.
parent 62517844
...@@ -2,6 +2,7 @@ Galene 0.6.1 (unreleased): ...@@ -2,6 +2,7 @@ Galene 0.6.1 (unreleased):
* Ensure that autolocked groups are locked on creation. Thanks to * Ensure that autolocked groups are locked on creation. Thanks to
Michael Ströder. Michael Ströder.
* Don't send chat history multiple times. Thanks to Rémy Nollet.
* Add a camera/microphone indicator in the users list. * Add a camera/microphone indicator in the users list.
* Hide audio-only peers by default. * Hide audio-only peers by default.
......
...@@ -1168,8 +1168,9 @@ func handleAction(c *webClient, a interface{}) error { ...@@ -1168,8 +1168,9 @@ func handleAction(c *webClient, a interface{}) error {
case joinedAction: case joinedAction:
var status *group.Status var status *group.Status
var data map[string]interface{} var data map[string]interface{}
var g *group.Group
if a.group != "" { if a.group != "" {
g := group.Get(a.group) g = group.Get(a.group)
if g != nil { if g != nil {
s := g.Status(true, "") s := g.Status(true, "")
status = &s status = &s
...@@ -1190,18 +1191,25 @@ func handleAction(c *webClient, a interface{}) error { ...@@ -1190,18 +1191,25 @@ func handleAction(c *webClient, a interface{}) error {
if err != nil { if err != nil {
return err return err
} }
h := c.group.GetChatHistory() if a.kind == "join" {
for _, m := range h { if g == nil {
err := c.write(clientMessage{ log.Println("g is null when joining" +
Type: "chathistory", "this shouldn't happen")
Source: m.Id, return nil
Username: m.User, }
Time: m.Time, h := g.GetChatHistory()
Value: m.Value, for _, m := range h {
Kind: m.Kind, err := c.write(clientMessage{
}) Type: "chathistory",
if err != nil { Source: m.Id,
return err Username: m.User,
Time: m.Time,
Value: m.Value,
Kind: m.Kind,
})
if err != nil {
return err
}
} }
} }
case permissionsChangedAction: case permissionsChangedAction:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment