changeset 35:bdfbd58b4835

Fix plugins.
author Sonny Piers <sonny.piers@gmail.com>
date Sat, 28 Jan 2012 04:55:29 +0100
parents 6ce66fba0242
children b43ca01b9f6f
files plugins/disco.js plugins/pubsub.js plugins/roster.js plugins/vcard.js
diffstat 4 files changed, 27 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/disco.js
+++ b/plugins/disco.js
@@ -49,9 +49,9 @@ Lightstring.stanza.disco = {
   }
 };
 Lightstring.discoItems = function(aConnection, aTo, aCallback) {
-  aConnection.send(Lightstring.stanza.disco.items(aTo), function(answer){
+  aConnection.send(Lightstring.stanza.disco.items(aTo), function(stanza){
     var items = [];
-    var elms = answer.querySelectorAll('item');
+    var elms = stanza.DOM.querySelectorAll('item');
     for(var i = 0; i < elms.length; i++) {
       var node = elms[i];
       var item = {
@@ -66,11 +66,11 @@ Lightstring.discoItems = function(aConne
   });
 };
 Lightstring.discoInfo = function(aConnection, aTo, aNode, aCallback) {
-  aConnection.send(Lightstring.stanza.disco.info(aTo, aNode), function(answer){
+  aConnection.send(Lightstring.stanza.disco.info(aTo, aNode), function(stanza){
     var identities = [];
     var features = [];
 
-    var children = answer.firstChild.children;
+    var children = stanza.DOM.firstChild.children;
     var length = children.length;
 
     for (var i = 0; i < length; i++) {
--- a/plugins/pubsub.js
+++ b/plugins/pubsub.js
@@ -63,9 +63,9 @@ Lightstring.stanza.pubsub = {
   },
 };
 Lightstring.pubsubItems = function(aConnection, aTo, aNode, aCallback) {
-  aConnection.send(Lightstring.stanza.pubsub.items(aTo, aNode), function(answer){
+  aConnection.send(Lightstring.stanza.pubsub.items(aTo, aNode), function(stanza){
     var items = [];
-    var elms = answer.querySelectorAll('item');
+    var elms = stanza.DOM.querySelectorAll('item');
     for(var i = 0; i < elms.length; i++) {
       var node = elms[i];
       var item = {
@@ -84,16 +84,16 @@ Lightstring.pubsubItems = function(aConn
   });
 }
 Lightstring.pubsubCreate = function(aConnection, aTo, aNode, aFields, aCallback) {
-  aConnection.send(Lightstring.stanza.pubsub.create(aTo, aNode, aFields), function(answer) {
-    if(answer.getAttribute('type') === 'result')
-      aCallback(null, answer);
+  aConnection.send(Lightstring.stanza.pubsub.create(aTo, aNode, aFields), function(stanza) {
+    if(stanza.DOM.getAttribute('type') === 'result')
+      aCallback(null, stanza);
     else
-      aCallback(answer, null);
+      aCallback(stanza, null);
   });
 };
 Lightstring.pubsubConfig = function(aConnection, aTo, aNode, aCallback) {
-  aConnection.send(Lightstring.stanza.pubsub.getConfig(aTo, aNode), function(answer){
-    var accessmodel = answer.querySelector('field[var="pubsub#access_model"]').lastChild.textContent;
+  aConnection.send(Lightstring.stanza.pubsub.getConfig(aTo, aNode), function(stanza){
+    var accessmodel = stanza.DOM.querySelector('field[var="pubsub#access_model"]').lastChild.textContent;
     if(accessmodel)
       aCallback(accessmodel);
     else
@@ -101,30 +101,30 @@ Lightstring.pubsubConfig = function(aCon
   });
 }
 Lightstring.pubsubRetract = function(aConnection, aTo, aNode, aItem, aCallback) {
-  aConnection.send(Lightstring.stanza.pubsub.retract(aTo, aNode, aItem), function(answer){
+  aConnection.send(Lightstring.stanza.pubsub.retract(aTo, aNode, aItem), function(stanza){
     if(aCallback)
-      aCallback(answer);
+      aCallback(stanza);
   });
 }
 Lightstring.pubsubPublish = function(aConnection, aTo, aNode, aItem, aId, aCallback) {
-  aConnection.send(Lightstring.stanza.pubsub.publish(aTo, aNode, aItem, aId), function(answer){
+  aConnection.send(Lightstring.stanza.pubsub.publish(aTo, aNode, aItem, aId), function(stanza){
     if(answer.getAttribute('type') === 'result')
-      aCallback(null, answer);
+      aCallback(null, stanza);
     else
-      aCallback(answer, null);
+      aCallback(stanza, null);
   });
 }
 Lightstring.pubsubDelete = function(aConnection, aTo, aNode, aCallback) {
-  aConnection.send(Lightstring.stanza.pubsub.delete(aTo, aNode), function(answer){
+  aConnection.send(Lightstring.stanza.pubsub.delete(aTo, aNode), function(stanza){
     if(aCallback)
-      aCallback(answer);
+      aCallback(stanza);
   });
 }
 Lightstring.pubsubGetAffiliations = function(aConnection, aTo, aNode, aCallback) {
-  aConnection.send(Lightstring.stanza.pubsub.affiliations(aTo, aNode), function(answer) {
-    if((answer.getAttribute('type') === 'result') && aCallback) {
+  aConnection.send(Lightstring.stanza.pubsub.affiliations(aTo, aNode), function(stanza) {
+    if((stanza.DOM.getAttribute('type') === 'result') && aCallback) {
       var affiliations = {};
-      answer.querySelectorAll('affiliation').forEach(function(affiliation) {
+      stanza.DOM.querySelectorAll('affiliation').forEach(function(affiliation) {
         affiliations[affiliation.getAttribute("jid")] = affiliation.getAttribute("affiliation");
       })
       aCallback(affiliations);
--- a/plugins/roster.js
+++ b/plugins/roster.js
@@ -38,9 +38,9 @@ Lightstring.stanza.roster = {
   }
 };
 Lightstring.getRoster = function(connection, aCallback) {
-  connection.send(this.stanza.roster.get(), function(answer){
+  connection.send(this.stanza.roster.get(), function(stanza){
     var contacts = [];
-    var elems = answer.querySelectorAll('item');
+    var elems = stanza.DOM.querySelectorAll('item');
     for(var i = 0; i<elms.length; i++) {
       var item = elms[i];
       var jid = item.getAttribute('jid');
--- a/plugins/vcard.js
+++ b/plugins/vcard.js
@@ -30,9 +30,9 @@ Lightstring.stanza.vcard = {
 };
 //FIXME we should return a proper vcard, not an XMPP one
 Lightstring.getVcard = function(aConnection, aTo, aCallback) {
-  aConnection.send(Lightstring.stanza.vcard.get(aTo), function(answer, err){
-    if(answer) {
-      var vcard = answer.querySelector('vCard');
+  aConnection.send(Lightstring.stanza.vcard.get(aTo), function(stanza, err){
+    if(stanza) {
+      var vcard = stanza.DOM.querySelector('vCard');
       if(vcard)
         aCallback(vcard);
     }