aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc/muc.lib.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-03-09 19:03:50 +0100
committerKim Alvefur <zash@zash.se>2018-03-09 19:03:50 +0100
commita062706194343729427d4450bbf0e9cd6c4e9215 (patch)
tree94140c4da30e8713babf2633e75f598a42c72dc5 /plugins/muc/muc.lib.lua
parent59ae1e42f837eb07f237bc67c84e2e8a15ef88c6 (diff)
downloadprosody-a062706194343729427d4450bbf0e9cd6c4e9215.tar.gz
prosody-a062706194343729427d4450bbf0e9cd6c4e9215.zip
MUC: Remove support for GC 1.0 for joining
Diffstat (limited to 'plugins/muc/muc.lib.lua')
-rw-r--r--plugins/muc/muc.lib.lua16
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 9ae54d5e..c925329f 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -470,6 +470,13 @@ function room_mt:handle_normal_presence(origin, stanza)
local bare_jid = jid_bare(real_jid);
local orig_occupant = self:get_occupant_by_real_jid(real_jid);
local muc_x = stanza:get_child("x", "http://jabber.org/protocol/muc");
+
+ if orig_occupant == nil and not muc_x then
+ module:log("debug", "Attempted join without <x>, possibly desynced");
+ origin.send(st.error_reply(stanza, "cancel", "item-not-found", "You must join the room before sending presence updates"));
+ return true;
+ end
+
local is_first_dest_session;
local dest_occupant;
if type == "unavailable" then
@@ -496,13 +503,6 @@ function room_mt:handle_normal_presence(origin, stanza)
is_last_orig_session = iter(ob, iter(ob, last)) == nil;
end
- -- TODO Handle these cases sensibly
- if orig_occupant == nil and not muc_x then
- module:log("debug", "Join without <x>, possibly desynced");
- elseif orig_occupant ~= nil and muc_x then
- module:log("debug", "Presence update with <x>, possibly desynced");
- end
-
local orig_nick = dest_occupant and dest_occupant.nick;
local event, event_name = {
@@ -604,7 +604,7 @@ function room_mt:handle_normal_presence(origin, stanza)
self:save_occupant(dest_occupant);
if orig_occupant == nil or muc_x then
- -- Send occupant list to newly joined user
+ -- Send occupant list to newly joined or desynced user
self:send_occupant_list(real_jid, function(nick, occupant) -- luacheck: ignore 212
-- Don't include self
return occupant:get_presence(real_jid) == nil;