Mercurial > prosody-hg
comparison plugins/mod_pep.lua @ 11854:b605cbd5f13b
mod_pubsub,mod_pep: Implement 'send_last_published_item' option #1436
Default left as 'never' in mod_pubsub to preserve the previous behavior.
Unclear if this is desirable, but can always be changed later.
In mod_pep this allows turning off the automatic resending of most
recent item.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 19 Oct 2021 18:11:50 +0200 |
| parents | 86e68c0a4f05 |
| children | 14a679588b7b |
comparison
equal
deleted
inserted
replaced
| 11853:ae5ac9830add | 11854:b605cbd5f13b |
|---|---|
| 185 pep_username = username; | 185 pep_username = username; |
| 186 node_defaults = { | 186 node_defaults = { |
| 187 ["max_items"] = 1; | 187 ["max_items"] = 1; |
| 188 ["persist_items"] = true; | 188 ["persist_items"] = true; |
| 189 ["access_model"] = "presence"; | 189 ["access_model"] = "presence"; |
| 190 ["send_last_published_item"] = "on_sub_and_presence"; | |
| 190 }; | 191 }; |
| 191 | 192 |
| 192 autocreate_on_publish = true; | 193 autocreate_on_publish = true; |
| 193 autocreate_on_subscribe = false; | 194 autocreate_on_subscribe = false; |
| 194 | 195 |
| 258 end | 259 end |
| 259 return current; -- no caps, could mean caps optimization, so return current | 260 return current; -- no caps, could mean caps optimization, so return current |
| 260 end | 261 end |
| 261 | 262 |
| 262 local function resend_last_item(jid, node, service) | 263 local function resend_last_item(jid, node, service) |
| 264 local ok, config = service:get_node_config(node, true); | |
| 265 if ok and config.send_last_published_item ~= "on_sub_and_presence" then return end | |
| 263 local ok, id, item = service:get_last_item(node, jid); | 266 local ok, id, item = service:get_last_item(node, jid); |
| 264 if not (ok and id) then return; end | 267 if not (ok and id) then return; end |
| 265 service.config.broadcaster("items", node, { [jid] = true }, item); | 268 service.config.broadcaster("items", node, { [jid] = true }, item); |
| 266 end | 269 end |
| 267 | 270 |
