Mercurial > eldonilo > lightstring
comparison plugins.js @ 28:630b9579fe4a
merge fixing
author | Sonny Piers <sonny.piers@gmail.com> |
---|---|
date | Sat, 28 Jan 2012 01:34:32 +0100 |
parents | b6e4bc19ff5a |
children |
comparison
equal
deleted
inserted
replaced
27:b6e4bc19ff5a | 28:630b9579fe4a |
---|---|
186 ////////// | 186 ////////// |
187 Lightstring.NS.x = "jabber:x:data"; | 187 Lightstring.NS.x = "jabber:x:data"; |
188 Lightstring.NS.pubsub = "http://jabber.org/protocol/pubsub"; | 188 Lightstring.NS.pubsub = "http://jabber.org/protocol/pubsub"; |
189 Lightstring.NS.pubsub_owner = "http://jabber.org/protocol/pubsub#owner"; | 189 Lightstring.NS.pubsub_owner = "http://jabber.org/protocol/pubsub#owner"; |
190 Lightstring.stanza.pubsub = { | 190 Lightstring.stanza.pubsub = { |
191 <<<<<<< HEAD | |
192 getConfig: function(aTo, aNode) { | |
193 return "<iq type='get' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub_owner+"'><configure node='"+aNode+"'/></pubsub></iq>"; | |
194 }, | |
195 items: function(aTo, aNode) { | |
196 return "<iq type='get' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub+"'><items node='"+aNode+"'/></pubsub></iq>"; | |
197 }, | |
198 affiliations: function(aTo, aNode) { | |
199 return "<iq type='get' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub_owner+"'><affiliations node='"+aNode+"'/></pubsub></iq>"; | |
200 }, | |
201 publish: function(aTo, aNode, aItem, aId) { | |
202 return "<iq type='set' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub+"'><publish node='"+aNode+"'><item id='"+aId+"'>"+aItem+"</item></publish></pubsub></iq>"; | |
203 }, | |
204 retract: function(aTo, aNode, aItem) { | |
205 return "<iq type='set' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub+"'><retract node='"+aNode+"'><item id='"+aItem+"'/></retract></pubsub></iq>"; | |
206 }, | |
207 'delete': function(aTo, aNode, aURI) { | |
208 return "<iq type='set' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub_owner+"'><delete node='"+aNode+"'/></pubsub></iq>"; | |
209 }, | |
210 config: function(aTo, aNode, aFields) { | |
211 var iq = "<iq type='set' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub+"'><configure node='"+aNode+"'><x xmlns='"+Lightstring.NS.x+"' type='submit'>"; | |
212 if(aFields) { | |
213 aFields.forEach(function(field) { | |
214 iq += field; | |
215 }); | |
216 } | |
217 iq += "</x></configure></pubsub></iq>"; | |
218 return iq; | |
219 }, | |
220 create: function(aTo, aNode, aFields) { | |
221 var iq = "<iq type='set' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub+"'><create node='"+aNode+"'/>"; | |
222 if(aFields) { | |
223 iq += "<configure><x xmlns='"+Lightstring.NS.x+"' type='submit'>" | |
224 aFields.forEach(function(field) { | |
225 iq += field; | |
226 }); | |
227 iq += "</x></configure>"; | |
228 } | |
229 iq += "</pubsub></iq>"; | |
230 return iq; | |
231 }, | |
232 setAffiliations: function(aTo, aNode, aAffiliations) { | |
233 var iq = "<iq type='set' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub_owner+"'><affiliations node='"+aNode+"'>"; | |
234 for(var i = 0; i < aAffiliations.length; i++) { | |
235 iq += "<affiliation jid='"+aAffiliations[i][0]+"' affiliation='"+aAffiliations[i][1]+"'/>" | |
236 } | |
237 iq += "</affiliations></pubsub></iq>"; | |
238 return iq; | |
239 }, | |
240 ======= | |
241 getConfig: function(aTo, aNode) { | 191 getConfig: function(aTo, aNode) { |
242 return "<iq type='get' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub_owner+"'><configure node='"+aNode+"'/></pubsub></iq>"; | 192 return "<iq type='get' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub_owner+"'><configure node='"+aNode+"'/></pubsub></iq>"; |
243 }, | 193 }, |
244 items: function(aTo, aNode) { | 194 items: function(aTo, aNode) { |
245 return "<iq type='get' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub+"'><items node='"+aNode+"'/></pubsub></iq>"; | 195 return "<iq type='get' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub+"'><items node='"+aNode+"'/></pubsub></iq>"; |
274 iq += "<affiliation jid='"+aAffiliations[i][0]+"' affiliation='"+aAffiliations[i][1]+"'/>" | 224 iq += "<affiliation jid='"+aAffiliations[i][0]+"' affiliation='"+aAffiliations[i][1]+"'/>" |
275 } | 225 } |
276 iq += "</affiliations></pubsub></iq>"; | 226 iq += "</affiliations></pubsub></iq>"; |
277 return iq; | 227 return iq; |
278 }, | 228 }, |
279 >>>>>>> f6a7c0f93d154c2cd34dfdda4ab8eec808b91b34 | |
280 }; | 229 }; |
281 Lightstring.pubsubItems = function(aConnection, aTo, aNode, aCallback) { | 230 Lightstring.pubsubItems = function(aConnection, aTo, aNode, aCallback) { |
282 aConnection.send(Lightstring.stanza.pubsub.items(aTo, aNode), function(answer){ | 231 aConnection.send(Lightstring.stanza.pubsub.items(aTo, aNode), function(answer){ |
283 var items = []; | 232 var items = []; |
284 var elms = answer.querySelectorAll('item'); | 233 var elms = answer.querySelectorAll('item'); |