Software /
code /
prosody
Comparison
tools/ejabberd2prosody.lua @ 1782:dd819e5bb0b8
ejabberd2prosody: Added support for ask='both' in subscriptions.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 18 Sep 2009 00:54:12 +0500 |
parent | 1726:85518cb866dd |
child | 1784:b2bfd3b93da6 |
comparison
equal
deleted
inserted
replaced
1781:b3eee6151592 | 1782:dd819e5bb0b8 |
---|---|
89 local node = tuple[3][1]; local host = tuple[3][2]; | 89 local node = tuple[3][1]; local host = tuple[3][2]; |
90 local contact = (type(tuple[4][1]) == "table") and tuple[4][2] or tuple[4][1].."@"..tuple[4][2]; | 90 local contact = (type(tuple[4][1]) == "table") and tuple[4][2] or tuple[4][1].."@"..tuple[4][2]; |
91 local name = tuple[5]; local subscription = tuple[6]; | 91 local name = tuple[5]; local subscription = tuple[6]; |
92 local ask = tuple[7]; local groups = tuple[8]; | 92 local ask = tuple[7]; local groups = tuple[8]; |
93 if type(name) ~= type("") then name = nil; end | 93 if type(name) ~= type("") then name = nil; end |
94 if ask == "none" then ask = nil; elseif ask == "out" then ask = "subscribe" elseif ask == "in" then | 94 if ask == "none" then |
95 ask = nil; | |
96 elseif ask == "out" then | |
97 ask = "subscribe" | |
98 elseif ask == "in" then | |
95 roster_pending(node, host, contact); | 99 roster_pending(node, host, contact); |
96 return; | 100 ask = nil; |
97 else error(ask) end | 101 elseif ask == "both" then |
102 roster_pending(node, host, contact); | |
103 ask = "subscribe"; | |
104 else error("Unknown ask type: "..ask); end | |
98 if subscription ~= "both" and subscription ~= "from" and subscription ~= "to" and subscription ~= "none" then error(subscription) end | 105 if subscription ~= "both" and subscription ~= "from" and subscription ~= "to" and subscription ~= "none" then error(subscription) end |
99 local item = {name = name, ask = ask, subscription = subscription, groups = {}}; | 106 local item = {name = name, ask = ask, subscription = subscription, groups = {}}; |
100 for _, g in ipairs(groups) do item.groups[g] = true; end | 107 for _, g in ipairs(groups) do item.groups[g] = true; end |
101 roster(node, host, contact, item); | 108 roster(node, host, contact, item); |
102 end; | 109 end; |