# HG changeset patch # User Kim Alvefur # Date 1546026961 -3600 # Node ID cc01bb7a3305e75dd92e6135cbc4579cd5374c88 # Parent 9ab9aabafa80d53d5901d507a370261d9cf4fef3 mod_admin_telnet: Invert host existence check Simplifies and reduces indentation diff -r 9ab9aabafa80 -r cc01bb7a3305 plugins/mod_admin_telnet.lua --- 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 = {};