Mercurial > prosody-hg
comparison plugins/muc/request.lib.lua @ 9081:ce57c69a20e2
MUC: Split long lines [luacheck strict]
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 03 Aug 2018 17:48:41 +0200 |
| parents | 1c709e3d2e5e |
| children | 0cfb7b3593eb |
comparison
equal
deleted
inserted
replaced
| 9080:1b21f8ffaec8 | 9081:ce57c69a20e2 |
|---|---|
| 79 local formdata = { | 79 local formdata = { |
| 80 ["muc#jid"] = event.stanza.attr.from; | 80 ["muc#jid"] = event.stanza.attr.from; |
| 81 ["muc#roomnick"] = nick; | 81 ["muc#roomnick"] = nick; |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 local message = st.message({ type = "normal"; from = event.room.jid }):add_child(voice_request_form:form(formdata)):up(); | 84 local message = st.message({ type = "normal"; from = event.room.jid }) |
| 85 :add_direct_child(voice_request_form:form(formdata)); | |
| 85 | 86 |
| 86 event.room:broadcast(message, function (_, occupant) | 87 event.room:broadcast(message, function (_, occupant) |
| 87 return occupant.role == "moderator"; | 88 return occupant.role == "moderator"; |
| 88 end); | 89 end); |
| 89 end | 90 end |
| 103 module:log("debug", "%s did not grant voice", jid_resource(occupant.nick)); | 104 module:log("debug", "%s did not grant voice", jid_resource(occupant.nick)); |
| 104 return; | 105 return; |
| 105 end | 106 end |
| 106 | 107 |
| 107 if not affected_occupant then | 108 if not affected_occupant then |
| 108 module:log("debug", "%s tried to grant voice to unknown occupant %s", jid_resource(occupant.nick), event.fields["muc#jid"]); | 109 module:log("debug", "%s tried to grant voice to unknown occupant %s", |
| 110 jid_resource(occupant.nick), event.fields["muc#jid"]); | |
| 109 return; | 111 return; |
| 110 end | 112 end |
| 111 | 113 |
| 112 if affected_occupant.role ~= "visitor" then | 114 if affected_occupant.role ~= "visitor" then |
| 113 module:log("debug", "%s tried to grant voice to %s but they already have it", jid_resource(occupant.nick), jid_resource(occupant.jid)); | 115 module:log("debug", "%s tried to grant voice to %s but they already have it", |
| 116 jid_resource(occupant.nick), jid_resource(occupant.jid)); | |
| 114 return; | 117 return; |
| 115 end | 118 end |
| 116 | 119 |
| 117 module:log("debug", "%s granted voice to %s", jid_resource(event.occupant.nick), jid_resource(occupant.jid)); | 120 module:log("debug", "%s granted voice to %s", jid_resource(event.occupant.nick), jid_resource(occupant.jid)); |
| 118 local ok, errtype, err = event.room:set_role(actor, affected_occupant.nick, "participant", "Voice granted"); | 121 local ok, errtype, err = event.room:set_role(actor, affected_occupant.nick, "participant", "Voice granted"); |
