Переглянути джерело

Displays error dialog when BOSH connection fails.

j8
paweldomas 10 роки тому
джерело
коміт
8af3a65d37
6 змінених файлів з 27697 додано та 27635 видалено
  1. 1
    1
      index.html
  2. 1
    0
      lang/main.json
  3. 27660
    27629
      libs/app.bundle.js
  4. 20
    1
      modules/UI/UI.js
  5. 14
    4
      modules/xmpp/xmpp.js
  6. 1
    0
      service/xmpp/XMPPEvents.js

+ 1
- 1
index.html Переглянути файл

19
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
19
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
20
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
20
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
21
     <script src="interface_config.js?v=5"></script>
21
     <script src="interface_config.js?v=5"></script>
22
-    <script src="libs/app.bundle.js?v=61"></script>
22
+    <script src="libs/app.bundle.js?v=62"></script>
23
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
23
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
24
     <link rel="stylesheet" href="css/font.css?v=7"/>
24
     <link rel="stylesheet" href="css/font.css?v=7"/>
25
     <link rel="stylesheet" href="css/toastr.css?v=1">
25
     <link rel="stylesheet" href="css/toastr.css?v=1">

+ 1
- 0
lang/main.json Переглянути файл

134
         "passwordError2": "This conversation isn't currently protected by a password. Only the owner of the conference could set a password.",
134
         "passwordError2": "This conversation isn't currently protected by a password. Only the owner of the conference could set a password.",
135
         "joinError": "Oops! We couldn't join the conference. There might be some problem with security configuration. Please contact service administrator.",
135
         "joinError": "Oops! We couldn't join the conference. There might be some problem with security configuration. Please contact service administrator.",
136
         "connectError": "Oops! Something went wrong and we couldn't connect to the conference.",
136
         "connectError": "Oops! Something went wrong and we couldn't connect to the conference.",
137
+        "connectErrorWithMsg": "Oops! Something went wrong and we couldn't connect to the conference: __msg__",
137
         "connecting": "Connecting",
138
         "connecting": "Connecting",
138
         "error": "Error",
139
         "error": "Error",
139
         "detectext": "Error when trying to detect desktopsharing extension.",
140
         "detectext": "Error when trying to detect desktopsharing extension.",

+ 27660
- 27629
libs/app.bundle.js
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 20
- 1
modules/UI/UI.js Переглянути файл

77
     }
77
     }
78
 }
78
 }
79
 
79
 
80
+function onXmppConnectionFailed(stropheErrorMsg) {
81
+
82
+    var title = APP.translation.generateTranslatonHTML(
83
+        "dialog.error");
84
+
85
+    var message;
86
+    if (stropheErrorMsg) {
87
+        message = APP.translation.generateTranslatonHTML(
88
+            "dialog.connectErrorWithMsg", {msg: stropheErrorMsg});
89
+    } else {
90
+        message = APP.translation.generateTranslatonHTML(
91
+            "dialog.connectError");
92
+    }
93
+
94
+    messageHandler.openDialog(
95
+        title, message, true, {}, function (e, v, m, f) { return false; });
96
+}
97
+
80
 function onDisposeConference(unload) {
98
 function onDisposeConference(unload) {
81
     Toolbar.showAuthenticateButton(false);
99
     Toolbar.showAuthenticateButton(false);
82
-};
100
+}
83
 
101
 
84
 function onDisplayNameChanged(jid, displayName) {
102
 function onDisplayNameChanged(jid, displayName) {
85
     ContactList.onDisplayNameChange(jid, displayName);
103
     ContactList.onDisplayNameChange(jid, displayName);
149
         VideoLayout.updateConnectionStats);
167
         VideoLayout.updateConnectionStats);
150
     APP.connectionquality.addListener(CQEvents.STOP,
168
     APP.connectionquality.addListener(CQEvents.STOP,
151
         VideoLayout.onStatsStop);
169
         VideoLayout.onStatsStop);
170
+    APP.xmpp.addListener(XMPPEvents.CONNECTION_FAILED, onXmppConnectionFailed);
152
     APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
171
     APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
153
     APP.xmpp.addListener(XMPPEvents.GRACEFUL_SHUTDOWN, function () {
172
     APP.xmpp.addListener(XMPPEvents.GRACEFUL_SHUTDOWN, function () {
154
         messageHandler.openMessageDialog(
173
         messageHandler.openMessageDialog(

+ 14
- 4
modules/xmpp/xmpp.js Переглянути файл

42
     }
42
     }
43
 
43
 
44
     var anonymousConnectionFailed = false;
44
     var anonymousConnectionFailed = false;
45
+    var wasConnected = false;
46
+    var lastErrorMsg;
45
     connection.connect(jid, password, function (status, msg) {
47
     connection.connect(jid, password, function (status, msg) {
46
         console.log('Strophe status changed to',
48
         console.log('Strophe status changed to',
47
-            Strophe.getStatusString(status));
49
+            Strophe.getStatusString(status), msg);
48
         if (status === Strophe.Status.CONNECTED) {
50
         if (status === Strophe.Status.CONNECTED) {
51
+
52
+            wasConnected = true;
53
+
49
             if (config.useStunTurn) {
54
             if (config.useStunTurn) {
50
                 connection.jingle.getStunAndTurnCredentials();
55
                 connection.jingle.getStunAndTurnCredentials();
51
             }
56
             }
52
 
57
 
53
             console.info("My Jabber ID: " + connection.jid);
58
             console.info("My Jabber ID: " + connection.jid);
54
 
59
 
55
-            if(password)
60
+            if (password)
56
                 authenticatedUser = true;
61
                 authenticatedUser = true;
57
             maybeDoJoin();
62
             maybeDoJoin();
58
         } else if (status === Strophe.Status.CONNFAIL) {
63
         } else if (status === Strophe.Status.CONNFAIL) {
59
-            if(msg === 'x-strophe-bad-non-anon-jid') {
64
+            if (msg === 'x-strophe-bad-non-anon-jid') {
60
                 anonymousConnectionFailed = true;
65
                 anonymousConnectionFailed = true;
61
             }
66
             }
67
+            lastErrorMsg = msg;
62
         } else if (status === Strophe.Status.DISCONNECTED) {
68
         } else if (status === Strophe.Status.DISCONNECTED) {
63
-            if(anonymousConnectionFailed) {
69
+            if (anonymousConnectionFailed) {
64
                 // prompt user for username and password
70
                 // prompt user for username and password
65
                 XMPP.promptLogin();
71
                 XMPP.promptLogin();
72
+            } else if (!wasConnected) {
73
+                eventEmitter.emit(
74
+                    XMPPEvents.CONNECTION_FAILED,
75
+                    msg ? msg : lastErrorMsg);
66
             }
76
             }
67
         } else if (status === Strophe.Status.AUTHFAIL) {
77
         } else if (status === Strophe.Status.AUTHFAIL) {
68
             // wrong password or username, prompt user
78
             // wrong password or username, prompt user

+ 1
- 0
service/xmpp/XMPPEvents.js Переглянути файл

1
 var XMPPEvents = {
1
 var XMPPEvents = {
2
+    CONNECTION_FAILED: "xmpp.connection.failed",
2
     CONFERENCE_CREATED: "xmpp.conferenceCreated.jingle",
3
     CONFERENCE_CREATED: "xmpp.conferenceCreated.jingle",
3
     CALL_TERMINATED: "xmpp.callterminated.jingle",
4
     CALL_TERMINATED: "xmpp.callterminated.jingle",
4
     CALL_INCOMING: "xmpp.callincoming.jingle",
5
     CALL_INCOMING: "xmpp.callincoming.jingle",

Завантаження…
Відмінити
Зберегти