Changeset

3998:67047ed63b15

mod_muc_rai: Ignore attempts to re-subscribe from the same full JID
author Matthew Wild <mwild1@gmail.com>
date Tue, 28 Apr 2020 16:54:21 +0100
parents 3997:0e72dd70afff
children 3999:22784f001b7f
files mod_muc_rai/mod_muc_rai.lua
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_rai/mod_muc_rai.lua	Tue Apr 28 10:03:17 2020 +0100
+++ b/mod_muc_rai/mod_muc_rai.lua	Tue Apr 28 16:54:21 2020 +0100
@@ -137,9 +137,17 @@
 	return muc_affiliation_store:get_all(jid.bare(user_jid));
 end
 
+local function is_subscribed(user_jid)
+	return not not subscribed_users:get(user_jid);
+end
+
 -- Subscribes to all rooms that the user has an interest in
 -- Returns a set of room JIDs that have already had activity (thus no subscription)
 local function subscribe_all_rooms(user_jid)
+	if is_subscribed(user_jid) then
+		return nil;
+	end
+
 	-- Send activity notifications for all relevant rooms
 	local interested_rooms, err = get_interested_rooms(user_jid);