--- a/mod_throttle_unsolicited/mod_throttle_unsolicited.lua Mon Apr 01 13:19:47 2019 +0200
+++ b/mod_throttle_unsolicited/mod_throttle_unsolicited.lua Tue Apr 02 16:19:11 2019 +0200
@@ -12,7 +12,6 @@
function check_subscribed(event)
local stanza, origin = event.stanza, event.origin;
local log = origin.log or module._log;
- log("debug", "check_subscribed(%s)", stanza:top_tag());
if stanza.attr.type == "error" then return end
local to_orig = stanza.attr.to;
@@ -25,24 +24,22 @@
-- Check if it's a message to a joined room
local rooms = origin.rooms_joined;
if rooms and rooms[to_bare] then
- log("debug", "Message to joined room, no limit");
return
end
-- Retrieve or create throttle object
local lim = origin.throttle_unsolicited;
if not lim then
- log("debug", "New throttle");
lim = throttle.create(max * multiplier, 60 * multiplier);
origin.throttle_unsolicited = lim;
end
local to_user, to_host = jid_split(to_orig);
if to_user and not is_contact_subscribed(to_user, to_host, from_jid) then
- log("debug", "%s is not subscribed to %s@%s", from_jid, to_user, to_host);
+ log("debug", "[unsolicited] %s is not subscribed to %s@%s", from_jid, to_user, to_host);
if not lim:poll(1) then
- log("warn", "Sent too many messages to non-contacts, bouncing message");
- origin.firewall_mark_throttle_unsolicited = gettime();
+ log("warn", "[unsolicited] Sent too many messages to non-contacts, bouncing message");
+ origin.firewall_mark_unsolicited = gettime();
origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
return true;
end