Software /
code /
prosody
Comparison
util/helpers.lua @ 6783:cd44427c7295
util.helpers: Fix order of functions using each other [fixes 00412b36166f]
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 03 Mar 2015 20:27:35 +0100 |
parent | 6777:5de6b93d0190 |
child | 7720:7166750fb963 |
comparison
equal
deleted
inserted
replaced
6782:ec172dbe9d14 | 6783:cd44427c7295 |
---|---|
9 local debug = require "util.debug"; | 9 local debug = require "util.debug"; |
10 | 10 |
11 -- Helper functions for debugging | 11 -- Helper functions for debugging |
12 | 12 |
13 local log = require "util.logger".init("util.debug"); | 13 local log = require "util.logger".init("util.debug"); |
14 | |
15 local function log_host_events(host) | |
16 return log_events(prosody.hosts[host].events, host); | |
17 end | |
18 | |
19 local function revert_log_host_events(host) | |
20 return revert_log_events(prosody.hosts[host].events); | |
21 end | |
22 | 14 |
23 local function log_events(events, name, logger) | 15 local function log_events(events, name, logger) |
24 local f = events.fire_event; | 16 local f = events.fire_event; |
25 if not f then | 17 if not f then |
26 error("Object does not appear to be a util.events object"); | 18 error("Object does not appear to be a util.events object"); |
35 return events; | 27 return events; |
36 end | 28 end |
37 | 29 |
38 local function revert_log_events(events) | 30 local function revert_log_events(events) |
39 events.fire_event, events[events.fire_event] = events[events.fire_event], nil; -- :)) | 31 events.fire_event, events[events.fire_event] = events[events.fire_event], nil; -- :)) |
32 end | |
33 | |
34 local function log_host_events(host) | |
35 return log_events(prosody.hosts[host].events, host); | |
36 end | |
37 | |
38 local function revert_log_host_events(host) | |
39 return revert_log_events(prosody.hosts[host].events); | |
40 end | 40 end |
41 | 41 |
42 local function show_events(events, specific_event) | 42 local function show_events(events, specific_event) |
43 local event_handlers = events._handlers; | 43 local event_handlers = events._handlers; |
44 local events_array = {}; | 44 local events_array = {}; |