Comparison

core/hostmanager.lua @ 575:428c951d0a33

Log in hostmanager when a vhost is activated/deactivated
author Matthew Wild <mwild1@gmail.com>
date Sat, 06 Dec 2008 19:49:14 +0000
parent 569:5216efe6088b
child 749:1359492f45d7
comparison
equal deleted inserted replaced
574:5963b780775d 575:428c951d0a33
1
2 hosts = {};
3 1
4 local hosts = hosts; 2 local hosts = hosts;
5 local configmanager = require "core.configmanager"; 3 local configmanager = require "core.configmanager";
6 local eventmanager = require "core.eventmanager"; 4 local eventmanager = require "core.eventmanager";
5
6 local log = require "util.logger".init("hostmanager");
7 7
8 local pairs = pairs; 8 local pairs = pairs;
9 9
10 module "hostmanager" 10 module "hostmanager"
11 11
21 21
22 eventmanager.add_event_hook("server-starting", load_enabled_hosts); 22 eventmanager.add_event_hook("server-starting", load_enabled_hosts);
23 23
24 function activate(host, host_config) 24 function activate(host, host_config)
25 hosts[host] = {type = "local", connected = true, sessions = {}, host = host, s2sout = {} }; 25 hosts[host] = {type = "local", connected = true, sessions = {}, host = host, s2sout = {} };
26 26 log("info", "Activated host: %s", host);
27 eventmanager.fire_event("host-activated", host, host_config); 27 eventmanager.fire_event("host-activated", host, host_config);
28 end 28 end
29 29
30 function deactivate(host) 30 function deactivate(host)
31 local host_session = hosts[host]; 31 local host_session = hosts[host];
32 32 log("info", "Deactivating host: %s", host);
33 eventmanager.fire_event("host-deactivating", host, host_session); 33 eventmanager.fire_event("host-deactivating", host, host_session);
34 34
35 -- Disconnect local users, s2s connections 35 -- Disconnect local users, s2s connections
36 for user, session_list in pairs(host_session.sessions) do 36 for user, session_list in pairs(host_session.sessions) do
37 for resource, session in pairs(session_list) do 37 for resource, session in pairs(session_list) do
40 end 40 end
41 -- Components? 41 -- Components?
42 42
43 hosts[host] = nil; 43 hosts[host] = nil;
44 eventmanager.fire_event("host-deactivated", host); 44 eventmanager.fire_event("host-deactivated", host);
45 log("info", "Deactivated host: %s", host);
45 end 46 end
46 47
47 function getconfig(name) 48 function getconfig(name)
48 end 49 end
49 50