From d99378074dd69903cb3525ea23d2bbbfb6d3b23e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 26 Apr 2017 16:54:58 +0200 Subject: mod_component: Use typed config API --- plugins/mod_component.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua index 4da1baf7..573b2c8e 100644 --- a/plugins/mod_component.lua +++ b/plugins/mod_component.lua @@ -66,7 +66,7 @@ function module.add_host(module) return true; end - local secret = module:get_option("component_secret"); + local secret = module:get_option_string("component_secret"); if not secret then (session.log or log)("warn", "Component attempted to identify as %s, but component_secret is not set", session.host); session:close("not-authorized"); -- cgit v1.2.3 From 0d216b46fd42e9ffb2b0bd1383bc2cb02ae86c28 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 27 Apr 2017 10:17:54 +0200 Subject: mod_motd: Use initial presence event (saves some checking) --- plugins/mod_motd.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_motd.lua b/plugins/mod_motd.lua index 574a9cf4..13bc7e31 100644 --- a/plugins/mod_motd.lua +++ b/plugins/mod_motd.lua @@ -17,10 +17,9 @@ local st = require "util.stanza"; motd_text = motd_text:gsub("^%s*(.-)%s*$", "%1"):gsub("\n[ \t]+", "\n"); -- Strip indentation from the config -module:hook("presence/bare", function (event) +module:hook("presence/initial", function (event) local session, stanza = event.origin, event.stanza; - if session.username and not session.presence - and not stanza.attr.type and not stanza.attr.to then + if not stanza.attr.type and not stanza.attr.to then local motd_stanza = st.message({ to = session.full_jid, from = motd_jid }) :tag("body"):text(motd_text); -- cgit v1.2.3 From 2a835d10df6c344b1b318160beb92a3f6d958cd9 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 27 Apr 2017 10:58:02 +0200 Subject: mod_message: Remove TODO about privacy list (mod_privacy was removed) --- plugins/mod_message.lua | 2 -- 1 file changed, 2 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_message.lua b/plugins/mod_message.lua index 2ee75c21..ea2dc11f 100644 --- a/plugins/mod_message.lua +++ b/plugins/mod_message.lua @@ -48,8 +48,6 @@ local function process_to_bare(bare, origin, stanza) local node, host = jid_split(bare); local ok if user_exists(node, host) then - -- TODO apply the default privacy list - ok = module:fire_event('message/offline/handle', { origin = origin, stanza = stanza, -- cgit v1.2.3 From afa9082458b586321faf6aa4afa72cf6ba30c26b Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 27 Apr 2017 12:41:53 +0200 Subject: mod_mam: Use correct variable --- plugins/mod_mam/mod_mam.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua index f46d3818..accb047b 100644 --- a/plugins/mod_mam/mod_mam.lua +++ b/plugins/mod_mam/mod_mam.lua @@ -139,7 +139,7 @@ module:hook("iq-set/self/"..xmlns_mam..":query", function(event) limit = qmax + 1; before = before; after = after; reverse = reverse; - total = get_total; + total = use_total; }); if not data then -- cgit v1.2.3 From 4812b7e07c8810c158bad1f99eb43cbd30c33ca3 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 30 Apr 2017 10:44:53 +0100 Subject: mod_storage_sql: Fix logic error introduced by variable rename in aa9f198cb3c9 (thanks waqas) --- plugins/mod_storage_sql.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua index aab43d1f..d4a5f871 100644 --- a/plugins/mod_storage_sql.lua +++ b/plugins/mod_storage_sql.lua @@ -33,7 +33,7 @@ local function serialize(value) return "xml", tostring(value); elseif t == "table" then local encoded,err = json.encode(value); - if value then return "json", encoded; end + if encoded then return "json", encoded; end return nil, err; end return nil, "Unhandled value type: "..t; -- cgit v1.2.3 From e863b13420cf950e28539e29b0a7d03e143a81e8 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 7 May 2017 16:31:48 +0200 Subject: mod_message: Normalize indentation --- plugins/mod_message.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_message.lua b/plugins/mod_message.lua index ea2dc11f..4b72921f 100644 --- a/plugins/mod_message.lua +++ b/plugins/mod_message.lua @@ -49,8 +49,8 @@ local function process_to_bare(bare, origin, stanza) local ok if user_exists(node, host) then ok = module:fire_event('message/offline/handle', { - origin = origin, - stanza = stanza, + origin = origin, + stanza = stanza, }); end -- cgit v1.2.3 From 49655b22344eaa3ee55d9059965b4a5ffe36654c Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 7 May 2017 20:23:29 +0200 Subject: mod_mam: Format timestamps in log message --- plugins/mod_mam/mod_mam.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua index accb047b..4235fd59 100644 --- a/plugins/mod_mam/mod_mam.lua +++ b/plugins/mod_mam/mod_mam.lua @@ -123,7 +123,9 @@ module:hook("iq-set/self/"..xmlns_mam..":query", function(event) end module:log("debug", "Archive query, id %s with %s from %s until %s)", - tostring(qid), qwith or "anyone", qstart or "the dawn of time", qend or "now"); + tostring(qid), qwith or "anyone", + qstart and timestamp(qstart) or "the dawn of time", + qend and timestamp(qend) or "now"); -- RSM stuff local qset = rsm.get(query); -- cgit v1.2.3 From 0c64cd26d6f9730ad145511f5edbe3c0b4767eb2 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 10 May 2017 19:22:13 +0200 Subject: mod_message: Include username in event for offline messages --- plugins/mod_message.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins') diff --git a/plugins/mod_message.lua b/plugins/mod_message.lua index 4b72921f..0d370ec1 100644 --- a/plugins/mod_message.lua +++ b/plugins/mod_message.lua @@ -49,6 +49,7 @@ local function process_to_bare(bare, origin, stanza) local ok if user_exists(node, host) then ok = module:fire_event('message/offline/handle', { + username = node; origin = origin, stanza = stanza, }); -- cgit v1.2.3 From 83741da83af1f361605aeba6f3c884fcfa5fc755 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 14 May 2017 17:22:33 +0200 Subject: mod_storage_internal: Correctly calculate number of deleted items (fixes #912) --- plugins/mod_storage_internal.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_storage_internal.lua b/plugins/mod_storage_internal.lua index 21a63c95..94d73af7 100644 --- a/plugins/mod_storage_internal.lua +++ b/plugins/mod_storage_internal.lua @@ -141,10 +141,11 @@ function archive:delete(username, query) local items, err = datamanager.list_load(username, host, self.store); if not items then return items, err; end items = array(items); + local count_before = #items; items:filter(function (item) return item.when > query["end"]; end); - local count = #items; + local count = count_before - #items; local ok, err = datamanager.list_store(username, host, self.store, items); if not ok then return ok, err; end return count; -- cgit v1.2.3 From d7789712dab1431eafbf00a8f3bb68e45738bc86 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 14 May 2017 17:31:50 +0200 Subject: mod_storage_internal: Handle case of empty item store when deleting (fixes #910) --- plugins/mod_storage_internal.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_storage_internal.lua b/plugins/mod_storage_internal.lua index 94d73af7..0a382cee 100644 --- a/plugins/mod_storage_internal.lua +++ b/plugins/mod_storage_internal.lua @@ -139,7 +139,13 @@ function archive:delete(username, query) if k ~= "end" then return nil, "unsupported-query-field"; end end local items, err = datamanager.list_load(username, host, self.store); - if not items then return items, err; end + if not items then + if err then + return items, err; + end + -- Store is empty + return 0; + end items = array(items); local count_before = #items; items:filter(function (item) -- cgit v1.2.3 From bd52588649aae5fffa05f1f60d3a9dcd27281271 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 16 May 2017 17:52:29 +0200 Subject: mod_websocket: Convert set to string (syslog sink needs a better fix) --- plugins/mod_websocket.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_websocket.lua b/plugins/mod_websocket.lua index d545e708..ed73962d 100644 --- a/plugins/mod_websocket.lua +++ b/plugins/mod_websocket.lua @@ -334,7 +334,7 @@ function module.add_host(module) -- This might be weird with random load order local_cross_domain:exclude(cross_domain); cross_domain:include(local_cross_domain); - module:log("debug", "cross_domain = %s", cross_domain); + module:log("debug", "cross_domain = %s", tostring(cross_domain)); function module.unload() cross_domain:exclude(local_cross_domain); end -- cgit v1.2.3