Comparison

core/moduleapi.lua @ 5825:ac5e05ffc921

moduleapi: Add module:unhook()
author Matthew Wild <mwild1@gmail.com>
date Mon, 16 Sep 2013 18:41:09 +0100
parent 5776:bd0ff8ae98a8
child 5899:26f54b462601
child 6165:6a184b16b717
comparison
equal deleted inserted replaced
5824:6f4c8af128e2 5825:ac5e05ffc921
110 return; 110 return;
111 end 111 end
112 return self:hook("stanza/"..(xmlns and (xmlns..":") or "")..name, function (data) return handler(data.origin, data.stanza, data); end, priority); 112 return self:hook("stanza/"..(xmlns and (xmlns..":") or "")..name, function (data) return handler(data.origin, data.stanza, data); end, priority);
113 end 113 end
114 api.hook_stanza = api.hook_tag; -- COMPAT w/pre-0.9 114 api.hook_stanza = api.hook_tag; -- COMPAT w/pre-0.9
115
116 function api:unhook(event, handler)
117 return self:unhook_object_event((hosts[self.host] or prosody).events, event, handler);
118 end
115 119
116 function api:require(lib) 120 function api:require(lib)
117 local f, n = pluginloader.load_code(self.name, lib..".lib.lua", self.environment); 121 local f, n = pluginloader.load_code(self.name, lib..".lib.lua", self.environment);
118 if not f then 122 if not f then
119 f, n = pluginloader.load_code(lib, lib..".lib.lua", self.environment); 123 f, n = pluginloader.load_code(lib, lib..".lib.lua", self.environment);