Comparison

util/pubsub.lua @ 8936:7b75c7ec926e

util.pubsub: Normalize JID used as affiliation XEP-0060 4.1 Affiliations > All affiliations MUST be based on a bare JID
author Kim Alvefur <zash@zash.se>
date Tue, 26 Jun 2018 19:49:29 +0200
parent 8816:0f9d5cfa84f9
child 8941:f0beba9c2822
comparison
equal deleted inserted replaced
8935:a825ef6de45a 8936:7b75c7ec926e
114 -- 114 --
115 local node_obj = self.nodes[node]; 115 local node_obj = self.nodes[node];
116 if not node_obj then 116 if not node_obj then
117 return false, "item-not-found"; 117 return false, "item-not-found";
118 end 118 end
119 jid = self.config.normal_jid(jid);
119 node_obj.affiliations[jid] = affiliation; 120 node_obj.affiliations[jid] = affiliation;
120 local _, jid_sub = self:get_subscription(node, true, jid); 121 local _, jid_sub = self:get_subscription(node, true, jid);
121 if not jid_sub and not self:may(node, jid, "be_unsubscribed") then 122 if not jid_sub and not self:may(node, jid, "be_unsubscribed") then
122 local ok, err = self:add_subscription(node, true, jid); 123 local ok, err = self:add_subscription(node, true, jid);
123 if not ok then 124 if not ok then