Inlines a method for clarity/simplicity.

This commit is contained in:
Boris Grozev 2015-07-30 10:44:18 -05:00
parent cc20a4d776
commit 57b9aeb38c
1 changed files with 12 additions and 17 deletions

View File

@ -6,22 +6,6 @@ var RTCBrowserType = require("../RTC/RTCBrowserType");
module.exports = function(XMPP, eventEmitter) { module.exports = function(XMPP, eventEmitter) {
function CallIncomingJingle(sid, connection) {
var sess = connection.jingle.sessions[sid];
// TODO: do we check activecall == null?
connection.jingle.activecall = sess;
eventEmitter.emit(XMPPEvents.CALL_INCOMING, sess);
// TODO: check affiliation and/or role
console.log('emuc data for', sess.peerjid, connection.emuc.members[sess.peerjid]);
sess.usedrip = true; // not-so-naive trickle ice
sess.sendAnswer();
sess.accept();
}
Strophe.addConnectionPlugin('jingle', { Strophe.addConnectionPlugin('jingle', {
connection: null, connection: null,
sessions: {}, sessions: {},
@ -136,7 +120,18 @@ module.exports = function(XMPP, eventEmitter) {
// the callback should either // the callback should either
// .sendAnswer and .accept // .sendAnswer and .accept
// or .sendTerminate -- not necessarily synchronus // or .sendTerminate -- not necessarily synchronus
CallIncomingJingle(sess.sid, this.connection);
// TODO: do we check activecall == null?
this.connection.jingle.activecall = sess;
eventEmitter.emit(XMPPEvents.CALL_INCOMING, sess);
// TODO: check affiliation and/or role
console.log('emuc data for', sess.peerjid,
this.connection.emuc.members[sess.peerjid]);
sess.usedrip = true; // not-so-naive trickle ice
sess.sendAnswer();
sess.accept();
break; break;
case 'session-accept': case 'session-accept':
sess.setRemoteDescription($(iq).find('>jingle'), 'answer'); sess.setRemoteDescription($(iq).find('>jingle'), 'answer');