Diff

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
line wrap: on
line diff
--- a/core/moduleapi.lua	Fri Sep 06 10:53:04 2013 +0200
+++ b/core/moduleapi.lua	Mon Sep 16 18:41:09 2013 +0100
@@ -113,6 +113,10 @@
 end
 api.hook_stanza = api.hook_tag; -- COMPAT w/pre-0.9
 
+function api:unhook(event, handler)
+	return self:unhook_object_event((hosts[self.host] or prosody).events, event, handler);
+end
+
 function api:require(lib)
 	local f, n = pluginloader.load_code(self.name, lib..".lib.lua", self.environment);
 	if not f then