Comparison

plugins/muc/muc.lib.lua @ 10550:0566b45da987

MUC: Remove some unused variables [luacheck]
author Kim Alvefur <zash@zash.se>
date Mon, 23 Dec 2019 22:23:29 +0100
parent 10451:347d16d70280
child 10553:4d8119ffd433
comparison
equal deleted inserted replaced
10549:3e50f86e5a2e 10550:0566b45da987
383 383
384 function room_mt:handle_kickable(origin, stanza) -- luacheck: ignore 212 384 function room_mt:handle_kickable(origin, stanza) -- luacheck: ignore 212
385 local real_jid = stanza.attr.from; 385 local real_jid = stanza.attr.from;
386 local occupant = self:get_occupant_by_real_jid(real_jid); 386 local occupant = self:get_occupant_by_real_jid(real_jid);
387 if occupant == nil then return nil; end 387 if occupant == nil then return nil; end
388 local type, condition, text = stanza:get_error(); 388 local _, condition, text = stanza:get_error();
389 local error_message = "Kicked: "..(condition and condition:gsub("%-", " ") or "presence error"); 389 local error_message = "Kicked: "..(condition and condition:gsub("%-", " ") or "presence error");
390 if text and self:get_whois() == "anyone" then 390 if text and self:get_whois() == "anyone" then
391 error_message = error_message..": "..text; 391 error_message = error_message..": "..text;
392 end 392 end
393 occupant:set_session(real_jid, st.presence({type="unavailable"}) 393 occupant:set_session(real_jid, st.presence({type="unavailable"})
1252 function room_mt:route_stanza(stanza) -- luacheck: ignore 212 1252 function room_mt:route_stanza(stanza) -- luacheck: ignore 212
1253 module:send(stanza); 1253 module:send(stanza);
1254 end 1254 end
1255 1255
1256 function room_mt:get_affiliation(jid) 1256 function room_mt:get_affiliation(jid)
1257 local node, host, resource = jid_split(jid); 1257 local node, host = jid_split(jid);
1258 -- Affiliations are granted, revoked, and maintained based on the user's bare JID. 1258 -- Affiliations are granted, revoked, and maintained based on the user's bare JID.
1259 local bare = node and node.."@"..host or host; 1259 local bare = node and node.."@"..host or host;
1260 local result = self._affiliations[bare]; 1260 local result = self._affiliations[bare];
1261 if not result and self._affiliations[host] == "outcast" then result = "outcast"; end -- host banned 1261 if not result and self._affiliations[host] == "outcast" then result = "outcast"; end -- host banned
1262 return result; 1262 return result;
1275 end 1275 end
1276 1276
1277 function room_mt:set_affiliation(actor, jid, affiliation, reason, data) 1277 function room_mt:set_affiliation(actor, jid, affiliation, reason, data)
1278 if not actor then return nil, "modify", "not-acceptable"; end; 1278 if not actor then return nil, "modify", "not-acceptable"; end;
1279 1279
1280 local node, host, resource = jid_split(jid); 1280 local node, host = jid_split(jid);
1281 if not host then return nil, "modify", "not-acceptable"; end 1281 if not host then return nil, "modify", "not-acceptable"; end
1282 jid = jid_join(node, host); -- Bare 1282 jid = jid_join(node, host); -- Bare
1283 local is_host_only = node == nil; 1283 local is_host_only = node == nil;
1284 1284
1285 if valid_affiliations[affiliation or "none"] == nil then 1285 if valid_affiliations[affiliation or "none"] == nil then
1569 -- Old storage format 1569 -- Old storage format
1570 room._affiliations = frozen._affiliations; 1570 room._affiliations = frozen._affiliations;
1571 else 1571 else
1572 -- New storage format 1572 -- New storage format
1573 for jid, data in pairs(frozen) do 1573 for jid, data in pairs(frozen) do
1574 local node, host, resource = jid_split(jid); 1574 local _, host, resource = jid_split(jid);
1575 if host:sub(1,1) ~= "_" and not resource and type(data) == "string" then 1575 if host:sub(1,1) ~= "_" and not resource and type(data) == "string" then
1576 -- bare jid: affiliation 1576 -- bare jid: affiliation
1577 room._affiliations[jid] = data; 1577 room._affiliations[jid] = data;
1578 end 1578 end
1579 end 1579 end