aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-12-28 20:56:01 +0100
committerKim Alvefur <zash@zash.se>2018-12-28 20:56:01 +0100
commit07ab17120c03070c138137dd30d3fb601716a8bc (patch)
tree0119c1045b73e46b845ef81560d446371165b070
parent5806d67e82705701d6b778d4b6399724a035c528 (diff)
downloadprosody-07ab17120c03070c138137dd30d3fb601716a8bc.tar.gz
prosody-07ab17120c03070c138137dd30d3fb601716a8bc.zip
mod_admin_telnet: Invert host existence check
Simplifies and reduces indentation
-rw-r--r--plugins/mod_admin_telnet.lua9
1 files changed, 4 insertions, 5 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index 63136d63..5ba88b84 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -1067,13 +1067,12 @@ def_env.xmpp = {};
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 = {};