ejabberd2prosody: Added support for ask='both' in subscriptions.
authorWaqas Hussain <waqas20@gmail.com>
Thu, 17 Sep 2009 19:54:12 +0000 (00:54 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Thu, 17 Sep 2009 19:54:12 +0000 (00:54 +0500)
tools/ejabberd2prosody.lua

index c18056c127a4dd2e920633c1f883604df36f16e7..3bcf8a2e80f0a439aabf7ba21e8e3dfd71bc92d1 100755 (executable)
@@ -91,10 +91,17 @@ local filters = {
                local name = tuple[5]; local subscription = tuple[6];
                local ask = tuple[7]; local groups = tuple[8];
                if type(name) ~= type("") then name = nil; end
-               if ask == "none" then ask = nil; elseif ask == "out" then ask = "subscribe" elseif ask == "in" then
+               if ask == "none" then
+                       ask = nil;
+               elseif ask == "out" then
+                       ask = "subscribe"
+               elseif ask == "in" then
                        roster_pending(node, host, contact);
-                       return;
-               else error(ask) end
+                       ask = nil;
+               elseif ask == "both" then
+                       roster_pending(node, host, contact);
+                       ask = "subscribe";
+               else error("Unknown ask type: "..ask); end
                if subscription ~= "both" and subscription ~= "from" and subscription ~= "to" and subscription ~= "none" then error(subscription) end
                local item = {name = name, ask = ask, subscription = subscription, groups = {}};
                for _, g in ipairs(groups) do item.groups[g] = true; end