Comparison

core/moduleapi.lua @ 4695:838ad61c6b2c

moduleapi: Add module:unhook_object_event()
author Matthew Wild <mwild1@gmail.com>
date Thu, 26 Apr 2012 05:39:27 +0100
parent 4666:fb522fbd495e
child 4707:d8fc9a1aabeb
comparison
equal deleted inserted replaced
4694:f9a091b6dfd5 4695:838ad61c6b2c
69 end 69 end
70 70
71 function api:hook_object_event(object, event, handler, priority) 71 function api:hook_object_event(object, event, handler, priority)
72 self.event_handlers[handler] = { name = event, priority = priority, object = object }; 72 self.event_handlers[handler] = { name = event, priority = priority, object = object };
73 return object.add_handler(event, handler, priority); 73 return object.add_handler(event, handler, priority);
74 end
75
76 function api:unhook_object_event(event, handler)
77 return object.remove_handler(event, handler);
74 end 78 end
75 79
76 function api:hook(event, handler, priority) 80 function api:hook(event, handler, priority)
77 return self:hook_object_event((hosts[self.host] or prosody).events, event, handler, priority); 81 return self:hook_object_event((hosts[self.host] or prosody).events, event, handler, priority);
78 end 82 end