Software /
code /
prosody
Comparison
plugins/muc/history.lib.lua @ 7350:24e2369b67f9
MUC: Move history to room._history
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 12 Apr 2016 19:35:55 +0200 |
parent | 7086:6cc7c9da29ed |
child | 7401:e16b3fd0bd80 |
comparison
equal
deleted
inserted
replaced
7348:a8ca12e7c2fb | 7350:24e2369b67f9 |
---|---|
77 return maxchars, maxstanzas, since; | 77 return maxchars, maxstanzas, since; |
78 end | 78 end |
79 | 79 |
80 module:hook("muc-get-history", function(event) | 80 module:hook("muc-get-history", function(event) |
81 local room = event.room; | 81 local room = event.room; |
82 local history = room._data["history"]; -- send discussion history | 82 local history = room._history; -- send discussion history |
83 if not history then return nil end | 83 if not history then return nil end |
84 local history_len = #history; | 84 local history_len = #history; |
85 | 85 |
86 local to = event.to; | 86 local to = event.to; |
87 local maxchars = event.maxchars; | 87 local maxchars = event.maxchars; |
138 -- add to history | 138 -- add to history |
139 module:hook("muc-add-history", function(event) | 139 module:hook("muc-add-history", function(event) |
140 local historic = event.stanza:get_child("body"); | 140 local historic = event.stanza:get_child("body"); |
141 if historic then | 141 if historic then |
142 local room = event.room | 142 local room = event.room |
143 local history = room._data["history"]; | 143 local history = room._history; |
144 if not history then history = {}; room._data["history"] = history; end | 144 if not history then history = {}; room._history = history; end |
145 local stanza = st.clone(event.stanza); | 145 local stanza = st.clone(event.stanza); |
146 stanza.attr.to = ""; | 146 stanza.attr.to = ""; |
147 local ts = gettime(); | 147 local ts = gettime(); |
148 local stamp = datetime.datetime(ts); | 148 local stamp = datetime.datetime(ts); |
149 stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = module.host, stamp = stamp}):up(); -- XEP-0203 | 149 stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = module.host, stamp = stamp}):up(); -- XEP-0203 |