projects
/
prosody.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
certmanager: Fix global access
[prosody.git]
/
tools
/
ejabberd2prosody.lua
diff --git
a/tools/ejabberd2prosody.lua
b/tools/ejabberd2prosody.lua
index 4fef3f3abbf434e4eac798d8ee6650cb6f7202b1..d0c22df71843c51cfcdb7976c04aa39a4827c05c 100755
(executable)
--- a/
tools/ejabberd2prosody.lua
+++ b/
tools/ejabberd2prosody.lua
@@
-9,9
+9,14
@@
+package.path = package.path ..";../?.lua";
+
+if arg[0]:match("^./") then
+ package.path = package.path .. ";"..arg[0]:gsub("/ejabberd2prosody.lua$", "/?.lua");
+end
+
require "erlparse";
require "erlparse";
-package.path = package.path ..";../?.lua";
local serialize = require "util.serialization".serialize;
local st = require "util.stanza";
package.loaded["util.logger"] = {init = function() return function() end; end}
local serialize = require "util.serialization".serialize;
local st = require "util.stanza";
package.loaded["util.logger"] = {init = function() return function() end; end}
@@
-44,7
+49,7
@@
function vcard(node, host, stanza)
end
function password(node, host, password)
local ret, err = dm.store(node, host, "accounts", {password = password});
end
function password(node, host, password)
local ret, err = dm.store(node, host, "accounts", {password = password});
- print("["..(err or "success").."] accounts: "..node.."@"..host
.." = "..password
);
+ print("["..(err or "success").."] accounts: "..node.."@"..host);
end
function roster(node, host, jid, item)
local roster = dm.load(node, host, "roster") or {};
end
function roster(node, host, jid, item)
local roster = dm.load(node, host, "roster") or {};
@@
-86,13
+91,24
@@
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
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);
+ ask = nil;
+ elseif ask == "both" then
roster_pending(node, host, contact);
roster_pending(node, host, contact);
-
return
;
- else error(
ask)
end
+
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 = {}};
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
+ for _, g in ipairs(groups) do
+ if type(g) == "string" then
+ item.groups[g] = true;
+ end
+ end
roster(node, host, contact, item);
end;
private_storage = function(tuple)
roster(node, host, contact, item);
end;
private_storage = function(tuple)