Hi folks
I'm working on a fork of mod_cloud_notify, called mod_muc_cloud_notify, which
is a push notifications module for MUCs.
The idea is that the MUC advertises `urn:xmpp:push:0` and that clients can then
register push services for it.
The main usecase is not mobile with intermittent connection drops, but email
notifications for users who aren't currently in the MUC.
We're using the members list to figure out who to notify, and we're going to
look up the JID by room-reserved nickname.
This patch emits an event in mod_muc_mam, which we listen to in
mod_muc_cloud_notify, so that we know when to send out a push notification.
Regards
JC
--
You received this message because you are subscribed to the Google Groups
"prosody-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/prosody-dev.
For more options, visit https://groups.google.com/d/optout.
--- src/prosody/plugins/mod_muc_mam.lua 2018-08-08 08:08:54.000000000 +0200
+++ src/custom-modules/mod_muc_mam.lua 2018-08-30 10:14:11.000000000 +0200
@@ -322,7 +322,8 @@
end, 0);
-- Handle messages
-local function save_to_history(self, stanza)
+local function save_to_history(event, stanza)
+ local self = event.room;
local room_node, room_host = jid_split(self.jid);
local stored_stanza = stanza;
@@ -350,19 +351,21 @@
if id then
stanza:add_direct_child(st.stanza("stanza-id", { xmlns =
xmlns_st_id, by = self.jid, id = id }));
end
+
+ module:fire_event("muc-archive-message-added", { origin = event.origin,
stanza = stored_stanza, for_room = self, id = id });
end
module:hook("muc-add-history", function (event)
local room, stanza = event.room, event.stanza;
- save_to_history(room, stanza);
+ save_to_history(event, stanza);
end);
if module:get_option_boolean("muc_log_presences", false) then
module:hook("muc-occupant-joined", function (event)
- save_to_history(event.room, st.stanza("presence", { from =
event.nick }):tag("x", { xmlns = "http://jabber.org/protocol/muc" }));
+ save_to_history(event, st.stanza("presence", { from =
event.nick }):tag("x", { xmlns = "http://jabber.org/protocol/muc" }));
end);
module:hook("muc-occupant-left", function (event)
- save_to_history(event.room, st.stanza("presence", { type =
"unavailable", from = event.nick }));
+ save_to_history(event, st.stanza("presence", { type =
"unavailable", from = event.nick }));
end);
end