# HG changeset patch # User Kim Alvefur # Date 1640192864 -3600 # Node ID 7cd94469d15fa1f9aa962d75961a041a05e055e6 # Parent 0b14b541fd277665956be9687d79f2a49a1db36e 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. diff -r 0b14b541fd27 -r 7cd94469d15f plugins/mod_roster.lua --- a/plugins/mod_roster.lua Wed Dec 22 13:06:32 2021 +0100 +++ b/plugins/mod_roster.lua Wed Dec 22 18:07:44 2021 +0100 @@ -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 @@ 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;