Mercurial > prosody-modules
comparison 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 |
comparison
equal
deleted
inserted
replaced
926:f88381a39c56 | 927:a9dfa7232d88 |
---|---|
94 | 94 |
95 function onConnect(status) { | 95 function onConnect(status) { |
96 if (status == Strophe.Status.CONNECTING) { | 96 if (status == Strophe.Status.CONNECTING) { |
97 log('Strophe is connecting.'); | 97 log('Strophe is connecting.'); |
98 } else if (status == Strophe.Status.CONNFAIL) { | 98 } else if (status == Strophe.Status.CONNFAIL) { |
99 alert('Connection failed (Wrong host?)'); | |
99 log('Strophe failed to connect.'); | 100 log('Strophe failed to connect.'); |
100 showConnect(); | 101 showConnect(); |
101 } else if (status == Strophe.Status.DISCONNECTING) { | 102 } else if (status == Strophe.Status.DISCONNECTING) { |
102 log('Strophe is disconnecting.'); | 103 log('Strophe is disconnecting.'); |
103 } else if (status == Strophe.Status.DISCONNECTED) { | 104 } else if (status == Strophe.Status.DISCONNECTED) { |
104 log('Strophe is disconnected.'); | 105 log('Strophe is disconnected.'); |
105 showConnect(); | 106 showConnect(); |
106 } else if (status == Strophe.Status.AUTHFAIL) { | 107 } else if (status == Strophe.Status.AUTHFAIL) { |
108 alert('Wrong username and/or password'); | |
107 log('Authentication failed'); | 109 log('Authentication failed'); |
108 if (connection) { | 110 if (connection) { |
109 connection.disconnect(); | 111 connection.disconnect(); |
110 } | 112 } |
111 } else if (status == Strophe.Status.CONNECTED) { | 113 } else if (status == Strophe.Status.CONNECTED) { |
118 alert("You are not an administrator"); | 120 alert("You are not an administrator"); |
119 connection.disconnect(); | 121 connection.disconnect(); |
120 return false; | 122 return false; |
121 } | 123 } |
122 for (i = 0; i < items.length; i++) { | 124 for (i = 0; i < items.length; i++) { |
123 $('#host').append('<option>' + $(items[i]).text() + '</option>'); | 125 var host = $(items[i]).text(); |
126 if (host == Strophe.getDomainFromJid(connection.jid)) { | |
127 $('#host').append('<option selected>' + host + '</option>'); | |
128 } else { | |
129 $('#host').append('<option>' + host + '</option>'); | |
130 } | |
124 } | 131 } |
125 showDisconnect(); | 132 showDisconnect(); |
126 adminsubHost = $(items[0]).text(); | 133 adminsubHost = $(items[0]).text(); |
127 adhocControl.checkFeatures(adminsubHost, | 134 adhocControl.checkFeatures(adminsubHost, |
128 function () { adhocControl.getCommandNodes(function (result) { $('#adhocDisplay').empty(); $('#adhocCommands').html(result); }) }, | 135 function () { adhocControl.getCommandNodes(function (result) { $('#adhocDisplay').empty(); $('#adhocCommands').html(result); }) }, |