From 29d4a0246b3fcf2a6c75cf42b41c11ec658dab32 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 1 Dec 2009 19:57:33 +0000 Subject: modulemanager: Fire events module-loaded and module-unloaded, both receive a table with 'module' and 'host' fields, thanks bjc --- core/modulemanager.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/modulemanager.lua b/core/modulemanager.lua index d1f7d413..6440f8b8 100644 --- a/core/modulemanager.lua +++ b/core/modulemanager.lua @@ -158,6 +158,7 @@ function load(host, module_name, config) log("error", "Error initializing module '%s' on '%s': %s", module_name, host, err or "nil"); end if success then + hosts[host].events.fire_event("module-loaded", { module = module_name, host = host }); return true; else -- load failed, unloading unload(api_instance.host, module_name); @@ -200,6 +201,7 @@ function unload(host, name, ...) end hooks:remove(host, name); modulemap[host][name] = nil; + hosts[host].events.fire_event("module-unloaded", { module = name, host = host }); return true; end -- cgit v1.2.3 From 85332f04e0420729ca1402d2db639027e0bef7e7 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 1 Dec 2009 20:07:07 +0000 Subject: mod_proxy65: Fix log:module -> module:log :) --- plugins/mod_proxy65.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_proxy65.lua b/plugins/mod_proxy65.lua index 504cfc0c..e2cf3cd8 100644 --- a/plugins/mod_proxy65.lua +++ b/plugins/mod_proxy65.lua @@ -83,7 +83,7 @@ function connlistener.onincoming(conn, data) end conn:write(string.char(5, 0, 0, 3, sha:len()) .. sha .. string.char(0, 0)); -- VER, REP, RSV, ATYP, BND.ADDR (sha), BND.PORT (2 Byte) else - log:module("warn", "Neither data transfer nor initial connect of a participator of a transfer.") + module:log("warn", "Neither data transfer nor initial connect of a participator of a transfer.") conn.close(); end else -- cgit v1.2.3 From 0cbbfc225c549ab4f82f658330132361d07969aa Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 1 Dec 2009 20:18:47 +0000 Subject: mod_proxy65: Remove trailing whitespace --- plugins/mod_proxy65.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_proxy65.lua b/plugins/mod_proxy65.lua index e2cf3cd8..b2f901af 100644 --- a/plugins/mod_proxy65.lua +++ b/plugins/mod_proxy65.lua @@ -67,7 +67,7 @@ function connlistener.onincoming(conn, data) data:sub(4):byte() == 0x03 and -- ATYP must be 3 data:sub(5):byte() == 40 and -- SHA1 HASH length must be 40 (0x28) data:sub(-2):byte() == 0x00 and -- PORT must be 0, size 2 byte - data:sub(-1):byte() == 0x00 + data:sub(-1):byte() == 0x00 then local sha = data:sub(6, 45); -- second param is not count! it's the ending index (included!) if transfers[sha] == nil then -- cgit v1.2.3