X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmod_presence.lua;h=ba71b940de3c4a13d69e5ce6982fc1cf1f1da91b;hb=3f9a02bee5e142846bf7da49dd2c6a1be72c86d5;hp=7c34eefa835a2706d1a6991c3ea3ff1ed2177bcd;hpb=9ec7548563f7c620182bd910076fac6e8ecefefc;p=prosody.git diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua index 7c34eefa..ba71b940 100644 --- a/plugins/mod_presence.lua +++ b/plugins/mod_presence.lua @@ -6,9 +6,7 @@ -- COPYING file in the source package for more information. -- - - -local log = require "util.logger".init("mod_presence") +local log = module._log; local require = require; local pairs, ipairs = pairs, ipairs; @@ -134,7 +132,7 @@ function handle_normal_presence(origin, stanza, core_route_stanza) end stanza.attr.to = nil; -- reset it else - log("error", "presence recieved from client with no roster"); + log("warn", "presence recieved from client with no roster"); end end @@ -148,16 +146,14 @@ function send_presence_of_available_resources(user, host, jid, recipient_session local pres = session.presence; if pres then pres.attr.to = jid; - pres.attr.from = session.full_jid; core_route_stanza(session, pres); pres.attr.to = nil; - pres.attr.from = nil; count = count + 1; end end end end - log("info", "broadcasted presence of "..count.." resources from "..user.."@"..host.." to "..jid); + log("debug", "broadcasted presence of "..count.." resources from "..user.."@"..host.." to "..jid); return count; end @@ -271,10 +267,7 @@ local function presence_handler(data) return true; end -local add_handler = require "core.eventmanager2".add_handler; -local remove_handler = require "core.eventmanager2".remove_handler; - -add_handler(module:get_host().."/presence", presence_handler); +prosody.events.add_handler(module:get_host().."/presence", presence_handler); module.unload = function() - remove_handler(module:get_host().."/presence", presence_handler); + prosody.events.remove_handler(module:get_host().."/presence", presence_handler); end