changeset 50:e6c2c66c2002

Handle 'none' on set affiliation bug #2246
author Sonny Piers <sonny.piers@gmail.com>
date Mon, 21 Mar 2011 15:15:01 +0100
parents 7e421278b31b
children 22b06eade9a7
files storage.js
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/storage.js
+++ b/storage.js
@@ -378,6 +378,25 @@ storage.setAffiliation = function(nodeID
 		node.member.push(jid);
 	else if (config.enabled('outcast-affiliation') && affil == 'outcast')
 		node.outcast.push(jid);
+  else if (affil == 'none') {
+    (function() {
+      for (var i in node.outcast)
+        if(node.outcast[i] == jid)
+          return node.outcast.splice(i, 1);
+      for (var i in node.owner)
+        if(node.owner[i] == jid)
+          return node.owner.splice(i, 1);
+      for (var i in node.publisher)
+        if(node.publisher[i] == jid)
+          return node.publisher.splice(i, 1);
+      for (var i in node.publishOnly)
+        if(node.publishOnly[i] == jid)
+           return node.publishOnly.splice(i, 1);
+      for (var i in node.member)
+        if(node.member[i] == jid)
+          return node.member.splice(i, 1);
+    })()
+  }
 
 	storage.save();
 	return errors.success;