Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
matrix-react-sdk
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Matrix.org
matrix-react-sdk
Commits
cb89d376
Commit
cb89d376
authored
9 years ago
by
David Baker
Browse files
Options
Downloads
Patches
Plain Diff
Hacks to make sure we don't end up with multiple split-brain CallHandlers when npm linked.
parent
b68665ea
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/CallHandler.js
+21
-8
21 additions, 8 deletions
src/CallHandler.js
with
21 additions
and
8 deletions
src/CallHandler.js
+
21
−
8
View file @
cb89d376
...
...
@@ -58,9 +58,10 @@ var Matrix = require("matrix-js-sdk");
var
dis
=
require
(
"
./dispatcher
"
);
var
Modulator
=
require
(
"
./Modulator
"
);
var
c
alls
=
{
global
.
mxC
alls
=
{
//room_id: MatrixCall
};
var
calls
=
global
.
mxCalls
;
function
play
(
audioId
)
{
// TODO: Attach an invisible element for this instead
...
...
@@ -149,7 +150,7 @@ function _setCallState(call, roomId, status) {
});
}
dis
.
register
(
fun
ction
(
payload
)
{
function
_onA
ction
(
payload
)
{
function
placeCall
(
newCall
)
{
_setCallListeners
(
newCall
);
_setCallState
(
newCall
,
newCall
.
roomId
,
"
ringback
"
);
...
...
@@ -217,10 +218,9 @@ dis.register(function(payload) {
});
}
else
{
var
ConferenceHandler
=
Modulator
.
getConferenceHandler
();
var
confCall
=
ConferenceHandler
.
createNewMatrixCall
(
ConferenceHandler
.
createNewMatrixCall
(
MatrixClientPeg
.
get
(),
payload
.
room_id
);
confCall
.
setup
().
done
(
function
(
call
)
{
).
done
(
function
(
call
)
{
placeCall
(
call
);
},
function
(
err
)
{
console
.
error
(
"
Failed to setup conference call: %s
"
,
err
);
...
...
@@ -255,10 +255,14 @@ dis.register(function(payload) {
});
break
;
}
});
module
.
exports
=
{
}
// FIXME: Nasty way of making sure we only register
// with the dispatcher once
if
(
!
global
.
mxCallHandler
)
{
dis
.
register
(
_onAction
);
}
var
callHandler
=
{
getCallForRoom
:
function
(
roomId
)
{
return
(
module
.
exports
.
getCall
(
roomId
)
...
...
@@ -280,3 +284,12 @@ module.exports = {
return
null
;
}
};
// Only things in here which actually need to be global are the
// calls list (done separately) and making sure we only register
// with the dispatcher once (which uses this mechanism but checks
// separately). This could be tidied up.
if
(
global
.
mxCallHandler
===
undefined
)
{
global
.
mxCallHandler
=
callHandler
;
}
module
.
exports
=
global
.
mxCallHandler
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment