comparison mod_admin_web/admin_web/www_files/js/main.js @ 292:a9e69088e678

mod_adhoc_web: Put pubsubHost into js from lua. Compat with util.pubsub changes
author Florian Zeitz <florob@babelmonkeys.de>
date Thu, 23 Dec 2010 21:16:31 +0100
parents 9233d7ee3c09
children 5a619d6045a8
comparison
equal deleted inserted replaced
291:94fab3c0a7aa 292:a9e69088e678
6 Strophe.addNamespace('CAPS', 'http://jabber.org/protocol/caps'); 6 Strophe.addNamespace('CAPS', 'http://jabber.org/protocol/caps');
7 7
8 var localJID = null; 8 var localJID = null;
9 var connection = null; 9 var connection = null;
10 10
11 var pubsubHost = null; /* TODO: Replace this inside Lua */ 11 var pubsubHost = '%PUBSUBHOST%';
12 12
13 function log(msg) { 13 function log(msg) {
14 var entry = $('<div></div>').append(document.createTextNode(msg)); 14 var entry = $('<div></div>').append(document.createTextNode(msg));
15 $('#log').append(entry); 15 $('#log').append(entry);
16 } 16 }
60 connection.disconnect(); 60 connection.disconnect();
61 } 61 }
62 } else if (status == Strophe.Status.CONNECTED) { 62 } else if (status == Strophe.Status.CONNECTED) {
63 log('Strophe is connected.'); 63 log('Strophe is connected.');
64 showDisconnect(); 64 showDisconnect();
65 pubsubHost = 'pubsub.' + connection.domain;
66 connection.send($iq({to: pubsubHost, type: 'set', id: connection.getUniqueId()}).c('pubsub', {xmlns: Strophe.NS.PUBSUB}) 65 connection.send($iq({to: pubsubHost, type: 'set', id: connection.getUniqueId()}).c('pubsub', {xmlns: Strophe.NS.PUBSUB})
67 .c('subscribe', {node: Strophe.NS.S2SPUBSUB, jid: connection.jid})); 66 .c('subscribe', {node: Strophe.NS.S2SPUBSUB, jid: connection.jid}));
68 connection.addHandler(_cbNewS2S, Strophe.NS.PUBSUB + '#event', 'message'); 67 connection.addHandler(_cbNewS2S, Strophe.NS.PUBSUB + '#event', 'message');
69 connection.sendIQ($iq({to: pubsubHost, type: 'get', id: connection.getUniqueId()}).c('pubsub', {xmlns: Strophe.NS.PUBSUB}) 68 connection.sendIQ($iq({to: pubsubHost, type: 'get', id: connection.getUniqueId()}).c('pubsub', {xmlns: Strophe.NS.PUBSUB})
70 .c('items', {node: Strophe.NS.S2SPUBSUB}), _cbNewS2S); 69 .c('items', {node: Strophe.NS.S2SPUBSUB}), _cbNewS2S);