Mercurial > eldonilo > lightstring
comparison 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 |
comparison
equal
deleted
inserted
replaced
107:704ce44c1a22 | 108:5cb4733c5189 |
---|---|
43 message.setAttribute('id', Lightstring.newId()); | 43 message.setAttribute('id', Lightstring.newId()); |
44 } | 44 } |
45 | 45 |
46 return message; | 46 return message; |
47 }, | 47 }, |
48 received: function(aTo, aId) { | |
49 var message = Lightstring.parse( | |
50 "<message to='" + aTo + "'>" + | |
51 "<received xmlns='urn:xmpp:receipts' id='" + aId + "'/>" + | |
52 "</message>" | |
53 ); | |
54 return message; | |
55 }, | |
56 read: function(aTo, aId) { | |
57 var message = Lightstring.parse( | |
58 "<message to='" + aTo + "'>" + | |
59 "<read xmlns='urn:xmpp:receipts' id='" + aId + "'/>" + | |
60 "</message>" | |
61 ); | |
62 return message; | |
63 }, | |
64 } | 48 } |
65 }; | 49 }; |
50 Object.defineProperties(Lightstring.Stanza.prototype, { | |
51 'body': { | |
52 get : function(){ | |
53 var bodyEl = this.el.querySelector('body'); | |
54 if (!bodyEl) | |
55 return null; | |
56 | |
57 return bodyEl.textContent; | |
58 }, | |
59 // set : function(newValue){ bValue = newValue; }, | |
60 enumerable : true, | |
61 configurable : true | |
62 }, | |
63 'subject': { | |
64 get : function(){ | |
65 var subjectEl = this.el.querySelector('subject'); | |
66 if (!subjectEl) | |
67 return null; | |
68 | |
69 return subjectEl.textContent; | |
70 }, | |
71 // set : function(newValue){ bValue = newValue; }, | |
72 enumerable : true, | |
73 configurable : true | |
74 } | |
75 }); |