plugins/mod_http.lua
changeset 5776 bd0ff8ae98a8
parent 5427 199e7989f713
child 6027 8c69cea8a1bf
equal deleted inserted replaced
5775:a6c2b8933507 5776:bd0ff8ae98a8
     1 -- Prosody IM
     1 -- Prosody IM
     2 -- Copyright (C) 2008-2012 Matthew Wild
     2 -- Copyright (C) 2008-2012 Matthew Wild
     3 -- Copyright (C) 2008-2012 Waqas Hussain
     3 -- Copyright (C) 2008-2012 Waqas Hussain
     4 -- 
     4 --
     5 -- This project is MIT/X11 licensed. Please see the
     5 -- This project is MIT/X11 licensed. Please see the
     6 -- COPYING file in the source package for more information.
     6 -- COPYING file in the source package for more information.
     7 --
     7 --
     8 
     8 
     9 module:set_global();
     9 module:set_global();
   106 			else
   106 			else
   107 				module:log("error", "Invalid route in %s, %q. See http://prosody.im/doc/developers/http#routes", app_name, key);
   107 				module:log("error", "Invalid route in %s, %q. See http://prosody.im/doc/developers/http#routes", app_name, key);
   108 			end
   108 			end
   109 		end
   109 		end
   110 	end
   110 	end
   111 	
   111 
   112 	local function http_app_removed(event)
   112 	local function http_app_removed(event)
   113 		local app_handlers = apps[event.item.name];
   113 		local app_handlers = apps[event.item.name];
   114 		apps[event.item.name] = nil;
   114 		apps[event.item.name] = nil;
   115 		for event, handler in pairs(app_handlers) do
   115 		for event, handler in pairs(app_handlers) do
   116 			module:unhook_object_event(server, event, handler);
   116 			module:unhook_object_event(server, event, handler);
   117 		end
   117 		end
   118 	end
   118 	end
   119 	
   119 
   120 	module:handle_items("http-provider", http_app_added, http_app_removed);
   120 	module:handle_items("http-provider", http_app_added, http_app_removed);
   121 
   121 
   122 	server.add_host(host);
   122 	server.add_host(host);
   123 	function module.unload()
   123 	function module.unload()
   124 		server.remove_host(host);
   124 		server.remove_host(host);