Comparison

plugins/mod_privacy.lua @ 2589:39f5a068dc41

mod_privacy: Fix potential traceback in stanza validation, and fix some zero-based indexing :)
author Matthew Wild <mwild1@gmail.com>
date Thu, 11 Feb 2010 18:44:42 +0000
parent 2588:741302471a23
child 2590:2d7e2a28d1d5
comparison
equal deleted inserted replaced
2588:741302471a23 2589:39f5a068dc41
341 valid = getList(privacy_lists, origin, stanza, name); 341 valid = getList(privacy_lists, origin, stanza, name);
342 end 342 end
343 end 343 end
344 344
345 if valid ~= true then 345 if valid ~= true then
346 if valid[0] == nil then 346 valid = valid or { "cancel", "bad-request", "Couldn't understand request" };
347 valid[0] = "cancel";
348 end
349 if valid[1] == nil then 347 if valid[1] == nil then
350 valid[1] = "bad-request"; 348 valid[1] = "cancel";
351 end 349 end
352 origin.send(st.error_reply(stanza, valid[0], valid[1], valid[2])); 350 if valid[2] == nil then
351 valid[2] = "bad-request";
352 end
353 origin.send(st.error_reply(stanza, valid[1], valid[2], valid[3]));
353 else 354 else
354 datamanager.store(origin.username, origin.host, "privacy", privacy_lists); 355 datamanager.store(origin.username, origin.host, "privacy", privacy_lists);
355 end 356 end
356 return true; 357 return true;
357 end 358 end