Changeset

4608:01d52f31b6b3

portmanager: Support item-added/net-provider (global and shared modules only!)
author Matthew Wild <mwild1@gmail.com>
date Wed, 14 Mar 2012 21:39:45 +0000
parents 4607:7f45b2cb3c03
children 4609:83a5377ffea2
files core/portmanager.lua
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/core/portmanager.lua	Wed Mar 14 21:39:02 2012 +0000
+++ b/core/portmanager.lua	Wed Mar 14 21:39:45 2012 +0000
@@ -52,6 +52,15 @@
 
 module("portmanager", package.seeall);
 
+prosody.events.add_handler("item-added/net-provider", function (event)
+	local item = event.item;
+	register_service(item.name, item);
+end);
+prosody.events.add_handler("item-removed/net-provider", function (event)
+	local item = event.item;
+	unregister_service(item.name, item);
+end);
+
 --- Public API
 
 function activate_service(service_name)