Comparison

tools/xep227toprosody.lua @ 3709:db1c1ddc79e8

tools/xep227toprosody.lua: Convert to use util.xmppstream
author Matthew Wild <mwild1@gmail.com>
date Tue, 07 Dec 2010 19:20:33 +0000
parent 3540:bc139431830b
child 3710:59fbe4536c69
comparison
equal deleted inserted replaced
3708:2dcb86c7cee7 3709:db1c1ddc79e8
34 prosody.platform = "posix"; 34 prosody.platform = "posix";
35 end 35 end
36 36
37 local lxp = require "lxp"; 37 local lxp = require "lxp";
38 local st = require "util.stanza"; 38 local st = require "util.stanza";
39 local init_xmlhandlers = require "core.xmlhandlers"; 39 local xmppstream = require "util.xmppstream";
40 local new_xmpp_handlers = xmppstream.new_sax_handlers;
40 local dm = require "util.datamanager" 41 local dm = require "util.datamanager"
41 dm.set_data_path("data"); 42 dm.set_data_path("data");
42 43
43 local ns_separator = "\1";
44 local ns_pattern = "^([^"..ns_separator.."]*)"..ns_separator.."?(.*)$";
45 local ns_xep227 = "http://www.xmpp.org/extensions/xep-0227.html#ns"; 44 local ns_xep227 = "http://www.xmpp.org/extensions/xep-0227.html#ns";
45 local ns_separator = xmppstream.ns_separator;
46 local ns_pattern = xmppstream.ns_pattern;
46 47
47 ----------------------------------------------------------------------- 48 -----------------------------------------------------------------------
48 49
49 function store_vcard(username, host, stanza) 50 function store_vcard(username, host, stanza)
50 -- create or update vCard for username@host 51 -- create or update vCard for username@host
174 else 175 else
175 print("UNHANDLED stanza "..stanza.name.." xmlns: "..(stanza.attr.xmlns or "")); 176 print("UNHANDLED stanza "..stanza.name.." xmlns: "..(stanza.attr.xmlns or ""));
176 end 177 end
177 end 178 end
178 179
179 local user_handlers = init_xmlhandlers({ notopen = true, }, cb); 180 local user_handlers = new_xmpp_handlers({ notopen = true }, cb);
180 181
181 ----------------------------------------------------------------------- 182 -----------------------------------------------------------------------
182 183
183 local lxp_handlers = { 184 local lxp_handlers = {
184 --count = 0 185 --count = 0