|
@@ -1,3 +1,4 @@
|
|
1
|
+/* global $, APP, config, Strophe*/
|
1
|
2
|
var Moderator = require("./moderator");
|
2
|
3
|
var EventEmitter = require("events");
|
3
|
4
|
var Recording = require("./recording");
|
|
@@ -11,26 +12,11 @@ var eventEmitter = new EventEmitter();
|
11
|
12
|
var connection = null;
|
12
|
13
|
var authenticatedUser = false;
|
13
|
14
|
|
14
|
|
-function connect(jid, password, uiCredentials) {
|
15
|
|
- var bosh
|
16
|
|
- = (uiCredentials && uiCredentials.bosh? uiCredentials.bosh : null)
|
17
|
|
- || config.bosh || '/http-bind';
|
|
15
|
+function connect(jid, password) {
|
|
16
|
+ var bosh = config.bosh || '/http-bind';
|
18
|
17
|
connection = new Strophe.Connection(bosh);
|
19
|
18
|
Moderator.setConnection(connection);
|
20
|
19
|
|
21
|
|
- if(uiCredentials) {
|
22
|
|
- var email = uiCredentials.email;
|
23
|
|
- var displayName = uiCredentials.displayName;
|
24
|
|
- if (email) {
|
25
|
|
- connection.emuc.addEmailToPresence(email);
|
26
|
|
- } else {
|
27
|
|
- connection.emuc.addUserIdToPresence(uiCredentials.uid);
|
28
|
|
- }
|
29
|
|
- if (displayName) {
|
30
|
|
- connection.emuc.addDisplayNameToPresence(displayName);
|
31
|
|
- }
|
32
|
|
- }
|
33
|
|
-
|
34
|
20
|
if (connection.disco) {
|
35
|
21
|
// for chrome, add multistream cap
|
36
|
22
|
}
|
|
@@ -42,9 +28,6 @@ function connect(jid, password, uiCredentials) {
|
42
|
28
|
connection.jingle.pc_constraints.optional.push({googIPv6: true});
|
43
|
29
|
}
|
44
|
30
|
|
45
|
|
- if(!password)
|
46
|
|
- password = uiCredentials.password;
|
47
|
|
-
|
48
|
31
|
var anonymousConnectionFailed = false;
|
49
|
32
|
connection.connect(jid, password, function (status, msg) {
|
50
|
33
|
console.log('Strophe status changed to',
|
|
@@ -53,7 +36,6 @@ function connect(jid, password, uiCredentials) {
|
53
|
36
|
if (config.useStunTurn) {
|
54
|
37
|
connection.jingle.getStunAndTurnCredentials();
|
55
|
38
|
}
|
56
|
|
- APP.UI.disableConnect();
|
57
|
39
|
|
58
|
40
|
console.info("My Jabber ID: " + connection.jid);
|
59
|
41
|
|
|
@@ -150,7 +132,7 @@ var XMPP = {
|
150
|
132
|
* @type {boolean}
|
151
|
133
|
*/
|
152
|
134
|
forceMuted: false,
|
153
|
|
- start: function (uiCredentials) {
|
|
135
|
+ start: function () {
|
154
|
136
|
setupEvents();
|
155
|
137
|
initStrophePlugins();
|
156
|
138
|
registerListeners();
|
|
@@ -161,8 +143,8 @@ var XMPP = {
|
161
|
143
|
window.location.search.indexOf("login=true") !== -1) {
|
162
|
144
|
configDomain = config.hosts.domain;
|
163
|
145
|
}
|
164
|
|
- var jid = uiCredentials.jid || configDomain || window.location.hostname;
|
165
|
|
- connect(jid, null, uiCredentials);
|
|
146
|
+ var jid = configDomain || window.location.hostname;
|
|
147
|
+ connect(jid, null);
|
166
|
148
|
},
|
167
|
149
|
promptLogin: function () {
|
168
|
150
|
APP.UI.showLoginPopup(connect);
|