Mercurial > prosody-modules
comparison mod_report_forward/mod_report_forward.lua @ 5915:db5128d1a16c
mod_report_forward: Fix traceback when reporting a specific message (thanks singpolyma)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 30 May 2024 17:55:07 +0100 |
| parents | b5a110544fd4 |
| children | 1927d4d27a26 |
comparison
equal
deleted
inserted
replaced
| 5914:d3610fb965d6 | 5915:db5128d1a16c |
|---|---|
| 93 local reported_jid = event.jid; | 93 local reported_jid = event.jid; |
| 94 | 94 |
| 95 local report = st.clone(event.report); | 95 local report = st.clone(event.report); |
| 96 report:text_tag("jid", reported_jid, { xmlns = "urn:xmpp:jid:0" }); | 96 report:text_tag("jid", reported_jid, { xmlns = "urn:xmpp:jid:0" }); |
| 97 | 97 |
| 98 local reported_message_id = report:get_child_with_attr( | 98 local reported_message_el = report:get_child_with_attr( |
| 99 "stanza-id", | 99 "stanza-id", |
| 100 "urn:xmpp:sid:0", | 100 "urn:xmpp:sid:0", |
| 101 "by", | 101 "by", |
| 102 reported_jid, | 102 reported_jid, |
| 103 jid.prep | 103 jid.prep |
| 104 ); | 104 ); |
| 105 | 105 |
| 106 local reported_message, reported_message_time, reported_message_with; | 106 local reported_message, reported_message_time, reported_message_with; |
| 107 if reported_message_id then | 107 if reported_message_el then |
| 108 reported_message, reported_message_time, reported_message_with = archive:get(reporter_username, reported_message_id); | 108 reported_message, reported_message_time, reported_message_with = archive:get(reporter_username, reported_message_el.attr.id); |
| 109 if jid.bare(reported_message_with) ~= event.jid then | 109 if jid.bare(reported_message_with) ~= event.jid then |
| 110 reported_message = nil; | 110 reported_message = nil; |
| 111 end | 111 end |
| 112 end | 112 end |
| 113 | 113 |
