aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_smacks.lua
Commit message (Collapse)AuthorAgeFilesLines
* mod_smacks: Include reason for destroying session on hibernation timeoutKim Alvefur2021-12-121-1/+1
| | | | To aid in debugging
* mod_smacks: Refactor, simplify, optimizeKim Alvefur2021-12-031-4/+2
| | | | | Since reply.attr.to will be the .attr.from of the input we can check this earlier and avoid constructing the reply at all.
* mod_smacks: Use function to construct error replyKim Alvefur2021-12-031-5/+1
| | | | Did error_reply() not exist when mod_smacks was first created?
* mod_smacks: Remove obsolete commentKim Alvefur2021-12-021-5/+0
| | | | It dates back to the initial commit in prosody-modules 9a7671720dec
* mod_smacks: Avoid duplicated queueing using flag on session instead of stanzaKim Alvefur2021-12-021-2/+4
| | | | Mutating the stanza like this is Really Bad Practice.
* mod_smacks: Remove dead conditionalKim Alvefur2021-12-021-1/+1
| | | | | `cached_stanza` can't be falsy because util.stanza.clone() would have thrown rather than return nil, or `._cached=true` would have.
* mod_smacks: Ensure hibernating session is not connectedKim Alvefur2021-12-021-0/+3
| | | | | Turns out that if you destroy a session from inside prosody, it goes into hibernation but stays connected and continues processing stanzas.
* mod_smacks: Reorder imports etcKim Alvefur2021-12-011-13/+15
| | | | Mostly sorted by name of import (sort -k4) and grouped by kind
* mod_smacks: Fix empty cache checkKim Alvefur2021-12-011-1/+1
| | | | | In Lua, every value except `nil` and `false` are considered true in boolean expressions, even `0` as here, which means this was dead code.
* mod_smacks: Use stanza type checking function for correctnessKim Alvefur2021-12-011-1/+1
| | | | | Non-stanza tables with an 'attr' field might be rare in Prosody, but better to be Correct
* mod_smacks: Remove redundant fieldsKim Alvefur2021-12-011-7/+1
| | | | | | Given that the registry is scoped per user and the module is scoped per host, there seems no point to checking or storing both username and host here.
* mod_smacks: Factor out formatting of 'h' valueKim Alvefur2021-12-011-4/+6
|
* mod_smacks: Remove dead legacy code for 0.10Kim Alvefur2021-12-011-17/+0
|
* mod_smacks: Use new pre-session-close event instead of monkeypatchKim Alvefur2021-12-011-13/+16
| | | | Much cleaner.
* mod_smacks: Remove left-over debug loggingKim Alvefur2021-11-271-1/+0
| | | | | Wrong level, missing argument, whatever it was meant to shed light on has been resolved and forgotten.
* mod_smacks: Optimize scheduling of ack requestsKim Alvefur2021-11-241-1/+2
| | | | | | Taking advantage of the new callbacks added in dcf38ac6a38c and 9c450185bac1 avoids extra timers, extra syscalls and sending the `<r>` in its own TCP segment, improving efficiency.
* mod_smacks: Refactor ack requesting to avoid some timer roundtripsKim Alvefur2021-11-241-56/+62
| | | | | | | | | | The function was too large to comprehend! Breaking it up helps readability and reuse. The timer round rip is only to avoid ordering weirdness when sending from inside a stanza filter. No need when handling <r> and <a> CSI interactions both boiled down to sending an <r> immediately.
* mod_smacks: Fix timer lifetimes to follow session instead of moduleKim Alvefur2021-11-241-8/+12
| | | | | | | module:add_timer() creates a timer that stops working after the module is reloaded or unloaded, in order to prevent leaks. However, when the timers control vital session behavior, breakage occurs after reload. E.g. sessions would stop requesting acks and stop responding to acks.
* mod_smacks: Clean up compat code etcKim Alvefur2021-11-241-54/+39
| | | | | | | | Unstoppable stoppable timer compat not needed since 26f54b462601 ca 0.11.0 module:hook_stanza was renamed in 2012 No idea what was going on with the indentation and such
* mod_smacks: Import from prosody-modules @ eb63890ae8fcKim Alvefur2021-11-161-0/+690