# HG changeset patch
# User Emmanuel Gil Peyrot
# Date 1545443969 -3600
# Node ID 5e97e1808a35b00e397e0aa8c46379279c6ca711
# Parent 5aa1bf7154b0d206bc6e9c41376ad16c827f6d7e
Add support for the roster.
diff --git a/client.js b/client.js
--- a/client.js
+++ b/client.js
@@ -76,16 +76,12 @@ document.addEventListener('DOMContentLoa
pass_element.disabled = true;
} else if (status == Strophe.Status.CONNFAIL) {
console.log('Strophe failed to connect.');
- connect_button.value = 'connect';
- jid_element.disabled = false;
- pass_element.disabled = false;
+ onDisconnected();
} else if (status == Strophe.Status.DISCONNECTING) {
console.log('Strophe is disconnecting.');
} else if (status == Strophe.Status.DISCONNECTED) {
console.log('Strophe is disconnected.');
- connect_button.value = 'connect';
- jid_element.disabled = false;
- pass_element.disabled = false;
+ onDisconnected();
} else if (status == Strophe.Status.CONNECTED) {
console.log('Strophe is connected.');
onConnected();
@@ -95,8 +91,22 @@ document.addEventListener('DOMContentLoa
function onConnected()
{
connected_div.hidden = false;
+ initRoster(connection);
initPEP(connection);
initNickname(connection);
initAvatar(connection);
}
+
+ function onDisconnected()
+ {
+ connect_button.value = 'connect';
+ jid_element.disabled = false;
+ pass_element.disabled = false;
+ for (let item of document.getElementById('roster-table')) {
+ item.remove();
+ }
+ for (let item of document.getElementById('pep-table')) {
+ item.remove();
+ }
+ }
});
diff --git a/index.xhtml b/index.xhtml
--- a/index.xhtml
+++ b/index.xhtml
@@ -62,6 +62,13 @@
+Contact list
+
+
+JID | Name | Subscription | Groups | ⚠️ Delete |
+
+
+
PEP