comparison lightstring.js @ 50:770bb8460df8

Some improvements on namespaces.
author Sonny Piers <sonny.piers@gmail.com>
date Wed, 01 Feb 2012 03:12:14 +0100
parents 3dfb596cf669
children 63c1c8bc8c19
comparison
equal deleted inserted replaced
49:e25dfe389dab 50:770bb8460df8
21 * @namespace No code from lightstring should be callable outside this namespace/scope. 21 * @namespace No code from lightstring should be callable outside this namespace/scope.
22 */ 22 */
23 var Lightstring = { 23 var Lightstring = {
24 /** 24 /**
25 * @namespace Holds XMPP namespaces. 25 * @namespace Holds XMPP namespaces.
26 * @description http://xmpp.org/xmpp-protocols/protocol-namespaces
26 */ 27 */
27 ns: { 28 ns: {
28 stream: 'http://etherx.jabber.org/streams', 29 streams: 'http://etherx.jabber.org/streams',
29 jabberClient: 'jabber:client' 30 jabber_client: 'jabber:client'
30 }, 31 },
31 /** 32 /**
32 * @namespace Holds XMPP stanza builders. 33 * @namespace Holds XMPP stanza builders.
33 */ 34 */
34 stanzas: { 35 stanzas: {
35 stream: { 36 stream: {
36 open: function(aService) { 37 open: function(aService) {
37 //FIXME no ending "/" - node-xmpp-bosh bug 38 //FIXME no ending "/" - node-xmpp-bosh bug
38 return "<stream:stream to='" + aService + "'" + 39 return "<stream:stream to='" + aService + "'" +
39 " xmlns='" + Lightstring.ns.jabberClient + "'" + 40 " xmlns='" + Lightstring.ns['jabber_client'] + "'" +
40 " xmlns:stream='" + Lightstring.ns.stream + "'" + 41 " xmlns:stream='" + Lightstring.ns.['streams'] + "'" +
41 " version='1.0'/>"; 42 " version='1.0'/>";
42 }, 43 },
43 close: function() { 44 close: function() {
44 return "</stream:stream>"; 45 return "</stream:stream>";
45 } 46 }