Comparison

tools/xep227toprosody.lua @ 2508:fed7f19db0da

xep227toprosody: Fixed some global accesses.
author Waqas Hussain <waqas20@gmail.com>
date Wed, 27 Jan 2010 23:11:06 +0500
parent 2507:a8ce11633597
child 3540:bc139431830b
comparison
equal deleted inserted replaced
2507:a8ce11633597 2508:fed7f19db0da
139 end 139 end
140 140
141 ----------------------------------------------------------------------- 141 -----------------------------------------------------------------------
142 142
143 local curr_host = ""; 143 local curr_host = "";
144 144 local user_name = "";
145 145
146 146
147 local cb = { 147 local cb = {
148 stream_tag = "user", 148 stream_tag = "user",
149 stream_ns = ns_xep227, 149 stream_ns = ns_xep227,
150 user_name = ""
151 }; 150 };
152 function cb.streamopened(session, attr) 151 function cb.streamopened(session, attr)
153 session.notopen = false; 152 session.notopen = false;
154 user_name = attr.name; 153 user_name = attr.name;
155 store_password(user_name, curr_host, attr.password); 154 store_password(user_name, curr_host, attr.password);
217 if (curr_ns == ns_xep227) and (name == "host") then 216 if (curr_ns == ns_xep227) and (name == "host") then
218 print("End parsing host "..curr_host); 217 print("End parsing host "..curr_host);
219 curr_host = "" -- end of host element 218 curr_host = "" -- end of host element
220 else 219 else
221 -- forward to xmlhandlers 220 -- forward to xmlhandlers
222 user_handlers:EndElement(elementname, attributes); 221 user_handlers:EndElement(elementname);
223 end 222 end
224 elseif (curr_ns ~= ns_xep227) or (name ~= "server-data") then 223 elseif (curr_ns ~= ns_xep227) or (name ~= "server-data") then
225 io.stderr:write("Unhandled XML element: ", name, "\n"); 224 io.stderr:write("Unhandled XML element: ", name, "\n");
226 os.exit(1); 225 os.exit(1);
227 end 226 end