Software / code / prosody
Changeset
12101:7cd94469d15f
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.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 22 Dec 2021 18:07:44 +0100 |
| parents | 12100:0b14b541fd27 |
| children | 12102:949c2b52f51e |
| files | plugins/mod_roster.lua |
| diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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;