Browse Source

Displays error dialog when BOSH connection fails.

j8
paweldomas 10 years ago
parent
commit
8af3a65d37
6 changed files with 27697 additions and 27635 deletions
  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 View File

@@ -19,7 +19,7 @@
19 19
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
20 20
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
21 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 23
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
24 24
     <link rel="stylesheet" href="css/font.css?v=7"/>
25 25
     <link rel="stylesheet" href="css/toastr.css?v=1">

+ 1
- 0
lang/main.json View File

@@ -134,6 +134,7 @@
134 134
         "passwordError2": "This conversation isn't currently protected by a password. Only the owner of the conference could set a password.",
135 135
         "joinError": "Oops! We couldn't join the conference. There might be some problem with security configuration. Please contact service administrator.",
136 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 138
         "connecting": "Connecting",
138 139
         "error": "Error",
139 140
         "detectext": "Error when trying to detect desktopsharing extension.",

+ 27660
- 27629
libs/app.bundle.js
File diff suppressed because it is too large
View File


+ 20
- 1
modules/UI/UI.js View File

@@ -77,9 +77,27 @@ function streamHandler(stream, isMuted) {
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 98
 function onDisposeConference(unload) {
81 99
     Toolbar.showAuthenticateButton(false);
82
-};
100
+}
83 101
 
84 102
 function onDisplayNameChanged(jid, displayName) {
85 103
     ContactList.onDisplayNameChange(jid, displayName);
@@ -149,6 +167,7 @@ function registerListeners() {
149 167
         VideoLayout.updateConnectionStats);
150 168
     APP.connectionquality.addListener(CQEvents.STOP,
151 169
         VideoLayout.onStatsStop);
170
+    APP.xmpp.addListener(XMPPEvents.CONNECTION_FAILED, onXmppConnectionFailed);
152 171
     APP.xmpp.addListener(XMPPEvents.DISPOSE_CONFERENCE, onDisposeConference);
153 172
     APP.xmpp.addListener(XMPPEvents.GRACEFUL_SHUTDOWN, function () {
154 173
         messageHandler.openMessageDialog(

+ 14
- 4
modules/xmpp/xmpp.js View File

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

+ 1
- 0
service/xmpp/XMPPEvents.js View File

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

Loading…
Cancel
Save