diff mod_admin_web/admin_web/www_files/js/main.js @ 927:a9dfa7232d88

Merge
author Matthew Wild <mwild1@gmail.com>
date Tue, 12 Mar 2013 12:10:25 +0000
parents 1d03dc7cf28f
children 7cba8be42d9e
line wrap: on
line diff
--- a/mod_admin_web/admin_web/www_files/js/main.js	Thu Nov 22 18:59:10 2012 +0000
+++ b/mod_admin_web/admin_web/www_files/js/main.js	Tue Mar 12 12:10:25 2013 +0000
@@ -96,6 +96,7 @@
     if (status == Strophe.Status.CONNECTING) {
         log('Strophe is connecting.');
     } else if (status == Strophe.Status.CONNFAIL) {
+        alert('Connection failed (Wrong host?)');
         log('Strophe failed to connect.');
         showConnect();
     } else if (status == Strophe.Status.DISCONNECTING) {
@@ -104,6 +105,7 @@
         log('Strophe is disconnected.');
         showConnect();
     } else if (status == Strophe.Status.AUTHFAIL) {
+        alert('Wrong username and/or password');
         log('Authentication failed');
         if (connection) {
             connection.disconnect();
@@ -120,7 +122,12 @@
                     return false;
                 }
                 for (i = 0; i < items.length; i++) {
-                    $('#host').append('<option>' + $(items[i]).text() + '</option>');
+                    var host = $(items[i]).text();
+                    if (host == Strophe.getDomainFromJid(connection.jid)) {
+                        $('#host').append('<option selected>' + host + '</option>');
+                    } else {
+                        $('#host').append('<option>' + host + '</option>');
+                    }
                 }
                 showDisconnect();
                 adminsubHost = $(items[0]).text();