aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc/muc.lib.lua
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2014-02-21 17:52:40 -0500
committerdaurnimator <quae@daurnimator.com>2014-02-21 17:52:40 -0500
commit6a1b8db129762c338e2f17bfd9d9384a6ad45854 (patch)
tree546f2fb68fe12e17536da8c6503d33ca19081f2d /plugins/muc/muc.lib.lua
parente89c74cde566c64200c058845622c0c1618b8242 (diff)
downloadprosody-6a1b8db129762c338e2f17bfd9d9384a6ad45854.tar.gz
prosody-6a1b8db129762c338e2f17bfd9d9384a6ad45854.zip
plugins/muc/muc.lib: Make use of return values to send service-unavailable errors
Diffstat (limited to 'plugins/muc/muc.lib.lua')
-rw-r--r--plugins/muc/muc.lib.lua26
1 files changed, 15 insertions, 11 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index a5a87646..6131ca78 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -982,9 +982,8 @@ function room_mt:handle_iq_to_room(origin, stanza)
elseif stanza.attr.type == "set" then
return self:handle_owner_query_set_to_room(origin, stanza)
end
- elseif type == "set" or type == "get" then
- origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
- return true;
+ else
+ return nil;
end
end
@@ -1035,9 +1034,8 @@ function room_mt:handle_presence_to_room(origin, stanza)
self:handle_to_occupant(origin, stanza);
stanza.attr.to = to;
return true;
- elseif type ~= "error" and type ~= "result" then
- origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
- return true;
+ else
+ return nil;
end
end
@@ -1090,9 +1088,7 @@ function room_mt:handle_message_to_room(origin, stanza)
return true;
end
else
- if type == "error" or type == "result" then return; end
- origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
- return true;
+ return nil;
end
end
@@ -1108,10 +1104,18 @@ end
function room_mt:handle_stanza(origin, stanza)
local to_node, to_host, to_resource = jid_split(stanza.attr.to);
+ local handled
if to_resource then
- self:handle_to_occupant(origin, stanza);
+ handled = self:handle_to_occupant(origin, stanza);
else
- self:handle_to_room(origin, stanza);
+ handled = self:handle_to_room(origin, stanza);
+ end
+
+ if not handled then
+ local type = stanza.attr.type
+ if stanza.name ~= "iq" or type == "get" or type == "set" then
+ origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
+ end
end
end