Mercurial > eldonilo > lightstring
changeset 27:b6e4bc19ff5a
undoing
author | Sonny Piers <sonny.piers@gmail.com> |
---|---|
date | Sat, 28 Jan 2012 01:27:00 +0100 |
parents | fc577e5b2f4a (diff) 82bffc4a07a9 (current diff) |
children | 630b9579fe4a |
files | lightstring.js plugins.js |
diffstat | 2 files changed, 56 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lightstring.js +++ b/lightstring.js @@ -269,12 +269,17 @@ Lightstring.Connection.prototype = { that.emit('DOMInput', elm); that.emit(elm.tagName, elm); +<<<<<<< HEAD + if (elm.tagName === 'iq') + that.emit(elm.getAttribute('id'), elm); +======= if (elm.tagName === 'iq') { var payload = elm.firstChild; if (payload) that.emit('iq/' + payload.namespaceURI + ':' + payload.localName, elm); that.emit(elm.getAttribute('id'), elm); //FIXME: possible attack vector. } +>>>>>>> f6a7c0f93d154c2cd34dfdda4ab8eec808b91b34 }); }, /**
--- a/plugins.js +++ b/plugins.js @@ -188,6 +188,56 @@ Lightstring.NS.x = "jabber:x:data"; Lightstring.NS.pubsub = "http://jabber.org/protocol/pubsub"; Lightstring.NS.pubsub_owner = "http://jabber.org/protocol/pubsub#owner"; Lightstring.stanza.pubsub = { +<<<<<<< HEAD + getConfig: function(aTo, aNode) { + return "<iq type='get' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub_owner+"'><configure node='"+aNode+"'/></pubsub></iq>"; + }, + items: function(aTo, aNode) { + return "<iq type='get' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub+"'><items node='"+aNode+"'/></pubsub></iq>"; + }, + affiliations: function(aTo, aNode) { + return "<iq type='get' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub_owner+"'><affiliations node='"+aNode+"'/></pubsub></iq>"; + }, + publish: function(aTo, aNode, aItem, aId) { + return "<iq type='set' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub+"'><publish node='"+aNode+"'><item id='"+aId+"'>"+aItem+"</item></publish></pubsub></iq>"; + }, + retract: function(aTo, aNode, aItem) { + return "<iq type='set' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub+"'><retract node='"+aNode+"'><item id='"+aItem+"'/></retract></pubsub></iq>"; + }, + 'delete': function(aTo, aNode, aURI) { + return "<iq type='set' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub_owner+"'><delete node='"+aNode+"'/></pubsub></iq>"; + }, + config: function(aTo, aNode, aFields) { + var iq = "<iq type='set' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub+"'><configure node='"+aNode+"'><x xmlns='"+Lightstring.NS.x+"' type='submit'>"; + if(aFields) { + aFields.forEach(function(field) { + iq += field; + }); + } + iq += "</x></configure></pubsub></iq>"; + return iq; + }, + create: function(aTo, aNode, aFields) { + var iq = "<iq type='set' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub+"'><create node='"+aNode+"'/>"; + if(aFields) { + iq += "<configure><x xmlns='"+Lightstring.NS.x+"' type='submit'>" + aFields.forEach(function(field) { + iq += field; + }); + iq += "</x></configure>"; + } + iq += "</pubsub></iq>"; + return iq; + }, + setAffiliations: function(aTo, aNode, aAffiliations) { + var iq = "<iq type='set' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub_owner+"'><affiliations node='"+aNode+"'>"; + for(var i = 0; i < aAffiliations.length; i++) { + iq += "<affiliation jid='"+aAffiliations[i][0]+"' affiliation='"+aAffiliations[i][1]+"'/>" + } + iq += "</affiliations></pubsub></iq>"; + return iq; + }, +======= getConfig: function(aTo, aNode) { return "<iq type='get' to='"+aTo+"'><pubsub xmlns='"+Lightstring.NS.pubsub_owner+"'><configure node='"+aNode+"'/></pubsub></iq>"; }, @@ -226,6 +276,7 @@ Lightstring.stanza.pubsub = { iq += "</affiliations></pubsub></iq>"; return iq; }, +>>>>>>> f6a7c0f93d154c2cd34dfdda4ab8eec808b91b34 }; Lightstring.pubsubItems = function(aConnection, aTo, aNode, aCallback) { aConnection.send(Lightstring.stanza.pubsub.items(aTo, aNode), function(answer){