diff plugins/ping.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/ping.js
+++ b/plugins/ping.js
@@ -49,3 +49,19 @@ Lightstring.plugins['ping'] = {
     }
   }
 }
+Object.defineProperties(Lightstring.Stanza.prototype, {
+  'ping': {
+    get : function() {
+      return !!(this.el.querySelector('ping'));
+    },
+    set: function(aBool) {
+      if (this.ping)
+        return;
+
+      var pingEl = Lightstring.doc.createElementNS(Lightstring.ns.ping, 'ping');
+      this.el.appendChild(pingEl);
+    },
+    enumerable : true,  
+    configurable : true
+  },
+});