aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-05-17 01:06:20 +0200
committerKim Alvefur <zash@zash.se>2017-05-17 01:06:20 +0200
commit9cca72b5892f44ef7bd118c1ca3cf5f4f441c9f7 (patch)
tree87920ea2589baddc568772aeebb1fda17b5c9e0c /plugins
parentd300932f7b75b891e6dfcf7d568d796c227b9502 (diff)
parent8c3f6bd236ef6addc1dda80d42d6fd73acc4e1f5 (diff)
downloadprosody-9cca72b5892f44ef7bd118c1ca3cf5f4f441c9f7.tar.gz
prosody-9cca72b5892f44ef7bd118c1ca3cf5f4f441c9f7.zip
Merge 0.10->trunk
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_component.lua2
-rw-r--r--plugins/mod_mam/mod_mam.lua6
-rw-r--r--plugins/mod_message.lua7
-rw-r--r--plugins/mod_motd.lua5
-rw-r--r--plugins/mod_storage_internal.lua11
-rw-r--r--plugins/mod_storage_sql.lua2
-rw-r--r--plugins/mod_websocket.lua2
7 files changed, 21 insertions, 14 deletions
diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua
index a829cecb..77d8a14d 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");
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua
index f46d3818..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);
@@ -139,7 +141,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
diff --git a/plugins/mod_message.lua b/plugins/mod_message.lua
index 2ee75c21..0d370ec1 100644
--- a/plugins/mod_message.lua
+++ b/plugins/mod_message.lua
@@ -48,11 +48,10 @@ 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,
+ username = node;
+ origin = origin,
+ stanza = stanza,
});
end
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);
diff --git a/plugins/mod_storage_internal.lua b/plugins/mod_storage_internal.lua
index 21a63c95..0a382cee 100644
--- a/plugins/mod_storage_internal.lua
+++ b/plugins/mod_storage_internal.lua
@@ -139,12 +139,19 @@ 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)
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;
diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua
index 5eb0cf7d..e53deef3 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;
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