Changeset

7477:f9e470026042

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Fri, 08 Jul 2016 22:01:10 +0200
parents 7467:9a73c85baffe (current diff) 7476:42d8955be784 (diff)
children 7488:cdabf8199903
files net/server_select.lua plugins/mod_admin_telnet.lua
diffstat 8 files changed, 23 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/.luacheckrc	Fri Jul 08 15:12:44 2016 +0200
+++ b/.luacheckrc	Fri Jul 08 22:01:10 2016 +0200
@@ -10,3 +10,14 @@
 files["plugins/"] = {
 	ignore = { "122/module" };
 }
+files["tests/"] = {
+	ignore = {
+		"113/assert_equal",
+		"113/assert_table",
+		"113/assert_function",
+		"113/assert_string",
+		"113/assert_boolean",
+		"113/assert_is",
+		"113/assert_is_not",
+	};
+}
--- a/net/adns.lua	Fri Jul 08 15:12:44 2016 +0200
+++ b/net/adns.lua	Fri Jul 08 22:01:10 2016 +0200
@@ -11,7 +11,6 @@
 
 local log = require "util.logger".init("adns");
 
-local t_insert, t_remove = table.insert, table.remove;
 local coroutine, tostring, pcall = coroutine, tostring, pcall;
 
 local function dummy_send(sock, data, i, j) return (j-i)+1; end
--- a/net/dns.lua	Fri Jul 08 15:12:44 2016 +0200
+++ b/net/dns.lua	Fri Jul 08 22:01:10 2016 +0200
@@ -190,7 +190,7 @@
 local rrs_metatable = {};    -- - - - - - - - - - - - - - - - - -  rrs_metatable
 function rrs_metatable.__tostring(rrs)
 	local t = {};
-	for i,rr in ipairs(rrs) do
+	for _, rr in ipairs(rrs) do
 		append(t, tostring(rr)..'\n');
 	end
 	return table.concat(t);
@@ -841,7 +841,7 @@
 	rset = rset or self.socket;
 
 	local response;
-	for i,sock in pairs(rset) do
+	for _, sock in pairs(rset) do
 
 		if self.socketset[sock] then
 			local packet = sock:receive();
@@ -852,7 +852,7 @@
 					--print('received response');
 					--self.print(response);
 
-					for j,rr in pairs(response.answer) do
+					for _, rr in pairs(response.answer) do
 						if rr.name:sub(-#response.question[1].name, -1) == response.question[1].name then
 							self:remember(rr, response.question[1].type)
 						end
@@ -894,7 +894,7 @@
 		--print('received response');
 		--self.print(response);
 
-		for j,rr in pairs(response.answer) do
+		for _, rr in pairs(response.answer) do
 			self:remember(rr, response.question[1].type);
 		end
 
--- a/net/server_select.lua	Fri Jul 08 15:12:44 2016 +0200
+++ b/net/server_select.lua	Fri Jul 08 22:01:10 2016 +0200
@@ -904,7 +904,7 @@
 		end
 
 		local read, write, err = socket_select( _readlist, _sendlist, math_min(_selecttimeout, next_timer_time) )
-		for i, socket in ipairs( write ) do -- send data waiting in writequeues
+		for _, socket in ipairs( write ) do -- send data waiting in writequeues
 			local handler = _socketlist[ socket ]
 			if handler then
 				handler.sendbuffer( )
@@ -913,7 +913,7 @@
 				out_put "server.lua: found no handler and closed socket (writelist)"	-- this should not happen
 			end
 		end
-		for i, socket in ipairs( read ) do -- receive data
+		for _, socket in ipairs( read ) do -- receive data
 			local handler = _socketlist[ socket ]
 			if handler then
 				handler.readbuffer( )
--- a/plugins/mod_admin_telnet.lua	Fri Jul 08 15:12:44 2016 +0200
+++ b/plugins/mod_admin_telnet.lua	Fri Jul 08 22:01:10 2016 +0200
@@ -769,7 +769,6 @@
 end
 
 function def_env.s2s:showcert(domain)
-	local ser = require "util.serialization".serialize;
 	local print = self.session.print;
 	local s2s_sessions = module:shared"/*/s2s/sessions";
 	local domain_sessions = set.new(array.collect(values(s2s_sessions)))
@@ -994,11 +993,11 @@
 end
 
 function def_env.muc:create(room_jid)
-	local room, host = check_muc(room_jid);
+	local room_name, host = check_muc(room_jid);
 	if not room_name then
 		return room_name, host;
 	end
-	if not room then return nil, host end
+	if not room_name then return nil, host end
 	if hosts[host].modules.muc.rooms[room_jid] then return nil, "Room exists already" end
 	return hosts[host].modules.muc.create_room(room_jid);
 end
--- a/plugins/mod_presence.lua	Fri Jul 08 15:12:44 2016 +0200
+++ b/plugins/mod_presence.lua	Fri Jul 08 22:01:10 2016 +0200
@@ -130,7 +130,7 @@
 	if h and h.type == "local" then
 		local u = h.sessions[user];
 		if u then
-			for k, session in pairs(u.sessions) do
+			for _, session in pairs(u.sessions) do
 				local pres = session.presence;
 				if pres then
 					if stanza then pres = stanza; pres.attr.from = session.full_jid; end
--- a/tests/test_util_jid.lua	Fri Jul 08 15:12:44 2016 +0200
+++ b/tests/test_util_jid.lua	Fri Jul 08 22:01:10 2016 +0200
@@ -19,7 +19,7 @@
 
 
 function split(split)
-	function test(input_jid, expected_node, expected_server, expected_resource)
+	local function test(input_jid, expected_node, expected_server, expected_resource)
 		local rnode, rserver, rresource = split(input_jid);
 		assert_equal(expected_node, rnode, "split("..tostring(input_jid)..") failed");
 		assert_equal(expected_server, rserver, "split("..tostring(input_jid)..") failed");
--- a/tests/test_util_multitable.lua	Fri Jul 08 15:12:44 2016 +0200
+++ b/tests/test_util_multitable.lua	Fri Jul 08 22:01:10 2016 +0200
@@ -8,7 +8,7 @@
 
 
 function new(new, multitable)
-	mt = new();
+	local mt = new();
 	assert_table(mt, "Multitable is a table");
 	assert_function(mt.add, "Multitable has method add");
 	assert_function(mt.get, "Multitable has method get");
@@ -40,7 +40,7 @@
 		return assert_equal(select(2, has_items(list, ...)), "has-all", message or "List has all expected items, and no more", 2);
 	end
 
-	mt = multitable.new();
+	local mt = multitable.new();
 
 	local trigger1, trigger2, trigger3 = {}, {}, {};
 	local item1, item2, item3 = {}, {}, {};