Merge 0.10->trunk
authorKim Alvefur <zash@zash.se>
Thu, 23 Mar 2017 01:30:58 +0100
changeset 8002 980606856882
parent 7993 3d17b2bf0e0c (current diff)
parent 8001 604beb13596a (diff)
child 8004 247a544f7047
Merge 0.10->trunk
core/storagemanager.lua
plugins/mod_posix.lua
plugins/muc/lock.lib.lua
util/dependencies.lua
--- a/core/storagemanager.lua	Tue Mar 21 04:41:40 2017 +0100
+++ b/core/storagemanager.lua	Thu Mar 23 01:30:58 2017 +0100
@@ -164,7 +164,7 @@
 	end
 	if ret then
 		local event_data = { host = host, store_name = store, store_type = typ, store = ret };
-		prosody.hosts[host].events.fire_event("store-opened", event_data);
+		hosts[host].events.fire_event("store-opened", event_data);
 		ret, err = event_data.store, event_data.store_err;
 	end
 	return ret, err;
--- a/plugins/mod_http_files.lua	Tue Mar 21 04:41:40 2017 +0100
+++ b/plugins/mod_http_files.lua	Thu Mar 23 01:30:58 2017 +0100
@@ -16,7 +16,7 @@
 local build_path = require"socket.url".build_path;
 local path_sep = package.config:sub(1,1);
 
-local base_path = module:get_option_string("http_files_dir", module:get_option_string("http_path"));
+local base_path = module:get_option_path("http_files_dir", module:get_option_path("http_path"));
 local cache_size = module:get_option_number("http_files_cache_size", 128);
 local cache_max_file_size = module:get_option_number("http_files_cache_max_file_size", 4096);
 local dir_indices = module:get_option_array("http_index_files", { "index.html", "index.htm" });
--- a/plugins/mod_posix.lua	Tue Mar 21 04:41:40 2017 +0100
+++ b/plugins/mod_posix.lua	Thu Mar 23 01:30:58 2017 +0100
@@ -80,7 +80,7 @@
 	if pidfile_handle then
 		remove_pidfile();
 	end
-	pidfile = module:get_option_string("pidfile");
+	pidfile = module:get_option_path("pidfile", nil, "data");
 	if pidfile then
 		local err;
 		local mode = stat(pidfile) and "r+" or "w+";
--- a/plugins/muc/lock.lib.lua	Tue Mar 21 04:41:40 2017 +0100
+++ b/plugins/muc/lock.lib.lua	Thu Mar 23 01:30:58 2017 +0100
@@ -42,6 +42,7 @@
 -- Don't let users into room while it is locked
 module:hook("muc-occupant-pre-join", function(event)
 	if not event.is_new_room and is_locked(event.room) then -- Deny entry
+		module:log("debug", "Room is locked, denying entry");
 		event.origin.send(st.error_reply(event.stanza, "cancel", "item-not-found"));
 		return true;
 	end
--- a/util-src/encodings.c	Tue Mar 21 04:41:40 2017 +0100
+++ b/util-src/encodings.c	Thu Mar 23 01:30:58 2017 +0100
@@ -173,7 +173,7 @@
  * Decode one UTF-8 sequence, returning NULL if byte sequence is invalid.
  */
 static const char *utf8_decode(const char *o, int *val) {
-	static unsigned int limits[] = {0xFF, 0x7F, 0x7FF, 0xFFFF};
+	static const unsigned int limits[] = {0xFF, 0x7F, 0x7FF, 0xFFFF};
 	const unsigned char *s = (const unsigned char *)o;
 	unsigned int c = s[0];
 	unsigned int res = 0;  /* final result */
--- a/util/datamanager.lua	Tue Mar 21 04:41:40 2017 +0100
+++ b/util/datamanager.lua	Thu Mar 23 01:30:58 2017 +0100
@@ -24,8 +24,10 @@
 local t_concat = table.concat;
 local envloadfile = require"util.envload".envloadfile;
 local serialize = require "util.serialization".serialize;
-local path_separator = assert ( package.config:match ( "^([^\n]+)" ) , "package.config not in standard form" ) -- Extract directory seperator from package.config (an undocumented string that comes with lua)
 local lfs = require "lfs";
+-- Extract directory seperator from package.config (an undocumented string that comes with lua)
+local path_separator = assert ( package.config:match ( "^([^\n]+)" ) , "package.config not in standard form" )
+
 local prosody = prosody;
 
 local raw_mkdir = lfs.mkdir;
@@ -130,15 +132,8 @@
 			-- No such file, ok to ignore
 			return nil;
 		end
-		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, 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, err, username or "nil", host or "nil");
-			return nil, "Error reading storage";
-		end
+		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
 
 	local success, ret = pcall(data);
@@ -304,15 +299,8 @@
 			-- No such file, ok to ignore
 			return nil;
 		end
-		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, 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, err, username or "nil", host or "nil");
-			return nil, "Error reading storage";
-		end
+		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
 
 	local success, ret = pcall(data);
--- a/util/dependencies.lua	Tue Mar 21 04:41:40 2017 +0100
+++ b/util/dependencies.lua	Thu Mar 23 01:30:58 2017 +0100
@@ -93,7 +93,7 @@
 
 	if not ssl then
 		missingdep("LuaSec", {
-				["Debian/Ubuntu"] = "https://prosody.im/download/start#debian_and_ubuntu";
+				["Debian/Ubuntu"] = "sudo apt-get install lua-sec";
 				["luarocks"] = "luarocks install luasec";
 				["Source"] = "https://github.com/brunoos/luasec";
 			}, "SSL/TLS support will not be available");