Fixed: rostermanager: Create new roster item if one doesn't exist on subscription approval (fixes issue #77)

Mon, 30 Mar 2009 02:02:59 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Mon, 30 Mar 2009 02:02:59 +0500
changeset 925
4861bcf0afa4
parent 924
db022135aed4
child 926
ceaa7d54a3cb

Fixed: rostermanager: Create new roster item if one doesn't exist on subscription approval (fixes issue #77)

core/rostermanager.lua file | annotate | diff | comparison | revisions
--- a/core/rostermanager.lua	Mon Mar 30 01:57:51 2009 +0500
+++ b/core/rostermanager.lua	Mon Mar 30 02:02:59 2009 +0500
@@ -224,6 +224,10 @@
 	if is_contact_pending_in(username, host, jid) then
 		local roster = load_roster(username, host);
 		local item = roster[jid];
+		if not item then -- FIXME should roster item be auto-created?
+			item = {subscription = "none", groups = {}};
+			roster[jid] = item;
+		end
 		if item.subscription == "none" then
 			item.subscription = "from";
 		else -- subscription == to

mercurial