Software /
code /
prosody-modules
Changeset
316:c86fc337d56f
mod_remote_roster: Let component set roster item subscription.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Tue, 11 Jan 2011 18:13:23 +0500 |
parents | 315:dead242beee3 |
children | 317:4f78f5020aa9 |
files | mod_remote_roster/mod_remote_roster.lua |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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