Comparison

tools/ejabberd2prosody.lua @ 6000:0f6399c86c10

Merge 0.9->0.10
author Matthew Wild <mwild1@gmail.com>
date Tue, 21 Jan 2014 03:24:40 +0000
parent 5993:ef11b8bab405
parent 5999:e49c0c677c5d
child 6007:ff24bc2d41a6
comparison
equal deleted inserted replaced
5996:e7efa9703a3f 6000:0f6399c86c10
28 local dm = require "util.datamanager" 28 local dm = require "util.datamanager"
29 dm.set_data_path("data"); 29 dm.set_data_path("data");
30 30
31 function build_stanza(tuple, stanza) 31 function build_stanza(tuple, stanza)
32 assert(type(tuple) == "table", "XML node is of unexpected type: "..type(tuple)); 32 assert(type(tuple) == "table", "XML node is of unexpected type: "..type(tuple));
33 if tuple[1] == "xmlelement" then 33 if tuple[1] == "xmlelement" or tuple[1] == "xmlel" then
34 assert(type(tuple[2]) == "string", "element name has type: "..type(tuple[2])); 34 assert(type(tuple[2]) == "string", "element name has type: "..type(tuple[2]));
35 assert(type(tuple[3]) == "table", "element attribute array has type: "..type(tuple[3])); 35 assert(type(tuple[3]) == "table", "element attribute array has type: "..type(tuple[3]));
36 assert(type(tuple[4]) == "table", "element children array has type: "..type(tuple[4])); 36 assert(type(tuple[4]) == "table", "element children array has type: "..type(tuple[4]));
37 local name = tuple[2]; 37 local name = tuple[2];
38 local attr = {}; 38 local attr = {};
245 properties[pair[1]] = pair[2]; 245 properties[pair[1]] = pair[2];
246 end 246 end
247 end 247 end
248 muc_room(tuple[2][1], tuple[2][2], properties); 248 muc_room(tuple[2][1], tuple[2][2], properties);
249 end; 249 end;
250 config = function(tuple) 250 --[=[config = function(tuple)
251 if tuple[2] == "hosts" then 251 if tuple[2] == "hosts" then
252 local output = io.output(); io.output("prosody.cfg.lua"); 252 local output = io.output(); io.output("prosody.cfg.lua");
253 io.write("-- Configuration imported from ejabberd --\n"); 253 io.write("-- Configuration imported from ejabberd --\n");
254 io.write([[Host "*" 254 io.write([[Host "*"
255 modules_enabled = { 255 modules_enabled = {
273 io.write("Host \"" .. h .. "\"\n"); 273 io.write("Host \"" .. h .. "\"\n");
274 end 274 end
275 io.output(output); 275 io.output(output);
276 print("prosody.cfg.lua created"); 276 print("prosody.cfg.lua created");
277 end 277 end
278 end; 278 end;]=]
279 }; 279 };
280 280
281 local arg = ...; 281 local arg = ...;
282 local help = "/? -? ? /h -h /help -help --help"; 282 local help = "/? -? ? /h -h /help -help --help";
283 if not arg or help:find(arg, 1, true) then 283 if not arg or help:find(arg, 1, true) then