Mercurial > prosody-modules
comparison mod_http_muc_log/mod_http_muc_log.lua @ 4589:45ab9152a51c
mod_http_muc_log: Add some spacing around code for readability
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 15 Jun 2021 17:19:25 +0200 |
parents | 1890115b2773 |
children | 3145823992cb |
comparison
equal
deleted
inserted
replaced
4588:e7b126161e7b | 4589:45ab9152a51c |
---|---|
314 local body_tag = item:get_child("body"); | 314 local body_tag = item:get_child("body"); |
315 local body = body_tag and body_tag:get_text(); | 315 local body = body_tag and body_tag:get_text(); |
316 local subject = item:get_child_text("subject"); | 316 local subject = item:get_child_text("subject"); |
317 local verb = nil; | 317 local verb = nil; |
318 local lang = body_tag and body_tag.attr["xml:lang"] or item.attr["xml:lang"]; | 318 local lang = body_tag and body_tag.attr["xml:lang"] or item.attr["xml:lang"]; |
319 | |
319 if subject then | 320 if subject then |
320 verb, body = "set the topic to", subject; | 321 verb, body = "set the topic to", subject; |
321 elseif body and body:sub(1,4) == "/me " then | 322 elseif body and body:sub(1,4) == "/me " then |
322 verb, body = body:sub(5), nil; | 323 verb, body = body:sub(5), nil; |
323 elseif item.name == "presence" then | 324 elseif item.name == "presence" then |
324 -- TODO Distinguish between join and presence update | 325 -- TODO Distinguish between join and presence update |
325 verb = item.attr.type == "unavailable" and "has left" or "has joined"; | 326 verb = item.attr.type == "unavailable" and "has left" or "has joined"; |
326 lang = "en"; | 327 lang = "en"; |
327 end | 328 end |
329 | |
328 local oob = use_oob and item:get_child("x", "jabber:x:oob"); | 330 local oob = use_oob and item:get_child("x", "jabber:x:oob"); |
331 | |
329 if body or verb or oob then | 332 if body or verb or oob then |
330 local line = { | 333 local line = { |
331 key = key; | 334 key = key; |
332 datetime = datetime.datetime(when); | 335 datetime = datetime.datetime(when); |
333 time = datetime.time(when); | 336 time = datetime.time(when); |
344 desc = oob:get_child_text("desc"); | 347 desc = oob:get_child_text("desc"); |
345 } | 348 } |
346 end | 349 end |
347 logs[i], i = line, i + 1; | 350 logs[i], i = line, i + 1; |
348 end | 351 end |
352 | |
349 first = first or key; | 353 first = first or key; |
350 last = key; | 354 last = key; |
351 end | 355 end |
352 if i == 1 and not lazy then return end -- No items | 356 if i == 1 and not lazy then return end -- No items |
353 | 357 |