Merge 0.10->trunk
authorKim Alvefur <zash@zash.se>
Wed, 26 Apr 2017 11:55:27 +0200
changeset 8136 102e1ec8bee1
parent 8131 c14513401d65 (current diff)
parent 8135 6ddddfe05a74 (diff)
child 8149 5c91fb62338e
Merge 0.10->trunk
--- a/configure	Tue Apr 25 01:42:59 2017 +0200
+++ b/configure	Wed Apr 26 11:55:27 2017 +0200
@@ -297,9 +297,15 @@
    --cflags)
       CFLAGS="$value"
       ;;
+   --add-cflags)
+      CFLAGS="$CFLAGS $value"
+      ;;
    --ldflags)
       LDFLAGS="$value"
       ;;
+   --add-ldflags)
+      LDFLAGS="$LDFLAGS $value"
+      ;;
    --c-compiler)
       CC="$value"
       ;;
--- a/plugins/mod_mam/mod_mam.lua	Tue Apr 25 01:42:59 2017 +0200
+++ b/plugins/mod_mam/mod_mam.lua	Wed Apr 26 11:55:27 2017 +0200
@@ -52,6 +52,8 @@
 	archive = module:require "fallback_archive";
 end
 
+local use_total = true;
+
 local cleanup;
 
 -- Handle prefs.
@@ -137,7 +139,7 @@
 		limit = qmax + 1;
 		before = before; after = after;
 		reverse = reverse;
-		total = true;
+		total = get_total;
 	});
 
 	if not data then
@@ -359,6 +361,10 @@
 		end
 		return math.random(cleanup_interval, cleanup_interval * 2);
 	end);
+else
+	-- Don't ask the backend to count the potentially unbounded number of items,
+	-- it'll get slow.
+	use_total = false;
 end
 
 -- Stanzas sent by local clients
--- a/plugins/mod_tls.lua	Tue Apr 25 01:42:59 2017 +0200
+++ b/plugins/mod_tls.lua	Wed Apr 26 11:55:27 2017 +0200
@@ -35,7 +35,8 @@
 
 local ssl_ctx_c2s, ssl_ctx_s2sout, ssl_ctx_s2sin;
 local ssl_cfg_c2s, ssl_cfg_s2sout, ssl_cfg_s2sin;
-do
+
+function module.load()
 	local NULL, err = {};
 	local modhost = module.host;
 	local parent = modhost:match("%.(.*)$");
@@ -61,6 +62,8 @@
 	if not ssl_ctx_s2sin then module:log("error", "Error creating contexts for s2sin: %s", err); end
 end
 
+module:hook_global("config-reloaded", module.load);
+
 local function can_do_tls(session)
 	if not session.conn.starttls then
 		if not session.secure then