Comparison

core/storagemanager.lua @ 3850:39492ede0cf5

storagemanager: Hook "host-activated", to make sure we are notified about data drivers.
author Waqas Hussain <waqas20@gmail.com>
date Sun, 12 Dec 2010 05:14:35 +0500
parent 3849:34981acbd5d5
child 3734:ec59071e2a55
comparison
equal deleted inserted replaced
3849:34981acbd5d5 3850:39492ede0cf5
9 local hosts = hosts; 9 local hosts = hosts;
10 local log = require "util.logger".init("storagemanager"); 10 local log = require "util.logger".init("storagemanager");
11 11
12 local olddm = {}; -- maintain old datamanager, for backwards compatibility 12 local olddm = {}; -- maintain old datamanager, for backwards compatibility
13 for k,v in pairs(datamanager) do olddm[k] = v; end 13 for k,v in pairs(datamanager) do olddm[k] = v; end
14 local prosody = prosody;
14 15
15 module("storagemanager") 16 module("storagemanager")
16 17
17 local default_driver_mt = { name = "internal" }; 18 local default_driver_mt = { name = "internal" };
18 default_driver_mt.__index = default_driver_mt; 19 default_driver_mt.__index = default_driver_mt;
34 host_session.events.add_handler("item-removed/data-driver", function (event) 35 host_session.events.add_handler("item-removed/data-driver", function (event)
35 local item = event.item; 36 local item = event.item;
36 stores_available:set(host, item.name, nil); 37 stores_available:set(host, item.name, nil);
37 end); 38 end);
38 end 39 end
40 prosody.events.add_handler("host-activated", initialize_host, 101);
39 41
40 local function load_driver(host, driver_name) 42 local function load_driver(host, driver_name)
41 if not driver_name then 43 if not driver_name then
42 return; 44 return;
43 end 45 end