Software /
code /
prosody-modules
Comparison
mod_http_muc_log/mod_http_muc_log.lua @ 4989:b74d592df9e2
mod_http_muc_log: Remove dead code
This might be something left over since a different variant where the
loop went like `for n = i-1, i-100, -1 do ... end` i.e. it went trough a
fixed number of items instead of all the page until the current message.
Then it would have needed something to stop going over the end, but
since the checks are simple it shouldn't be much of a problem looping
over even a very busy day.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 16 Aug 2022 01:27:59 +0200 |
parent | 4987:8a8ec909ac20 |
child | 4990:d55b10878e43 |
comparison
equal
deleted
inserted
replaced
4988:732229fe68ab | 4989:b74d592df9e2 |
---|---|
346 -- XEP-0308: Last Message Correction | 346 -- XEP-0308: Last Message Correction |
347 local edit = item:find("{urn:xmpp:message-correct:0}replace/@id"); | 347 local edit = item:find("{urn:xmpp:message-correct:0}replace/@id"); |
348 if edit then | 348 if edit then |
349 local found = false; | 349 local found = false; |
350 for n = i-1, 1, -1 do | 350 for n = i-1, 1, -1 do |
351 if not logs[n] then | 351 if logs[n].id == edit and nick == logs[n].nick then |
352 break; -- Probably reached logs[0] | |
353 elseif logs[n].id == edit and nick == logs[n].nick then | |
354 found = true; | 352 found = true; |
355 logs[n].edited = key; | 353 logs[n].edited = key; |
356 edit = logs[n].key; | 354 edit = logs[n].key; |
357 break; | 355 break; |
358 end | 356 end |
367 local reactions = item:get_child("reactions", "urn:xmpp:reactions:0"); | 365 local reactions = item:get_child("reactions", "urn:xmpp:reactions:0"); |
368 if reactions then | 366 if reactions then |
369 -- COMPAT Movim uses an @to attribute instead of the correct @id | 367 -- COMPAT Movim uses an @to attribute instead of the correct @id |
370 local target_id = reactions.attr.id or reactions.attr.to; | 368 local target_id = reactions.attr.id or reactions.attr.to; |
371 for n = i - 1, 1, -1 do | 369 for n = i - 1, 1, -1 do |
372 if not logs[n] then | 370 if logs[n].key == target_id then |
373 break -- Probably reached logs[0] | |
374 elseif logs[n].key == target_id then | |
375 local react_map = logs[n].reactions; -- { string : integer } | 371 local react_map = logs[n].reactions; -- { string : integer } |
376 if not react_map then | 372 if not react_map then |
377 react_map = {}; | 373 react_map = {}; |
378 logs[n].reactions = react_map; | 374 logs[n].reactions = react_map; |
379 end | 375 end |