Comparison

mod_http_roster_admin/mod_http_roster_admin.lua @ 2621:c4c51e43b788

mod_http_roster_admin: No need to manually purge. mod_storage_memory now has the `auto_purge_enabled` option which does the job.
author JC Brand <jc@opkode.com>
date Wed, 15 Mar 2017 08:53:30 +0000
parent 2617:7c3a1688e385
child 2622:ac3ca6233ded
comparison
equal deleted inserted replaced
2620:8b8cab2eb7fc 2621:c4c51e43b788
292 end 292 end
293 293
294 return true; 294 return true;
295 end 295 end
296 296
297 module:hook("resource-unbind", function (event)
298 local user_bare_jid = event.session.username.."@"..event.session.host;
299 if not bare_sessions[user_bare_jid] then -- User went offline
300 -- We don't need this user's info cached anymore, clear it.
301 module:log("debug", "Purging the roster for %s", user_bare_jid);
302 storagemanager.open(event.session.host, "roster", "keyval").store[event.session.username] = nil;
303 end
304 end);
305
306 module:provides("http", { 297 module:provides("http", {
307 route = { 298 route = {
308 ["POST /refresh"] = handle_refresh_multi; 299 ["POST /refresh"] = handle_refresh_multi;
309 ["GET /refresh/*"] = handle_refresh_single; 300 ["GET /refresh/*"] = handle_refresh_single;
310 }; 301 };