aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2014-03-27 18:10:34 -0400
committerdaurnimator <quae@daurnimator.com>2014-03-27 18:10:34 -0400
commit2a107b50cd289c9d522232b3764c308959a7ca52 (patch)
tree044d6bf3352c35d4b74337c420186b5868018048 /plugins
parent2d7176e0945645d177bab94195334a887f4fd001 (diff)
downloadprosody-2a107b50cd289c9d522232b3764c308959a7ca52.tar.gz
prosody-2a107b50cd289c9d522232b3764c308959a7ca52.zip
plugins/muc/muc.lib: Have timestamp as seconds since epoch inside of history
Diffstat (limited to 'plugins')
-rw-r--r--plugins/muc/muc.lib.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 7e41b225..20cba225 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -131,10 +131,11 @@ module:hook("muc-broadcast-message", function(event)
if not history then history = {}; room._data['history'] = history; end
local stanza = st.clone(event.stanza);
stanza.attr.to = "";
- local stamp = datetime.datetime();
+ local ts = gettime();
+ local stamp = datetime.datetime(ts);
stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = module.host, stamp = stamp}):up(); -- XEP-0203
stanza:tag("x", {xmlns = "jabber:x:delay", from = module.host, stamp = datetime.legacy()}):up(); -- XEP-0091 (deprecated)
- local entry = { stanza = stanza, stamp = stamp };
+ local entry = { stanza = stanza, timestamp = ts };
t_insert(history, entry);
while #history > room:get_historylength() do t_remove(history, 1) end
end
@@ -220,7 +221,7 @@ module:hook("muc-get-history", function(event)
charcount = charcount + entry.chars + #to;
if charcount > maxchars then break; end
end
- if since and since > entry.stamp then break; end
+ if since and since > entry.timestamp then break; end
if n + 1 > maxstanzas then break; end
n = n + 1;
end