From 09450f23e46e71d8678cc265475f4619a21e6ae5 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 28 Nov 2016 14:27:59 +0100 Subject: util.dependencies: Set ssl.x509 so core.certmanager knows that LuaSec is capable of certificate validation (fixes #781) --- util/dependencies.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/util/dependencies.lua b/util/dependencies.lua index 9ea211dd..491bfd9b 100644 --- a/util/dependencies.lua +++ b/util/dependencies.lua @@ -102,6 +102,7 @@ function check_dependencies() elseif not _G.ssl then _G.ssl = ssl; _G.ssl.context = require "ssl.context"; + _G.ssl.x509 = softreq "ssl.x509"; end local encodings, err = softreq "util.encodings" -- cgit v1.2.3 From a9b7d2f8e1f16233242ee54f91d1c1b352959544 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 9 Dec 2016 15:15:10 +0100 Subject: core.rostermanager: Add method for checking if the user is subscribed to a contact --- core/rostermanager.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/rostermanager.lua b/core/rostermanager.lua index 5e06e3f7..a846fea6 100644 --- a/core/rostermanager.lua +++ b/core/rostermanager.lua @@ -210,6 +210,18 @@ function is_contact_subscribed(username, host, jid) local item = roster[jid]; return item and (item.subscription == "from" or item.subscription == "both"), err; end +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); -- cgit v1.2.3 From 1dbe1533ec336146aead43fca58952d06174e67c Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 8 Dec 2016 20:49:35 +0100 Subject: mod_presence: Send probe once subscribed (fixes #794) --- plugins/mod_presence.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua index a5b4f282..6df56fe0 100644 --- a/plugins/mod_presence.lua +++ b/plugins/mod_presence.lua @@ -201,7 +201,9 @@ function handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_ end core_post_stanza(origin, stanza); send_presence_of_available_resources(node, host, to_bare, origin); - core_post_stanza(origin, st.presence({ type = "probe", from = from_bare, to = to_bare })); + if rostermanager.is_user_subscribed(node, host, to_bare) then + core_post_stanza(origin, st.presence({ type = "probe", from = from_bare, to = to_bare })); + end elseif stanza.attr.type == "unsubscribed" then -- 1. send unavailable -- 2. route stanza -- cgit v1.2.3