aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-12-22 18:07:44 +0100
committerKim Alvefur <zash@zash.se>2021-12-22 18:07:44 +0100
commit84447b8d9dd02db64e3a8a7d72220c117b4bc725 (patch)
tree0403332a9cdc754a398457fdc41c248b8a4f77c5
parent663028421f6905cb9ee68fe795af71a60564ae53 (diff)
downloadprosody-84447b8d9dd02db64e3a8a7d72220c117b4bc725.tar.gz
prosody-84447b8d9dd02db64e3a8a7d72220c117b4bc725.zip
mod_roster: Improve readability of bare-JID check
Silences luacheck too All we care about is that it is a bare JID, not a full JID with a resource, since those are forbidden in rosters.
-rw-r--r--plugins/mod_roster.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/mod_roster.lua b/plugins/mod_roster.lua
index 29466d5b..37fa197a 100644
--- a/plugins/mod_roster.lua
+++ b/plugins/mod_roster.lua
@@ -10,6 +10,7 @@
local st = require "util.stanza"
local jid_split = require "util.jid".split;
+local jid_resource = require "util.jid".resource;
local jid_prep = require "util.jid".prep;
local tonumber = tonumber;
local pairs = pairs;
@@ -66,8 +67,7 @@ module:hook("iq/self/jabber:iq:roster:query", function(event)
local item = query.tags[1];
local from_node, from_host = jid_split(stanza.attr.from);
local jid = jid_prep(item.attr.jid);
- local node, host, resource = jid_split(jid);
- if not resource and host then
+ if jid and not jid_resource(jid) then
if jid ~= from_node.."@"..from_host then
if item.attr.subscription == "remove" then
local roster = session.roster;