Mercurial > xmpp-account-manager
comparison client.js @ 4:5e97e1808a35
Add support for the roster.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 22 Dec 2018 02:59:29 +0100 |
parents | 5aa1bf7154b0 |
children | cd0434bb2eb1 |
comparison
equal
deleted
inserted
replaced
3:5aa1bf7154b0 | 4:5e97e1808a35 |
---|---|
74 connect_button.value = 'disconnect'; | 74 connect_button.value = 'disconnect'; |
75 jid_element.disabled = true; | 75 jid_element.disabled = true; |
76 pass_element.disabled = true; | 76 pass_element.disabled = true; |
77 } else if (status == Strophe.Status.CONNFAIL) { | 77 } else if (status == Strophe.Status.CONNFAIL) { |
78 console.log('Strophe failed to connect.'); | 78 console.log('Strophe failed to connect.'); |
79 connect_button.value = 'connect'; | 79 onDisconnected(); |
80 jid_element.disabled = false; | |
81 pass_element.disabled = false; | |
82 } else if (status == Strophe.Status.DISCONNECTING) { | 80 } else if (status == Strophe.Status.DISCONNECTING) { |
83 console.log('Strophe is disconnecting.'); | 81 console.log('Strophe is disconnecting.'); |
84 } else if (status == Strophe.Status.DISCONNECTED) { | 82 } else if (status == Strophe.Status.DISCONNECTED) { |
85 console.log('Strophe is disconnected.'); | 83 console.log('Strophe is disconnected.'); |
86 connect_button.value = 'connect'; | 84 onDisconnected(); |
87 jid_element.disabled = false; | |
88 pass_element.disabled = false; | |
89 } else if (status == Strophe.Status.CONNECTED) { | 85 } else if (status == Strophe.Status.CONNECTED) { |
90 console.log('Strophe is connected.'); | 86 console.log('Strophe is connected.'); |
91 onConnected(); | 87 onConnected(); |
92 } | 88 } |
93 } | 89 } |
94 | 90 |
95 function onConnected() | 91 function onConnected() |
96 { | 92 { |
97 connected_div.hidden = false; | 93 connected_div.hidden = false; |
94 initRoster(connection); | |
98 initPEP(connection); | 95 initPEP(connection); |
99 initNickname(connection); | 96 initNickname(connection); |
100 initAvatar(connection); | 97 initAvatar(connection); |
101 } | 98 } |
99 | |
100 function onDisconnected() | |
101 { | |
102 connect_button.value = 'connect'; | |
103 jid_element.disabled = false; | |
104 pass_element.disabled = false; | |
105 for (let item of document.getElementById('roster-table')) { | |
106 item.remove(); | |
107 } | |
108 for (let item of document.getElementById('pep-table')) { | |
109 item.remove(); | |
110 } | |
111 } | |
102 }); | 112 }); |