# HG changeset patch # User Waqas Hussain # Date 1294751603 -18000 # Node ID c86fc337d56f2b85b99b0bf80f701503491d2bee # Parent dead242beee3b2a8b27e8ce9b5d4fdd6e54c754e mod_remote_roster: Let component set roster item subscription. diff -r dead242beee3 -r c86fc337d56f mod_remote_roster/mod_remote_roster.lua --- a/mod_remote_roster/mod_remote_roster.lua Mon Jan 10 17:20:34 2011 +0500 +++ b/mod_remote_roster/mod_remote_roster.lua Tue Jan 11 18:13:23 2011 +0500 @@ -93,13 +93,15 @@ session.send(st.error_reply(stanza, "modify", "item-not-found")); end else + local subscription = item.attr.subscription; + if subscription ~= "both" and subscription ~= "to" and subscription ~= "from" and subscription ~= "none" then -- TODO error on invalid + subscription = roster[jid] and roster[jid].subscription or "none"; + end local r_item = {name = item.attr.name, groups = {}}; if r_item.name == "" then r_item.name = nil; end - if roster[jid] then - r_item.subscription = roster[jid].subscription; - r_item.ask = roster[jid].ask; - else - r_item.subscription = "none"; + r_item.subscription = subscription; + if subscription ~= "both" and subscription ~= "to" then + r_item.ask = roster[jid] and roster[jid].ask; end for _, child in ipairs(item) do if child.name == "group" then