diff options
Diffstat (limited to 'core/rostermanager.lua')
-rw-r--r-- | core/rostermanager.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/core/rostermanager.lua b/core/rostermanager.lua index c39d28ed..a9be62aa 100644 --- a/core/rostermanager.lua +++ b/core/rostermanager.lua @@ -83,7 +83,7 @@ function load_roster(username, host) return roster; end -- Attempt to load roster for non-loaded user - -- TODO also support loading for offline user + return datamanager.load(username, host, "roster") or {}; end function save_roster(username, host) @@ -93,4 +93,18 @@ function save_roster(username, host) return nil; end +function process_inbound_subscription_approval(username, host, jid) + local roster = load_roster(username, host); + local item = roster[jid]; + if item and item.ask and (item.subscription == "none" or item.subscription == "from") then + if item.subscription == "none" then + item.subscription = "to"; + else + item.subscription = "both"; + end + item.ask = nil; + return datamanager.store(username, host, "roster", roster); + end +end + return _M;
\ No newline at end of file |