Mercurial > prosody-modules
comparison mod_http_muc_log/mod_http_muc_log.lua @ 4991:b17d63ef5bdf
mod_http_muc_log: Use XEP-0359 ID if available
Clients apparently prefer this over message@id for reasons.
Only used internally to find items for message edits
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 16 Aug 2022 01:39:25 +0200 |
| parents | d55b10878e43 |
| children | ed5abb8b8fa8 |
comparison
equal
deleted
inserted
replaced
| 4990:d55b10878e43 | 4991:b17d63ef5bdf |
|---|---|
| 309 local body_tag = item:get_child("body"); | 309 local body_tag = item:get_child("body"); |
| 310 local body = body_tag and body_tag:get_text(); | 310 local body = body_tag and body_tag:get_text(); |
| 311 local subject = item:get_child_text("subject"); | 311 local subject = item:get_child_text("subject"); |
| 312 local verb = nil; | 312 local verb = nil; |
| 313 local lang = body_tag and body_tag.attr["xml:lang"] or item.attr["xml:lang"]; | 313 local lang = body_tag and body_tag.attr["xml:lang"] or item.attr["xml:lang"]; |
| 314 | |
| 315 -- XEP-0359: Unique and Stable Stanza IDs | |
| 316 local message_id = item:find("{urn:xmpp:sid:0}origin-id@id") or item.attr.id; | |
| 314 | 317 |
| 315 if subject then | 318 if subject then |
| 316 verb, body = "set the topic to", subject; | 319 verb, body = "set the topic to", subject; |
| 317 elseif body and body:sub(1,4) == "/me " then | 320 elseif body and body:sub(1,4) == "/me " then |
| 318 verb, body = body:sub(5), nil; | 321 verb, body = body:sub(5), nil; |
| 387 -- XEP-0461: Message Replies | 390 -- XEP-0461: Message Replies |
| 388 local reply = item:get_child("reply", "urn:xmpp:reply:0"); | 391 local reply = item:get_child("reply", "urn:xmpp:reply:0"); |
| 389 | 392 |
| 390 if body or verb or oob then | 393 if body or verb or oob then |
| 391 local line = { | 394 local line = { |
| 392 message_id = item.attr.id; | 395 message_id = message_id; |
| 393 archive_id = archive_id; | 396 archive_id = archive_id; |
| 394 datetime = datetime.datetime(when); | 397 datetime = datetime.datetime(when); |
| 395 time = datetime.time(when); | 398 time = datetime.time(when); |
| 396 verb = verb; | 399 verb = verb; |
| 397 body = body; | 400 body = body; |
