parent
25fe06396f
commit
52ec203789
@ -1,5 +0,0 @@ |
||||
Meteor.methods({ |
||||
'jitsi:connect': (rid) => { |
||||
RocketChat.models.Rooms.addJitsiConnected(rid, Meteor.userId()); |
||||
} |
||||
}); |
||||
@ -1,5 +0,0 @@ |
||||
Meteor.methods({ |
||||
'jitsi:disconnect': (rid) => { |
||||
RocketChat.models.Rooms.removeJitsiConnected(rid, Meteor.userId()); |
||||
} |
||||
}); |
||||
@ -0,0 +1,17 @@ |
||||
Meteor.methods({ |
||||
'jitsi:isActive': (rid) => { |
||||
console.log('Checking if active', rid); |
||||
let room = RocketChat.models.Rooms.findOne({_id: rid}); |
||||
let currentTime = new Date().getTime(); |
||||
|
||||
if (room.jitsiTimeout !== undefined) { |
||||
if (currentTime > new Date(room.jitsiTimeout).getTime()) { |
||||
return true; |
||||
} else { |
||||
return false; |
||||
} |
||||
} else { |
||||
return false; |
||||
} |
||||
} |
||||
}); |
||||
@ -0,0 +1,23 @@ |
||||
|
||||
Meteor.methods({ |
||||
'jitsi:updateTimeout': (rid) => { |
||||
console.log('jitsi:updateTimeout called!') |
||||
let room = RocketChat.models.Rooms.findOne({_id: rid}); |
||||
let currentTime = new Date().getTime(); |
||||
|
||||
let jitsiTimeout = new Date(room.jitsiTimeout || currentTime).getTime(); |
||||
|
||||
let diff = jitsiTimeout - currentTime; |
||||
|
||||
console.log('Timeout: '+jitsiTimeout +' currentTime: ' + currentTime); |
||||
console.log('diff between currentTime and Timeout: '+diff); |
||||
|
||||
if (jitsiTimeout <= currentTime) { |
||||
console.log('call has not been started yet...'); |
||||
RocketChat.models.Rooms.setJitsiTimeout(rid, new Date(currentTime + 30*1000)); |
||||
} else if ((jitsiTimeout - currentTime) < 10) { |
||||
console.log('updating timestamp'); |
||||
RocketChat.models.Rooms.setJitsiTimeout(rid, new Date(currentTime + 20*1000)); |
||||
} |
||||
} |
||||
}); |
||||
Loading…
Reference in new issue