|
|
@ -107,7 +107,7 @@ func (s *Server) OnText(c *Connection, b Buffer) { |
|
|
|
// TODO(longsleep): Validate Answer
|
|
|
|
// TODO(longsleep): Validate Answer
|
|
|
|
s.Unicast(c, msg.Answer.To, msg.Answer) |
|
|
|
s.Unicast(c, msg.Answer.To, msg.Answer) |
|
|
|
case "Users": |
|
|
|
case "Users": |
|
|
|
if c.h.config.DefaultRoomEnabled || !c.h.isDefaultRoomid(c.Roomid) { |
|
|
|
if c.Hello { |
|
|
|
s.Users(c) |
|
|
|
s.Users(c) |
|
|
|
} |
|
|
|
} |
|
|
|
case "Authentication": |
|
|
|
case "Authentication": |
|
|
@ -122,7 +122,7 @@ func (s *Server) OnText(c *Connection, b Buffer) { |
|
|
|
case "Status": |
|
|
|
case "Status": |
|
|
|
//log.Println("Status", msg.Status)
|
|
|
|
//log.Println("Status", msg.Status)
|
|
|
|
s.UpdateSession(c, &SessionUpdate{Types: []string{"Status"}, Status: msg.Status.Status}) |
|
|
|
s.UpdateSession(c, &SessionUpdate{Types: []string{"Status"}, Status: msg.Status.Status}) |
|
|
|
if c.h.config.DefaultRoomEnabled || !c.h.isDefaultRoomid(c.Roomid) { |
|
|
|
if c.Hello { |
|
|
|
s.Broadcast(c, c.Session.DataSessionStatus()) |
|
|
|
s.Broadcast(c, c.Session.DataSessionStatus()) |
|
|
|
} |
|
|
|
} |
|
|
|
case "Chat": |
|
|
|
case "Chat": |
|
|
@ -133,7 +133,7 @@ func (s *Server) OnText(c *Connection, b Buffer) { |
|
|
|
msg.Chat.Chat.Time = time.Now().Format(time.RFC3339) |
|
|
|
msg.Chat.Chat.Time = time.Now().Format(time.RFC3339) |
|
|
|
if msg.Chat.To == "" { |
|
|
|
if msg.Chat.To == "" { |
|
|
|
// TODO(longsleep): Check if chat broadcast is allowed.
|
|
|
|
// TODO(longsleep): Check if chat broadcast is allowed.
|
|
|
|
if c.h.config.DefaultRoomEnabled || !c.h.isDefaultRoomid(c.Roomid) { |
|
|
|
if c.Hello { |
|
|
|
atomic.AddUint64(&c.h.broadcastChatMessages, 1) |
|
|
|
atomic.AddUint64(&c.h.broadcastChatMessages, 1) |
|
|
|
s.Broadcast(c, msg.Chat) |
|
|
|
s.Broadcast(c, msg.Chat) |
|
|
|
} |
|
|
|
} |
|
|
|