tools/ejabberd2prosody.lua

changeset 606
f8f1534a4e06
parent 547
265c4b8f0a8a
child 615
4ae3e81513f3
equal deleted inserted replaced
605:8458be0941e7 606:f8f1534a4e06
122 vcard = function(tuple) 122 vcard = function(tuple)
123 vcard(tuple[2][1], tuple[2][2], build_stanza(tuple[3])); 123 vcard(tuple[2][1], tuple[2][2], build_stanza(tuple[3]));
124 end; 124 end;
125 roster = function(tuple) 125 roster = function(tuple)
126 local node = tuple[3][1]; local host = tuple[3][2]; 126 local node = tuple[3][1]; local host = tuple[3][2];
127 local contact = tuple[4][1].."@"..tuple[4][2]; 127 local contact = (type(tuple[4][1]) == "table") and tuple[4][2] or tuple[4][1].."@"..tuple[4][2];
128 local name = tuple[5]; local subscription = tuple[6]; 128 local name = tuple[5]; local subscription = tuple[6];
129 local ask = tuple[7]; local groups = tuple[8]; 129 local ask = tuple[7]; local groups = tuple[8];
130 if type(name) ~= type("") then name = nil; end 130 if type(name) ~= type("") then name = nil; end
131 if ask == "none" then ask = nil; elseif ask == "out" then ask = "subscribe" else error(ask) end 131 if ask == "none" then ask = nil; elseif ask == "out" then ask = "subscribe" else error(ask) end
132 if subscription ~= "both" and subscription ~= "from" and subscription ~= "to" and subscription ~= "none" then error(subscription) end 132 if subscription ~= "both" and subscription ~= "from" and subscription ~= "to" and subscription ~= "none" then error(subscription) end

mercurial