Browse Source

Also send "Conference" message after "Room" messages.

pull/284/head
Joachim Bauch 9 years ago
parent
commit
a74f424a86
  1. 2
      go/channelling/api/api.go
  2. 19
      go/channelling/api/handle_hello.go
  3. 23
      go/channelling/api/handle_room.go

2
go/channelling/api/api.go

@ -199,5 +199,7 @@ func (api *channellingAPI) OnIncomingProcessed(sender channelling.Sender, sessio @@ -199,5 +199,7 @@ func (api *channellingAPI) OnIncomingProcessed(sender channelling.Sender, sessio
switch msg.Type {
case "Hello":
api.HelloProcessed(sender, session, msg, reply, err)
case "Room":
api.RoomProcessed(sender, session, msg, reply, err)
}
}

19
go/channelling/api/handle_hello.go

@ -48,22 +48,7 @@ func (api *channellingAPI) HandleHello(session *channelling.Session, hello *chan @@ -48,22 +48,7 @@ func (api *channellingAPI) HandleHello(session *channelling.Session, hello *chan
}
func (api *channellingAPI) HelloProcessed(sender channelling.Sender, session *channelling.Session, msg *channelling.DataIncoming, reply interface{}, err error) {
if err != nil {
return
}
// If user joined a server-managed conference room, send list of session ids to all participants.
if room, ok := api.RoomStatusManager.Get(session.Roomid); ok && room.GetType() == "Conference" {
if sessionids := room.SessionIDs(); len(sessionids) > 1 {
cid := session.Roomid
session.Broadcaster.Broadcast("", session.Roomid, &channelling.DataOutgoing{
To: cid,
Data: &channelling.DataConference{
Type: "Conference",
Id: cid,
Conference: sessionids,
},
})
}
if err == nil {
api.SendConferenceRoomUpdate(session)
}
}

23
go/channelling/api/handle_room.go

@ -33,3 +33,26 @@ func (api *channellingAPI) HandleRoom(session *channelling.Session, room *channe @@ -33,3 +33,26 @@ func (api *channellingAPI) HandleRoom(session *channelling.Session, room *channe
return room, err
}
func (api *channellingAPI) RoomProcessed(sender channelling.Sender, session *channelling.Session, msg *channelling.DataIncoming, reply interface{}, err error) {
if err == nil {
api.SendConferenceRoomUpdate(session)
}
}
func (api *channellingAPI) SendConferenceRoomUpdate(session *channelling.Session) {
// If user joined a server-managed conference room, send list of session ids to all participants.
if room, ok := api.RoomStatusManager.Get(session.Roomid); ok && room.GetType() == "Conference" {
if sessionids := room.SessionIDs(); len(sessionids) > 1 {
cid := session.Roomid
session.Broadcaster.Broadcast("", session.Roomid, &channelling.DataOutgoing{
To: cid,
Data: &channelling.DataConference{
Type: "Conference",
Id: cid,
Conference: sessionids,
},
})
}
}
}

Loading…
Cancel
Save