changeset 23:99bf2bdcfd96

Emit an iq/namespace:tag event for each iq containing a payload.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 26 Jan 2012 22:16:26 +0100
parents 6a6bb8ded046
children 119ceb121908
files lightstring.js
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lightstring.js
+++ b/lightstring.js
@@ -263,8 +263,12 @@ Lightstring.Connection.prototype = {
       that.emit('DOMInput', elm);
       that.emit(elm.tagName, elm);
 
-      if (elm.tagName === 'iq')
+      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.
+      }
     });
   },
   /**