Software /
code /
prosody
Changeset
9734:cc01bb7a3305
mod_admin_telnet: Invert host existence check
Simplifies and reduces indentation
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 28 Dec 2018 20:56:01 +0100 |
parents | 9733:9ab9aabafa80 |
children | 9735:2d8ca54ecbc6 |
files | plugins/mod_admin_telnet.lua |
diffstat | 1 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua Fri Dec 28 20:51:31 2018 +0100 +++ b/plugins/mod_admin_telnet.lua Fri Dec 28 20:56:01 2018 +0100 @@ -1067,13 +1067,12 @@ local st = require "util.stanza"; function def_env.xmpp:ping(localhost, remotehost) - if prosody.hosts[localhost] then - module:send(st.iq{ from=localhost, to=remotehost, type="get", id="ping" } - :tag("ping", {xmlns="urn:xmpp:ping"}), prosody.hosts[localhost]); - return true, "Sent ping"; - else + if not prosody.hosts[localhost] then return nil, "No such host"; end + module:send(st.iq{ from=localhost, to=remotehost, type="get", id="ping" } + :tag("ping", {xmlns="urn:xmpp:ping"}), prosody.hosts[localhost]); + return true, "Sent ping"; end def_env.dns = {};