Comparison

plugins/muc/subject.lib.lua @ 9684:b2d6b79c9513

MUC/subject: Don't consider messages with <body> or <subject> (fixes #667)
author Kim Alvefur <zash@zash.se>
date Tue, 04 Dec 2018 19:49:31 +0100
parent 9035:173c0e16e704
child 11141:a5acd6354845
comparison
equal deleted inserted replaced
9683:bf32f2282b18 9684:b2d6b79c9513
92 -- e.g. body will be ignored; even if the subject change was not allowed 92 -- e.g. body will be ignored; even if the subject change was not allowed
93 module:hook("muc-occupant-groupchat", function(event) 93 module:hook("muc-occupant-groupchat", function(event)
94 local stanza = event.stanza; 94 local stanza = event.stanza;
95 local subject = stanza:get_child("subject"); 95 local subject = stanza:get_child("subject");
96 if subject then 96 if subject then
97 if stanza:get_child("body") or stanza:get_child("thread") then
98 -- Note: A message with a <subject/> and a <body/> or a <subject/> and
99 -- a <thread/> is a legitimate message, but it SHALL NOT be interpreted
100 -- as a subject change.
101 return;
102 end
97 local room = event.room; 103 local room = event.room;
98 local occupant = event.occupant; 104 local occupant = event.occupant;
99 -- Role check for subject changes 105 -- Role check for subject changes
100 local role_rank = valid_roles[occupant and occupant.role or "none"]; 106 local role_rank = valid_roles[occupant and occupant.role or "none"];
101 if role_rank >= valid_roles.moderator or 107 if role_rank >= valid_roles.moderator or