Software / code / prosody
Comparison
plugins/mod_message.lua @ 7956:beaeafedc2d7
mod_message: Return early on messages of type error (silences empty if branch warning) [luacheck]
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 06 Mar 2017 15:27:37 +0100 |
| parent | 7718:c58075c4d375 |
| child | 8136:aba6d148e674 |
comparison
equal
deleted
inserted
replaced
| 7955:bba71bfe2154 | 7956:beaeafedc2d7 |
|---|---|
| 18 local function process_to_bare(bare, origin, stanza) | 18 local function process_to_bare(bare, origin, stanza) |
| 19 local user = bare_sessions[bare]; | 19 local user = bare_sessions[bare]; |
| 20 | 20 |
| 21 local t = stanza.attr.type; | 21 local t = stanza.attr.type; |
| 22 if t == "error" then | 22 if t == "error" then |
| 23 -- discard | 23 return true; -- discard |
| 24 elseif t == "groupchat" then | 24 elseif t == "groupchat" then |
| 25 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); | 25 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
| 26 elseif t == "headline" then | 26 elseif t == "headline" then |
| 27 if user and stanza.attr.to == bare then | 27 if user and stanza.attr.to == bare then |
| 28 for _, session in pairs(user.sessions) do | 28 for _, session in pairs(user.sessions) do |