Software /
code /
prosody
Comparison
plugins/muc/mod_muc.lua @ 9048:c58be87e62d0
MUC: Return 'gone' error for destroyed rooms in other cases than attempted join
Lock expiry -> Reset
Admin wants to join -> Reset
Still locked -> cancel, gone
Don't return error in response to an error
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 16 Jul 2018 12:19:19 +0200 |
parent | 9035:173c0e16e704 |
child | 9049:5870a0a6d4b6 |
comparison
equal
deleted
inserted
replaced
9047:ab3488ee3ca5 | 9048:c58be87e62d0 |
---|---|
397 local origin, stanza = event.origin, event.stanza; | 397 local origin, stanza = event.origin, event.stanza; |
398 local room_jid = jid_bare(stanza.attr.to); | 398 local room_jid = jid_bare(stanza.attr.to); |
399 local room = get_room_from_jid(room_jid); | 399 local room = get_room_from_jid(room_jid); |
400 | 400 |
401 if room and room._data.destroyed then | 401 if room and room._data.destroyed then |
402 if stanza.attr.type == nil and stanza.name == "presence" then | 402 if room._data.locked < os.time() or (is_admin(stanza.attr.from) and stanza.name == "presence" and stanza.attr.type == nil) then |
403 if is_admin(stanza.attr.from) or room._data.locked < os.time() then | 403 -- Allow the room to be recreated by admin or after time has passed |
404 -- Allow the room to be recreated by admin or after time has passed | 404 delete_room(room); |
405 delete_room(room); | 405 room = nil; |
406 room = nil; | 406 else |
407 else | 407 if stanza.attr.type ~= "error" then |
408 local reply = st.error_reply(stanza, "cancel", "gone", room._data.reason) | 408 local reply = st.error_reply(stanza, "cancel", "gone", room._data.reason) |
409 if room._data.newjid then | 409 if room._data.newjid then |
410 local uri = "xmpp:"..room._data.newjid.."?join"; | 410 local uri = "xmpp:"..room._data.newjid.."?join"; |
411 reply:get_child("error"):child_with_name("gone"):text(uri); | 411 reply:get_child("error"):child_with_name("gone"):text(uri); |
412 end | 412 end |
413 event.origin.send(reply); | 413 event.origin.send(reply); |
414 return true; | |
415 end | 414 end |
415 return true; | |
416 end | 416 end |
417 end | 417 end |
418 | 418 |
419 if room == nil then | 419 if room == nil then |
420 -- Watch presence to create rooms | 420 -- Watch presence to create rooms |