Mercurial > prosody-hg
comparison plugins/mod_mam/mod_mam.lua @ 8577:75d5eee6fcdf
mod_mam: Add an option for whether to include 'total' counts by default in queries
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 07 Mar 2018 15:05:20 +0100 |
| parents | 07ff7b8b702b |
| children | b23da88b3507 |
comparison
equal
deleted
inserted
replaced
| 8576:07ff7b8b702b | 8577:75d5eee6fcdf |
|---|---|
| 50 module:log("debug", "See https://prosody.im/doc/storage and https://prosody.im/doc/archiving for more information"); | 50 module:log("debug", "See https://prosody.im/doc/storage and https://prosody.im/doc/archiving for more information"); |
| 51 module:log("info", "Using in-memory fallback archive driver"); | 51 module:log("info", "Using in-memory fallback archive driver"); |
| 52 archive = module:require "fallback_archive"; | 52 archive = module:require "fallback_archive"; |
| 53 end | 53 end |
| 54 | 54 |
| 55 local use_total = true; | 55 local use_total = module:get_option_boolean("mam_include_total", true); |
| 56 | 56 |
| 57 local cleanup; | 57 local cleanup; |
| 58 | 58 |
| 59 local function schedule_cleanup(username) | 59 local function schedule_cleanup(username) |
| 60 if cleanup and not cleanup[username] then | 60 if cleanup and not cleanup[username] then |
| 382 end); | 382 end); |
| 383 else | 383 else |
| 384 module:log("debug", "Archive expiry disabled"); | 384 module:log("debug", "Archive expiry disabled"); |
| 385 -- Don't ask the backend to count the potentially unbounded number of items, | 385 -- Don't ask the backend to count the potentially unbounded number of items, |
| 386 -- it'll get slow. | 386 -- it'll get slow. |
| 387 use_total = false; | 387 use_total = module:get_option_boolean("mam_include_total", false); |
| 388 end | 388 end |
| 389 | 389 |
| 390 -- Stanzas sent by local clients | 390 -- Stanzas sent by local clients |
| 391 module:hook("pre-message/bare", c2s_message_handler, 0); | 391 module:hook("pre-message/bare", c2s_message_handler, 0); |
| 392 module:hook("pre-message/full", c2s_message_handler, 0); | 392 module:hook("pre-message/full", c2s_message_handler, 0); |
