diff options
author | Kim Alvefur <zash@zash.se> | 2016-12-10 02:55:38 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-12-10 02:55:38 +0100 |
commit | 21a13c5bca4e9f3b87dff4edfb0a291da128b8a3 (patch) | |
tree | 0c45bcdafed730fb0e14edfd08a8f649bf100fa6 /core/rostermanager.lua | |
parent | dec1fd604cc7dedef23b3885013fa821492ef86b (diff) | |
parent | bbaaaa99a4da333262792a211c46ec93ae0b270a (diff) | |
download | prosody-21a13c5bca4e9f3b87dff4edfb0a291da128b8a3.tar.gz prosody-21a13c5bca4e9f3b87dff4edfb0a291da128b8a3.zip |
Merge 0.10->trunk
Diffstat (limited to 'core/rostermanager.lua')
-rw-r--r-- | core/rostermanager.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/rostermanager.lua b/core/rostermanager.lua index 58d1f16e..88bd1e66 100644 --- a/core/rostermanager.lua +++ b/core/rostermanager.lua @@ -234,6 +234,18 @@ local function is_contact_subscribed(username, host, jid) local item = roster[jid]; return item and (item.subscription == "from" or item.subscription == "both"), err; end +local function is_user_subscribed(username, host, jid) + do + local selfjid = username.."@"..host; + local user_subscription = _get_online_roster_subscription(selfjid, jid); + if user_subscription then return (user_subscription == "both" or user_subscription == "to"); end + local contact_subscription = _get_online_roster_subscription(jid, selfjid); + if contact_subscription then return (contact_subscription == "both" or contact_subscription == "from"); end + end + local roster, err = load_roster(username, host); + local item = roster[jid]; + return item and (item.subscription == "to" or item.subscription == "both"), err; +end function is_contact_pending_in(username, host, jid) local roster = load_roster(username, host); @@ -350,6 +362,7 @@ return { process_inbound_subscription_cancellation = process_inbound_subscription_cancellation; process_inbound_unsubscribe = process_inbound_unsubscribe; is_contact_subscribed = is_contact_subscribed; + is_user_subscribed = is_user_subscribed; is_contact_pending_in = is_contact_pending_in; set_contact_pending_in = set_contact_pending_in; is_contact_pending_out = is_contact_pending_out; |