comparison mod_muc_rai/mod_muc_rai.lua @ 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 0e72dd70afff
children 2ede3450abca
comparison
equal deleted inserted replaced
3997:0e72dd70afff 3998:67047ed63b15
135 -- Use affiliation as an indication of interest, return 135 -- Use affiliation as an indication of interest, return
136 -- all rooms a user is affiliated 136 -- all rooms a user is affiliated
137 return muc_affiliation_store:get_all(jid.bare(user_jid)); 137 return muc_affiliation_store:get_all(jid.bare(user_jid));
138 end 138 end
139 139
140 local function is_subscribed(user_jid)
141 return not not subscribed_users:get(user_jid);
142 end
143
140 -- Subscribes to all rooms that the user has an interest in 144 -- Subscribes to all rooms that the user has an interest in
141 -- Returns a set of room JIDs that have already had activity (thus no subscription) 145 -- Returns a set of room JIDs that have already had activity (thus no subscription)
142 local function subscribe_all_rooms(user_jid) 146 local function subscribe_all_rooms(user_jid)
147 if is_subscribed(user_jid) then
148 return nil;
149 end
150
143 -- Send activity notifications for all relevant rooms 151 -- Send activity notifications for all relevant rooms
144 local interested_rooms, err = get_interested_rooms(user_jid); 152 local interested_rooms, err = get_interested_rooms(user_jid);
145 153
146 if not interested_rooms then 154 if not interested_rooms then
147 if err then 155 if err then