Software /
code /
prosody-modules
Diff
mod_muc_limits/mod_muc_limits.lua @ 557:14f39769c9e0
mod_muc_limits: Echo any MUC <x> or <body> in the error reply (required to make Gajim display the error)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 15 Jan 2012 02:05:41 +0000 |
parent | 556:e50bdbaa7802 |
child | 1035:09a5082a8162 |
line wrap: on
line diff
--- a/mod_muc_limits/mod_muc_limits.lua Sun Jan 15 01:40:50 2012 +0000 +++ b/mod_muc_limits/mod_muc_limits.lua Sun Jan 15 02:05:41 2012 +0000 @@ -2,6 +2,8 @@ local st = require "util.stanza"; local new_throttle = require "util.throttle".create; +local xmlns_muc = "http://jabber.org/protocol/muc"; + local period = math.max(module:get_option_number("muc_event_rate", 0.5), 0); local burst = math.max(module:get_option_number("muc_burst_factor", 6), 1); @@ -26,7 +28,16 @@ end if not throttle:poll(1) then module:log("warn", "Dropping stanza for %s@%s from %s, over rate limit", dest_room, dest_host, from_jid); - origin.send(st.error_reply(stanza, "wait", "policy-violation", "The room is currently overactive, please try again later")); + local reply = st.error_reply(stanza, "wait", "policy-violation", "The room is currently overactive, please try again later"); + local body = stanza:get_child_text("body"); + if body then + reply:up():tag("body"):text(body):up(); + end + local x = stanza:get_child("x", xmlns_muc); + if x then + reply:add_child(st.clone(x)); + end + origin.send(reply); return true; end end