Comparison

core/portmanager.lua @ 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
parent 4607:7f45b2cb3c03
child 4609:83a5377ffea2
comparison
equal deleted inserted replaced
4607:7f45b2cb3c03 4608:01d52f31b6b3
49 end 49 end
50 return friendly_message; 50 return friendly_message;
51 end 51 end
52 52
53 module("portmanager", package.seeall); 53 module("portmanager", package.seeall);
54
55 prosody.events.add_handler("item-added/net-provider", function (event)
56 local item = event.item;
57 register_service(item.name, item);
58 end);
59 prosody.events.add_handler("item-removed/net-provider", function (event)
60 local item = event.item;
61 unregister_service(item.name, item);
62 end);
54 63
55 --- Public API 64 --- Public API
56 65
57 function activate_service(service_name) 66 function activate_service(service_name)
58 local service_info = services[service_name][1]; 67 local service_info = services[service_name][1];