Mercurial > prosody-hg
comparison plugins/muc/subject.lib.lua @ 7365:2d502878b784
MUC/subject: Fix reference to room for save call (self, not room)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 18 Apr 2016 19:09:10 +0200 |
| parents | d69521003e91 |
| children | e16b3fd0bd80 |
comparison
equal
deleted
inserted
replaced
| 7364:9ea3094b1fca | 7365:2d502878b784 |
|---|---|
| 74 -- e.g. body will be ignored; even if the subject change was not allowed | 74 -- e.g. body will be ignored; even if the subject change was not allowed |
| 75 module:hook("muc-occupant-groupchat", function(event) | 75 module:hook("muc-occupant-groupchat", function(event) |
| 76 local stanza = event.stanza; | 76 local stanza = event.stanza; |
| 77 local subject = stanza:get_child("subject"); | 77 local subject = stanza:get_child("subject"); |
| 78 if subject then | 78 if subject then |
| 79 local room = event.room; | |
| 79 local occupant = event.occupant; | 80 local occupant = event.occupant; |
| 80 -- Role check for subject changes | 81 -- Role check for subject changes |
| 81 local role_rank = valid_roles[occupant and occupant.role or "none"]; | 82 local role_rank = valid_roles[occupant and occupant.role or "none"]; |
| 82 if role_rank >= valid_roles.moderator or | 83 if role_rank >= valid_roles.moderator or |
| 83 ( role_rank >= valid_roles.participant and get_changesubject(event.room) ) then -- and participant | 84 ( role_rank >= valid_roles.participant and get_changesubject(room) ) then -- and participant |
| 84 set_subject(event.room, occupant.nick, subject:get_text()); | 85 set_subject(room, occupant.nick, subject:get_text()); |
| 85 room:save(); | 86 room:save(); |
| 86 return true; | 87 return true; |
| 87 else | 88 else |
| 88 event.origin.send(st.error_reply(stanza, "auth", "forbidden")); | 89 event.origin.send(st.error_reply(stanza, "auth", "forbidden")); |
| 89 return true; | 90 return true; |
