Diff

core/rostermanager.lua @ 9671:e50559a42dfe

rostermanager, mod_presence: Store stanza for incoming subscription requests (fixes #689) (thanks Zash, Ge0rG)
author Matthew Wild <mwild1@gmail.com>
date Sat, 01 Dec 2018 22:13:24 +0000
parent 9303:72f0862978ef
child 9705:42a3e3a28248
line wrap: on
line diff
--- a/core/rostermanager.lua	Sat Dec 01 18:12:01 2018 +0100
+++ b/core/rostermanager.lua	Sat Dec 01 22:13:24 2018 +0000
@@ -263,15 +263,15 @@
 
 function is_contact_pending_in(username, host, jid)
 	local roster = load_roster(username, host);
-	return roster[false].pending[jid];
+	return roster[false].pending[jid] ~= nil;
 end
-local function set_contact_pending_in(username, host, jid)
+local function set_contact_pending_in(username, host, jid, stanza)
 	local roster = load_roster(username, host);
 	local item = roster[jid];
 	if item and (item.subscription == "from" or item.subscription == "both") then
 		return; -- false
 	end
-	roster[false].pending[jid] = true;
+	roster[false].pending[jid] = st.is_stanza(stanza) and st.preserialize(stanza) or true;
 	return save_roster(username, host, roster, jid);
 end
 function is_contact_pending_out(username, host, jid)