Comparison

plugins/mod_mam/mod_mam.lua @ 11268:e3f6f0b39e7b

mod_mam: Advertise extended MAM 0.7.x behind a feature flag In order to ease testing until the extended feautres are all implemented. Also TODOs for all the sub-features.
author Kim Alvefur <zash@zash.se>
date Mon, 30 Nov 2020 21:00:45 +0100
parent 11260:08b397c21805
child 11269:342ac5d806fb
comparison
equal deleted inserted replaced
11267:97077089f3c2 11268:e3f6f0b39e7b
1 -- Prosody IM 1 -- Prosody IM
2 -- Copyright (C) 2008-2017 Matthew Wild 2 -- Copyright (C) 2008-2017 Matthew Wild
3 -- Copyright (C) 2008-2017 Waqas Hussain 3 -- Copyright (C) 2008-2017 Waqas Hussain
4 -- Copyright (C) 2011-2017 Kim Alvefur 4 -- Copyright (C) 2011-2020 Kim Alvefur
5 -- 5 --
6 -- This project is MIT/X11 licensed. Please see the 6 -- This project is MIT/X11 licensed. Please see the
7 -- COPYING file in the source package for more information. 7 -- COPYING file in the source package for more information.
8 -- 8 --
9 -- XEP-0313: Message Archive Management for Prosody 9 -- XEP-0313: Message Archive Management for Prosody
10 -- 10 --
11 11
12 local xmlns_mam = "urn:xmpp:mam:2"; 12 local xmlns_mam = "urn:xmpp:mam:2";
13 local xmlns_mam_ext = "urn:xmpp:mam:2#extended";
13 local xmlns_delay = "urn:xmpp:delay"; 14 local xmlns_delay = "urn:xmpp:delay";
14 local xmlns_forward = "urn:xmpp:forward:0"; 15 local xmlns_forward = "urn:xmpp:forward:0";
15 local xmlns_st_id = "urn:xmpp:sid:0"; 16 local xmlns_st_id = "urn:xmpp:sid:0";
16 17
17 local um = require "core.usermanager"; 18 local um = require "core.usermanager";
510 module:hook("pre-message/full", c2s_message_handler, 0); 511 module:hook("pre-message/full", c2s_message_handler, 0);
511 -- Stanzas to local clients 512 -- Stanzas to local clients
512 module:hook("message/bare", message_handler, 0); 513 module:hook("message/bare", message_handler, 0);
513 module:hook("message/full", message_handler, 0); 514 module:hook("message/full", message_handler, 0);
514 515
516 local advertise_extended = module:get_option_boolean("mam_advertise_extend", false);
517 -- TODO before-id, after-id
518 -- TODO ids
519 -- TODO page flipping
520 -- TODO archive metadata query
521 -- TODO delete feature flag option
522
515 module:hook("account-disco-info", function(event) 523 module:hook("account-disco-info", function(event)
516 (event.reply or event.stanza):tag("feature", {var=xmlns_mam}):up(); 524 (event.reply or event.stanza):tag("feature", {var=xmlns_mam}):up();
525 if advertise_extended then
526 (event.reply or event.stanza):tag("feature", {var=xmlns_mam_ext}):up();
527 end
517 (event.reply or event.stanza):tag("feature", {var=xmlns_st_id}):up(); 528 (event.reply or event.stanza):tag("feature", {var=xmlns_st_id}):up();
518 end); 529 end);
519 530