const BOSH_SERVICE = '/http-bind/' let show_log = false Strophe.addNamespace('C2SSTREAM', 'http://prosody.im/streams/c2s') Strophe.addNamespace('S2SSTREAM', 'http://prosody.im/streams/s2s') Strophe.addNamespace('ADMINSUB', 'http://prosody.im/adminsub') Strophe.addNamespace('CAPS', 'http://jabber.org/protocol/caps') let localJID = null let connection = null let adminsubHost = null let adhocControl = new Adhoc('#adhocDisplay', function () {}) function log (msg) { let entry = $('
').append(document.createTextNode(msg)) $('#log').append(entry) } function rawInput (data) { log('RECV: ' + data) } function rawOutput (data) { log('SENT: ' + data) } function _cbNewS2S (e) { let items = e.getElementsByTagName('item') for (let i = 0; i < items.length; i++) { let item = items[i] let id = item.attributes.getNamedItem('id').value let jid = item.getElementsByTagName('session')[0].attributes.getNamedItem('jid').value let infos = item.getElementsByTagName('info') let entry = $(`
  • ${jid}
  • `) let tmp = item.getElementsByTagName('encrypted')[0] if (tmp) { if (tmp.getElementsByTagName('valid')[0]) { entry.append(' (secure) (encrypted)') } else { entry.append(' (encrypted)') } } if (item.getElementsByTagName('compressed')[0]) { entry.append(' (compressed)') } let metadata = $('