comparison plugins/muc/muc.lib.lua @ 8169:a6574fdf8734

MUC: Only send status code 307 to the user being kicked, not everyone (fixes #939)
author Kim Alvefur <zash@zash.se>
date Mon, 26 Jun 2017 01:03:51 +0200
parents 47cb54a08336
children 627689c058aa
comparison
equal deleted inserted replaced
8168:45be94611593 8169:a6574fdf8734
347 error_message = error_message..": "..text; 347 error_message = error_message..": "..text;
348 end 348 end
349 occupant:set_session(real_jid, st.presence({type="unavailable"}) 349 occupant:set_session(real_jid, st.presence({type="unavailable"})
350 :tag('status'):text(error_message)); 350 :tag('status'):text(error_message));
351 self:save_occupant(occupant); 351 self:save_occupant(occupant);
352 local x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user";}) 352 local x = {
353 :tag("status", {code = "307"}) 353 base = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user";});
354 self = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user";})
355 :tag("status", {code = "307"});
356 };
354 self:publicise_occupant_status(occupant, x); 357 self:publicise_occupant_status(occupant, x);
355 if occupant.jid == real_jid then -- Was last session 358 if occupant.jid == real_jid then -- Was last session
356 module:fire_event("muc-occupant-left", {room = self; nick = occupant.nick; occupant = occupant;}); 359 module:fire_event("muc-occupant-left", {room = self; nick = occupant.nick; occupant = occupant;});
357 end 360 end
358 return true; 361 return true;
1296 end 1299 end
1297 end 1300 end
1298 1301
1299 local x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user"}); 1302 local x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user"});
1300 if not role then 1303 if not role then
1301 x:tag("status", {code = "307"}):up(); 1304 x = {
1305 base = x;
1306 self = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user"})
1307 :tag("status", {code = "307"}):up();
1308 };
1302 end 1309 end
1303 occupant.role = role; 1310 occupant.role = role;
1304 self:save_occupant(occupant); 1311 self:save_occupant(occupant);
1305 self:publicise_occupant_status(occupant, x, nil, actor, reason); 1312 self:publicise_occupant_status(occupant, x, nil, actor, reason);
1306 if role == nil then 1313 if role == nil then