handle user_left_voice_message. Implemented a function updateVoiceUser where we will reuse some code
This commit is contained in:
parent
dd4615f573
commit
7df7e19dde
@ -195,6 +195,10 @@ class Meteor.RedisPubSub
|
||||
Meteor.Users.update({_id:u._id}, {$set: {'user.voiceUser.muted':message?.payload?.user?.voiceUser?.muted}})
|
||||
else console.log "ERROR!! did not find a matching user to mute!!"
|
||||
|
||||
if message.header?.name is 'user_left_voice_message'
|
||||
voiceUser = message.payload?.user?.voiceUser
|
||||
@updateVoiceUser(meetingId, voiceUser)
|
||||
|
||||
if message.header?.name is "get_all_meetings_reply"
|
||||
console.log "Let's store some data for the running meetings so that when an HTML5 client joins everything is ready!"
|
||||
listOfMeetings = message.payload?.meetings
|
||||
@ -351,6 +355,18 @@ class Meteor.RedisPubSub
|
||||
unless message.header?.name is "disconnect_all_users_message"
|
||||
Meteor.call("removeMeetingFromCollection", meetingId)
|
||||
|
||||
#update a voiceUser
|
||||
updateVoiceUser: (meetingId, voiceUserObject) ->
|
||||
console.log "I am updating the voiceUserObject with the following: " + JSON.stringify voiceUserObject
|
||||
u = Meteor.Users.findOne({userId: voiceUserObject?.userid, meetingId: meetingId})
|
||||
if u?
|
||||
Meteor.Users.update({_id:u._id}, {$set: {'user.voiceUser.talking':voiceUserObject?.talking}})# talking
|
||||
Meteor.Users.update({_id:u._id}, {$set: {'user.voiceUser.joined':voiceUserObject?.joined}})# joined
|
||||
Meteor.Users.update({_id:u._id}, {$set: {'user.voiceUser.locked':voiceUserObject?.locked}})# locked
|
||||
Meteor.Users.update({_id:u._id}, {$set: {'user.voiceUser.muted':voiceUserObject?.muted}})# muted
|
||||
else
|
||||
console.log "ERROR! did not find such voiceUser!"
|
||||
|
||||
# message should be an object
|
||||
publish: (channel, message) ->
|
||||
console.log "Publishing channel=#{channel}, message=#{JSON.stringify(message)}"
|
||||
|
Loading…
Reference in New Issue
Block a user