Changeset

7686:8d6f367bed8c

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Fri, 07 Oct 2016 16:52:18 +0200
parents 7669:b332db1baf0b (current diff) 7685:8e43a05e2374 (diff)
children 7687:ae24deae6488
files plugins/mod_s2s/mod_s2s.lua plugins/muc/muc.lib.lua prosodyctl util/dependencies.lua
diffstat 8 files changed, 59 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Sat Oct 01 23:20:58 2016 +0200
+++ b/.hgtags	Fri Oct 07 16:52:18 2016 +0200
@@ -58,3 +58,4 @@
 b1c84d220c409b7b17cd41e850576db253406b0a 0.9.8
 7ec52755622f1009aaf7b02fc9bc91e8ad9974be 0.9.9
 352270bc04393910a567b569ede03358dbb728b5 0.9.10
+8613086779fa9276615c2af066d2a10c38d0c86e 0.9.11
--- a/Makefile	Sat Oct 01 23:20:58 2016 +0200
+++ b/Makefile	Fri Oct 07 16:52:18 2016 +0200
@@ -13,6 +13,12 @@
 INSTALLEDMODULES = $(LIBDIR)/prosody/modules
 INSTALLEDDATA = $(DATADIR)
 
+INSTALL=install -p
+INSTALL_DATA=$(INSTALL) -m644
+INSTALL_EXEC=$(INSTALL) -m755
+MKDIR=install -d
+MKDIR_PRIVATE=$(MKDIR) -m750
+
 .PHONY: all clean install
 
 all: prosody.install prosodyctl.install prosody.cfg.lua.install prosody.version
@@ -22,27 +28,32 @@
 endif
 
 install: prosody.install prosodyctl.install prosody.cfg.lua.install util/encodings.so util/encodings.so util/pposix.so util/signal.so
-	install -d $(BIN) $(CONFIG) $(MODULES) $(SOURCE)
-	install -m750 -d $(DATA)
-	install -d $(MAN)/man1
-	install -d $(CONFIG)/certs
-	install -d $(SOURCE)/core $(SOURCE)/net $(SOURCE)/util
-	install -m755 ./prosody.install $(BIN)/prosody
-	install -m755 ./prosodyctl.install $(BIN)/prosodyctl
-	install -m644 core/*.lua $(SOURCE)/core
-	install -m644 net/*.lua $(SOURCE)/net
-	install -d $(SOURCE)/net/http $(SOURCE)/net/websocket
-	install -m644 net/http/*.lua $(SOURCE)/net/http
-	install -m644 net/websocket/*.lua $(SOURCE)/net/websocket
-	install -m644 util/*.lua $(SOURCE)/util
-	install -m644 util/*.so $(SOURCE)/util
-	install -d $(SOURCE)/util/sasl
-	install -m644 util/sasl/* $(SOURCE)/util/sasl
-	umask 0022 && cp -r plugins/* $(MODULES)
-	install -m644 certs/* $(CONFIG)/certs
-	install -m644 man/prosodyctl.man $(MAN)/man1/prosodyctl.1
-	test -f $(CONFIG)/prosody.cfg.lua || install -m644 prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua
-	-test -f prosody.version && install -m644 prosody.version $(SOURCE)/prosody.version
+	$(MKDIR) $(BIN) $(CONFIG) $(MODULES) $(SOURCE)
+	$(MKDIR_PRIVATE) $(DATA)
+	$(MKDIR) $(MAN)/man1
+	$(MKDIR) $(CONFIG)/certs
+	$(MKDIR) $(SOURCE)/core $(SOURCE)/net $(SOURCE)/util
+	$(INSTALL_EXEC) ./prosody.install $(BIN)/prosody
+	$(INSTALL_EXEC) ./prosodyctl.install $(BIN)/prosodyctl
+	$(INSTALL_DATA) core/*.lua $(SOURCE)/core
+	$(INSTALL_DATA) net/*.lua $(SOURCE)/net
+	$(MKDIR) $(SOURCE)/net/http $(SOURCE)/net/websocket
+	$(INSTALL_DATA) net/http/*.lua $(SOURCE)/net/http
+	$(INSTALL_DATA) net/websocket/*.lua $(SOURCE)/net/websocket
+	$(INSTALL_DATA) util/*.lua $(SOURCE)/util
+	$(INSTALL_DATA) util/*.so $(SOURCE)/util
+	$(MKDIR) $(SOURCE)/util/sasl
+	$(INSTALL_DATA) util/sasl/*.lua $(SOURCE)/util/sasl
+	$(MKDIR) $(MODULES)/mod_s2s $(MODULES)/mod_pubsub $(MODULES)/adhoc $(MODULES)/muc
+	$(INSTALL_DATA) plugins/*.lua $(MODULES)
+	$(INSTALL_DATA) plugins/mod_s2s/*.lua $(MODULES)
+	$(INSTALL_DATA) plugins/mod_pubsub/*.lua $(MODULES)
+	$(INSTALL_DATA) plugins/adhoc/*.lua $(MODULES)
+	$(INSTALL_DATA) plugins/muc/*.lua $(MODULES)
+	$(INSTALL_DATA) certs/* $(CONFIG)/certs
+	$(INSTALL_DATA) man/prosodyctl.man $(MAN)/man1/prosodyctl.1
+	test -f $(CONFIG)/prosody.cfg.lua || $(INSTALL_DATA) prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua
+	-test -f prosody.version && $(INSTALL_DATA) prosody.version $(SOURCE)/prosody.version
 	$(MAKE) install -C util-src
 
 clean:
--- a/plugins/mod_carbons.lua	Sat Oct 01 23:20:58 2016 +0200
+++ b/plugins/mod_carbons.lua	Fri Oct 07 16:52:18 2016 +0200
@@ -1,5 +1,5 @@
 -- XEP-0280: Message Carbons implementation for Prosody
--- Copyright (C) 2011 Kim Alvefur
+-- Copyright (C) 2011-2016 Kim Alvefur
 --
 -- This file is MIT/X11 licensed.
 
@@ -67,7 +67,7 @@
 	elseif stanza:get_child("no-copy", "urn:xmpp:hints") then
 		module:log("debug", "Message has no-copy hint, ignoring");
 		return
-	elseif stanza:get_child("x", "http://jabber.org/protocol/muc#user") then
+	elseif not c2s and bare_jid == orig_from and stanza:get_child("x", "http://jabber.org/protocol/muc#user") then
 		module:log("debug", "MUC PM, ignoring");
 		return
 	end
--- a/plugins/mod_s2s/mod_s2s.lua	Sat Oct 01 23:20:58 2016 +0200
+++ b/plugins/mod_s2s/mod_s2s.lua	Fri Oct 07 16:52:18 2016 +0200
@@ -389,7 +389,7 @@
 	elseif session.direction == "outgoing" then
 		session.notopen = nil;
 		if not attr.id then
-			log("error", "Stream response from %s did not give us a stream id!", session.to_host);
+			log("warn", "Stream response did not give us a stream id!");
 			session:close({ condition = "undefined-condition", text = "Missing stream ID" });
 			return;
 		end
--- a/plugins/mod_s2s/s2sout.lib.lua	Sat Oct 01 23:20:58 2016 +0200
+++ b/plugins/mod_s2s/s2sout.lib.lua	Fri Oct 07 16:52:18 2016 +0200
@@ -176,6 +176,8 @@
 						log("debug", "DNS reply for %s gives us %s", connect_host, ip.a);
 						IPs[#IPs+1] = new_ip(ip.a, "IPv4");
 					end
+				elseif err then
+					log("debug", "Error in DNS lookup: %s", err);
 				end
 
 				if have_other_result then
@@ -212,6 +214,8 @@
 						log("debug", "DNS reply for %s gives us %s", connect_host, ip.aaaa);
 						IPs[#IPs+1] = new_ip(ip.aaaa, "IPv6");
 					end
+				elseif err then
+					log("debug", "Error in DNS lookup: %s", err);
 				end
 
 				if have_other_result then
--- a/plugins/muc/muc.lib.lua	Sat Oct 01 23:20:58 2016 +0200
+++ b/plugins/muc/muc.lib.lua	Fri Oct 07 16:52:18 2016 +0200
@@ -812,6 +812,7 @@
 	x:up();
 	self:clear(x);
 	module:fire_event("muc-room-destroyed", { room = self });
+	return true;
 end
 
 function room_mt:handle_disco_info_get_query(origin, stanza)
--- a/util/datamanager.lua	Sat Oct 01 23:20:58 2016 +0200
+++ b/util/datamanager.lua	Fri Oct 07 16:52:18 2016 +0200
@@ -122,15 +122,15 @@
 end
 
 local function load(username, host, datastore)
-	local data, ret = envloadfile(getpath(username, host, datastore), {});
+	local data, err = envloadfile(getpath(username, host, datastore), {});
 	if not data then
 		local mode = lfs.attributes(getpath(username, host, datastore), "mode");
 		if not mode then
-			log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil");
+			log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
 			return nil;
 		else -- file exists, but can't be read
 			-- TODO more detailed error checking and logging?
-			log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil");
+			log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
 			return nil, "Error reading storage";
 		end
 	end
@@ -295,15 +295,15 @@
 
 local function list_load(username, host, datastore)
 	local items = {};
-	local data, ret = envloadfile(getpath(username, host, datastore, "list"), {item = function(i) t_insert(items, i); end});
+	local data, err = envloadfile(getpath(username, host, datastore, "list"), {item = function(i) t_insert(items, i); end});
 	if not data then
 		local mode = lfs.attributes(getpath(username, host, datastore, "list"), "mode");
 		if not mode then
-			log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil");
+			log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
 			return nil;
 		else -- file exists, but can't be read
 			-- TODO more detailed error checking and logging?
-			log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil");
+			log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
 			return nil, "Error reading storage";
 		end
 	end
@@ -321,7 +321,7 @@
 	list = "list";
 }
 
-local function users(host, store, typ)
+local function users(host, store, typ) -- luacheck: ignore 431/store
 	typ = type_map[typ or "keyval"];
 	local store_dir = format("%s/%s/%s", data_path, encode(host), store);
 
@@ -329,8 +329,8 @@
 	if not mode then
 		return function() log("debug", "%s", err or (store_dir .. " does not exist")) end
 	end
-	local next, state = lfs.dir(store_dir);
-	return function(state)
+	local next, state = lfs.dir(store_dir); -- luacheck: ignore 431/next 431/state
+	return function(state) -- luacheck: ignore 431/state
 		for node in next, state do
 			local file, ext = node:match("^(.*)%.([dalist]+)$");
 			if file and ext == typ then
@@ -348,8 +348,8 @@
 	if not mode then
 		return function() log("debug", err or (store_dir .. " does not exist")) end
 	end
-	local next, state = lfs.dir(store_dir);
-	return function(state)
+	local next, state = lfs.dir(store_dir); -- luacheck: ignore 431/next 431/state
+	return function(state) -- luacheck: ignore 431/state
 		for node in next, state do
 			if not node:match"^%." then
 				if username == true then
@@ -357,9 +357,9 @@
 						return decode(node);
 					end
 				elseif username then
-					local store = decode(node)
-					if lfs.attributes(getpath(username, host, store, typ), "mode") then
-						return store;
+					local store_name = decode(node);
+					if lfs.attributes(getpath(username, host, store_name, typ), "mode") then
+						return store_name;
 					end
 				elseif lfs.attributes(node, "mode") == "file" then
 					local file, ext = node:match("^(.*)%.([dalist]+)$");
@@ -389,11 +389,11 @@
 	local errs = {};
 	for file in iter, state, var do
 		if lfs.attributes(host_dir..file, "mode") == "directory" then
-			local store = decode(file);
-			local ok, err = do_remove(getpath(username, host, store));
+			local store_name = decode(file);
+			local ok, err = do_remove(getpath(username, host, store_name));
 			if not ok then errs[#errs+1] = err; end
 
-			local ok, err = do_remove(getpath(username, host, store, "list"));
+			local ok, err = do_remove(getpath(username, host, store_name, "list"));
 			if not ok then errs[#errs+1] = err; end
 		end
 	end
--- a/util/jid.lua	Sat Oct 01 23:20:58 2016 +0200
+++ b/util/jid.lua	Fri Oct 07 16:52:18 2016 +0200
@@ -46,7 +46,7 @@
 
 local function prepped_split(jid)
 	local node, host, resource = split(jid);
-	if host then
+	if host and host ~= "." then
 		if sub(host, -1, -1) == "." then -- Strip empty root label
 			host = sub(host, 1, -2);
 		end