Mercurial > eldonilo > lightstring
diff plugins/im.js @ 108:5cb4733c5189
many api changes
author | Sonny Piers <sonny@fastmail.net> |
---|---|
date | Fri, 13 Jul 2012 15:26:18 +0200 |
parents | c06ec02217ee |
children |
line wrap: on
line diff
--- a/plugins/im.js +++ b/plugins/im.js @@ -45,21 +45,31 @@ Lightstring.plugins['im'] = { return message; }, - received: function(aTo, aId) { - var message = Lightstring.parse( - "<message to='" + aTo + "'>" + - "<received xmlns='urn:xmpp:receipts' id='" + aId + "'/>" + - "</message>" - ); - return message; - }, - read: function(aTo, aId) { - var message = Lightstring.parse( - "<message to='" + aTo + "'>" + - "<read xmlns='urn:xmpp:receipts' id='" + aId + "'/>" + - "</message>" - ); - return message; - }, } }; +Object.defineProperties(Lightstring.Stanza.prototype, { + 'body': { + get : function(){ + var bodyEl = this.el.querySelector('body'); + if (!bodyEl) + return null; + + return bodyEl.textContent; + }, + // set : function(newValue){ bValue = newValue; }, + enumerable : true, + configurable : true + }, + 'subject': { + get : function(){ + var subjectEl = this.el.querySelector('subject'); + if (!subjectEl) + return null; + + return subjectEl.textContent; + }, + // set : function(newValue){ bValue = newValue; }, + enumerable : true, + configurable : true + } +}); \ No newline at end of file