diff options
author | Kim Alvefur <zash@zash.se> | 2016-09-29 22:04:59 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-09-29 22:04:59 +0200 |
commit | 8874c0d321b22e0f897dfc28f788373f6b36b70b (patch) | |
tree | 62222319c73f0c789d01b270c4c745f016a0c44c /plugins/muc/muc.lib.lua | |
parent | fa1559e19cb42b43dac7b27213639071cd257462 (diff) | |
download | prosody-8874c0d321b22e0f897dfc28f788373f6b36b70b.tar.gz prosody-8874c0d321b22e0f897dfc28f788373f6b36b70b.zip |
MUC: Insert the appropriate status code (210) if the nickname is overridden
Diffstat (limited to 'plugins/muc/muc.lib.lua')
-rw-r--r-- | plugins/muc/muc.lib.lua | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 1e433db0..aea6848c 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -491,6 +491,7 @@ function room_mt:handle_normal_presence(origin, stanza) is_first_session = is_first_dest_session; is_last_session = is_last_orig_session; }; + local orig_nick = dest_occupant and dest_occupant.jid; if orig_occupant == nil then event_name = "muc-occupant-pre-join"; event.occupant = dest_occupant; @@ -503,6 +504,7 @@ function room_mt:handle_normal_presence(origin, stanza) event.dest_occupant = dest_occupant; end if module:fire_event(event_name, event) then return true; end + local nick_overridden = dest_occupant and orig_nick ~= dest_occupant.nick; -- Check for nick conflicts if dest_occupant ~= nil and not is_first_dest_session and bare_jid ~= jid_bare(dest_occupant.bare_jid) then -- new nick or has different bare real jid @@ -555,6 +557,7 @@ function room_mt:handle_normal_presence(origin, stanza) dest_nick = nil; -- set dest_nick to nil; so general populance doesn't see it for whole orig_occupant end end + self:save_occupant(orig_occupant); self:publicise_occupant_status(orig_occupant, orig_x, dest_nick); @@ -575,6 +578,9 @@ function room_mt:handle_normal_presence(origin, stanza) if orig_occupant == nil and self:get_whois() == "anyone" then dest_x:tag("status", {code = "100"}):up(); end + if nick_overridden then + dest_x:tag("status", {code = "210"}):up(); + end self:save_occupant(dest_occupant); if orig_occupant == nil or muc_x then |