Mercurial > prosody-modules
comparison mod_mam/mod_mam.lua @ 666:b42b75f3bda0
mod_mam: Add the UID to the <result> when sending an archived message back.
| author | Thijs Alkemade <thijsalkemade@gmail.com> |
|---|---|
| date | Mon, 21 May 2012 15:36:02 +0200 |
| parents | 30be50d2537f |
| children | 74efb2db00a6 |
comparison
equal
deleted
inserted
replaced
| 665:684cc57a49c1 | 666:b42b75f3bda0 |
|---|---|
| 137 module:log("debug", "Loaded %d items, about to filter", #data); | 137 module:log("debug", "Loaded %d items, about to filter", #data); |
| 138 for i=1,#data do | 138 for i=1,#data do |
| 139 local item = data[i]; | 139 local item = data[i]; |
| 140 local when, with, with_bare = item.when, item.with, item.with_bare; | 140 local when, with, with_bare = item.when, item.with, item.with_bare; |
| 141 local ts = item.timestamp; | 141 local ts = item.timestamp; |
| 142 local id = item.id; | |
| 142 --module:log("debug", "message with %s at %s", with, when or "???"); | 143 --module:log("debug", "message with %s at %s", with, when or "???"); |
| 143 -- Apply query filter | 144 -- Apply query filter |
| 144 if (not qwith or ((qwith == with) or (qwith == with_bare))) | 145 if (not qwith or ((qwith == with) or (qwith == with_bare))) |
| 145 and (not qstart or when >= qstart) | 146 and (not qstart or when >= qstart) |
| 146 and (not qend or when <= qend) then | 147 and (not qend or when <= qend) then |
| 147 -- Optimizable? Do this when archiving? | 148 -- Optimizable? Do this when archiving? |
| 148 --module:log("debug", "sending"); | 149 --module:log("debug", "sending"); |
| 149 local fwd_st = st.message{ to = origin.full_jid } | 150 local fwd_st = st.message{ to = origin.full_jid } |
| 150 :tag("result", { xmlns = xmlns_mam, queryid = qid }):up() | 151 :tag("result", { xmlns = xmlns_mam, queryid = qid, id = id }):up() |
| 151 :tag("forwarded", { xmlns = xmlns_forward }) | 152 :tag("forwarded", { xmlns = xmlns_forward }) |
| 152 :tag("delay", { xmlns = xmlns_delay, stamp = ts or timestamp(when) }):up(); | 153 :tag("delay", { xmlns = xmlns_delay, stamp = ts or timestamp(when) }):up(); |
| 153 local orig_stanza = st.deserialize(item.stanza); | 154 local orig_stanza = st.deserialize(item.stanza); |
| 154 orig_stanza.attr.xmlns = "jabber:client"; | 155 orig_stanza.attr.xmlns = "jabber:client"; |
| 155 fwd_st:add_child(orig_stanza); | 156 fwd_st:add_child(orig_stanza); |
