Mercurial > prosody-hg
comparison plugins/muc/members_only.lib.lua @ 7086:6cc7c9da29ed
MUC: Rename variables to please luacheck
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 20 Jan 2016 14:46:06 +0100 |
| parents | 84e01dbb739e |
| children | 50b24b3476e6 |
comparison
equal
deleted
inserted
replaced
| 7085:343be83ddfa6 | 7086:6cc7c9da29ed |
|---|---|
| 8 -- | 8 -- |
| 9 | 9 |
| 10 local st = require "util.stanza"; | 10 local st = require "util.stanza"; |
| 11 | 11 |
| 12 local muc_util = module:require "muc/util"; | 12 local muc_util = module:require "muc/util"; |
| 13 local valid_roles, valid_affiliations = muc_util.valid_roles, muc_util.valid_affiliations; | 13 local valid_affiliations = muc_util.valid_affiliations; |
| 14 | 14 |
| 15 local function get_members_only(room) | 15 local function get_members_only(room) |
| 16 return room._data.members_only; | 16 return room._data.members_only; |
| 17 end | 17 end |
| 18 | 18 |
| 27 the service MUST remove any non-members from the room and include a | 27 the service MUST remove any non-members from the room and include a |
| 28 status code of 322 in the presence unavailable stanzas sent to those users | 28 status code of 322 in the presence unavailable stanzas sent to those users |
| 29 as well as any remaining occupants. | 29 as well as any remaining occupants. |
| 30 ]] | 30 ]] |
| 31 local occupants_changed = {}; | 31 local occupants_changed = {}; |
| 32 for nick, occupant in room:each_occupant() do | 32 for _, occupant in room:each_occupant() do |
| 33 local affiliation = room:get_affiliation(occupant.bare_jid); | 33 local affiliation = room:get_affiliation(occupant.bare_jid); |
| 34 if valid_affiliations[affiliation or "none"] <= valid_affiliations.none then | 34 if valid_affiliations[affiliation or "none"] <= valid_affiliations.none then |
| 35 occupant.role = nil; | 35 occupant.role = nil; |
| 36 room:save_occupant(occupant); | 36 room:save_occupant(occupant); |
| 37 occupants_changed[occupant] = true; | 37 occupants_changed[occupant] = true; |
