Mercurial > prosody-modules
comparison mod_mam/mod_mam.lua @ 2768:2af42a3af131
mod_mam: Squeeze in hooks with priority between sevral other modules (fixes #996)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 21 Sep 2017 23:31:42 +0200 |
| parents | 1872a9129c2f |
| children | 0d2d4d5bb5f5 |
comparison
equal
deleted
inserted
replaced
| 2767:e1edf643fbb1 | 2768:2af42a3af131 |
|---|---|
| 407 | 407 |
| 408 -- Stanzas sent by local clients | 408 -- Stanzas sent by local clients |
| 409 module:hook("pre-message/bare", c2s_message_handler, 0); | 409 module:hook("pre-message/bare", c2s_message_handler, 0); |
| 410 module:hook("pre-message/full", c2s_message_handler, 0); | 410 module:hook("pre-message/full", c2s_message_handler, 0); |
| 411 -- Stanszas to local clients | 411 -- Stanszas to local clients |
| 412 module:hook("message/bare", message_handler, 0); | 412 local priority = 0.075 |
| 413 module:hook("message/full", message_handler, 0); | 413 assert(priority > 0, "priority must be before mod_message"); |
| 414 assert(priority < 0.1, "priority must be after mod_firewall"); | |
| 415 assert(priority > 0.05, "priority must be before mod_carbons"); | |
| 416 module:hook("message/bare", message_handler, priority); | |
| 417 module:hook("message/full", message_handler, priority); | |
| 414 | 418 |
| 415 module:add_feature(xmlns_mam0); -- COMPAT with XEP-0313 v 0.1 | 419 module:add_feature(xmlns_mam0); -- COMPAT with XEP-0313 v 0.1 |
| 416 | 420 |
| 417 module:hook("account-disco-info", function(event) | 421 module:hook("account-disco-info", function(event) |
| 418 (event.reply or event.stanza):tag("feature", {var=xmlns_mam0}):up(); | 422 (event.reply or event.stanza):tag("feature", {var=xmlns_mam0}):up(); |
