plugins.pep: Only add +notify feature if there weren't any handlers for it already

Wed, 15 Dec 2010 14:49:46 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 15 Dec 2010 14:49:46 +0000
changeset 164
d862093d9f91
parent 163
48a47bca9a63
child 165
8c67ea868c06

plugins.pep: Only add +notify feature if there weren't any handlers for it already

plugins/pep.lua file | annotate | diff | comparison | revisions
--- a/plugins/pep.lua	Wed Dec 15 14:48:55 2010 +0000
+++ b/plugins/pep.lua	Wed Dec 15 14:49:46 2010 +0000
@@ -22,8 +22,11 @@
 	end);
 	
 	function stream:hook_pep(node, callback, priority)
+		local handlers = stream.events._handlers["pep/"..node];
+		if not(handlers) or #handlers == 0 then
+			stream:add_disco_feature(node.."+notify");
+		end
 		stream:hook("pep/"..node, callback, priority);
-		stream:add_disco_feature(node.."+notify");
 	end
 	
 	function stream:unhook_pep(node, callback)

mercurial