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