comparison plugins/pubsub.js @ 80:50d36b093e3a

Lightstring.namespaces/NS has been renamed by Lightstring.ns.
author Sonny Piers <sonny.piers@gmail.com>
date Tue, 07 Feb 2012 18:42:09 +0100
parents 619f3ffa125a
children 7500bc048dbc
comparison
equal deleted inserted replaced
79:2290321f5c8b 80:50d36b093e3a
30 pubsub_event: "http://jabber.org/protocol/pubsub#event", 30 pubsub_event: "http://jabber.org/protocol/pubsub#event",
31 pubsub_error: "http://jabber.org/protocol/pubsub#error" 31 pubsub_error: "http://jabber.org/protocol/pubsub#error"
32 }, 32 },
33 stanzas: { 33 stanzas: {
34 getConfig: function(aTo, aNode) { 34 getConfig: function(aTo, aNode) {
35 return "<iq type='get' to='" + aTo + "'><pubsub xmlns='" + Lightstring.NS.pubsub_owner + "'><configure node='" + aNode + "'/></pubsub></iq>"; 35 return "<iq type='get' to='" + aTo + "'><pubsub xmlns='" + Lightstring.ns.pubsub_owner + "'><configure node='" + aNode + "'/></pubsub></iq>";
36 }, 36 },
37 items: function(aTo, aNode) { 37 items: function(aTo, aNode) {
38 return "<iq type='get' to='" + aTo + "'><pubsub xmlns='" + Lightstring.NS.pubsub + "'><items node='" + aNode + "'/></pubsub></iq>"; 38 return "<iq type='get' to='" + aTo + "'><pubsub xmlns='" + Lightstring.ns.pubsub + "'><items node='" + aNode + "'/></pubsub></iq>";
39 }, 39 },
40 affiliations: function(aTo, aNode) { 40 affiliations: function(aTo, aNode) {
41 return "<iq type='get' to='" + aTo + "'><pubsub xmlns='" + Lightstring.NS.pubsub_owner + "'><affiliations node='" + aNode + "'/></pubsub></iq>"; 41 return "<iq type='get' to='" + aTo + "'><pubsub xmlns='" + Lightstring.ns.pubsub_owner + "'><affiliations node='" + aNode + "'/></pubsub></iq>";
42 }, 42 },
43 publish: function(aTo, aNode, aItem, aId) { 43 publish: function(aTo, aNode, aItem, aId) {
44 return "<iq type='set' to='" + aTo + "'><pubsub xmlns='" + Lightstring.NS.pubsub + "'><publish node='" + aNode + "'><item id='" + aId + "'>" + aItem + "</item></publish></pubsub></iq>"; 44 return "<iq type='set' to='" + aTo + "'><pubsub xmlns='" + Lightstring.ns.pubsub + "'><publish node='" + aNode + "'><item id='" + aId + "'>" + aItem + "</item></publish></pubsub></iq>";
45 }, 45 },
46 retract: function(aTo, aNode, aItem) { 46 retract: function(aTo, aNode, aItem) {
47 return "<iq type='set' to='" + aTo + "'><pubsub xmlns='" + Lightstring.NS.pubsub + "'><retract node='" + aNode + "'><item id='" + aItem + "'/></retract></pubsub></iq>"; 47 return "<iq type='set' to='" + aTo + "'><pubsub xmlns='" + Lightstring.ns.pubsub + "'><retract node='" + aNode + "'><item id='" + aItem + "'/></retract></pubsub></iq>";
48 }, 48 },
49 'delete': function(aTo, aNode, aURI) { 49 'delete': function(aTo, aNode, aURI) {
50 return "<iq type='set' to='" + aTo + "'><pubsub xmlns='" + Lightstring.NS.pubsub_owner + "'><delete node='" + aNode + "'/></pubsub></iq>"; 50 return "<iq type='set' to='" + aTo + "'><pubsub xmlns='" + Lightstring.ns.pubsub_owner + "'><delete node='" + aNode + "'/></pubsub></iq>";
51 }, 51 },
52 create: function(aTo, aNode, aFields) { 52 create: function(aTo, aNode, aFields) {
53 var iq = "<iq type='set' to='" + aTo + "'><pubsub xmlns='" + Lightstring.NS.pubsub + "'><create node='" + aNode + "'/>"; 53 var iq = "<iq type='set' to='" + aTo + "'><pubsub xmlns='" + Lightstring.ns.pubsub + "'><create node='" + aNode + "'/>";
54 if (aFields) { 54 if (aFields) {
55 iq += "<configure><x xmlns='" + Lightstring.NS.x + "' type='submit'>" 55 iq += "<configure><x xmlns='" + Lightstring.ns.x + "' type='submit'>"
56 aFields.forEach(function(field) { 56 aFields.forEach(function(field) {
57 iq += field; 57 iq += field;
58 }); 58 });
59 iq += "</x></configure>"; 59 iq += "</x></configure>";
60 } 60 }
61 iq += "</pubsub></iq>"; 61 iq += "</pubsub></iq>";
62 return iq; 62 return iq;
63 }, 63 },
64 setAffiliations: function(aTo, aNode, aAffiliations) { 64 setAffiliations: function(aTo, aNode, aAffiliations) {
65 var iq = "<iq type='set' to='" + aTo + "'><pubsub xmlns='" + Lightstring.NS.pubsub_owner + "'><affiliations node='" + aNode + "'>"; 65 var iq = "<iq type='set' to='" + aTo + "'><pubsub xmlns='" + Lightstring.ns.pubsub_owner + "'><affiliations node='" + aNode + "'>";
66 for (var i = 0; i < aAffiliations.length; i++) 66 for (var i = 0; i < aAffiliations.length; i++)
67 iq += "<affiliation jid='" + aAffiliations[i][0] + "' affiliation='" + aAffiliations[i][1] + "'/>"; 67 iq += "<affiliation jid='" + aAffiliations[i][0] + "' affiliation='" + aAffiliations[i][1] + "'/>";
68 iq += "</affiliations></pubsub></iq>"; 68 iq += "</affiliations></pubsub></iq>";
69 return iq; 69 return iq;
70 }, 70 },