Software /
code /
prosody
Comparison
core/hostmanager.lua @ 1188:fa48e69c4786
core: hosts[*].events
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 20 May 2009 05:23:30 +0500 |
parent | 1095:cad4205f4925 |
child | 1467:fc420e9585c2 |
comparison
equal
deleted
inserted
replaced
1187:645846375a7b | 1188:fa48e69c4786 |
---|---|
1 | 1 |
2 local hosts = hosts; | 2 local hosts = hosts; |
3 local configmanager = require "core.configmanager"; | 3 local configmanager = require "core.configmanager"; |
4 local eventmanager = require "core.eventmanager"; | 4 local eventmanager = require "core.eventmanager"; |
5 local events_new = require "util.events".new; | |
5 | 6 |
6 local log = require "util.logger".init("hostmanager"); | 7 local log = require "util.logger".init("hostmanager"); |
7 | 8 |
8 local pairs = pairs; | 9 local pairs = pairs; |
9 | 10 |
24 end | 25 end |
25 | 26 |
26 eventmanager.add_event_hook("server-starting", load_enabled_hosts); | 27 eventmanager.add_event_hook("server-starting", load_enabled_hosts); |
27 | 28 |
28 function activate(host, host_config) | 29 function activate(host, host_config) |
29 hosts[host] = {type = "local", connected = true, sessions = {}, host = host, s2sout = {} }; | 30 hosts[host] = {type = "local", connected = true, sessions = {}, host = host, s2sout = {}, events = events_new() }; |
30 log((hosts_loaded_once and "info") or "debug", "Activated host: %s", host); | 31 log((hosts_loaded_once and "info") or "debug", "Activated host: %s", host); |
31 eventmanager.fire_event("host-activated", host, host_config); | 32 eventmanager.fire_event("host-activated", host, host_config); |
32 end | 33 end |
33 | 34 |
34 function deactivate(host) | 35 function deactivate(host) |