Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Adds some checks about async.

damenchob4be1bcd052c
diff --git a/resources/prosody-plugins/mod_muc_poltergeist.lua b/resources/prosody-plugins/mod_muc_poltergeist.lua
index e3956a3299..fe03dc5bdb 100644
--- a/resources/prosody-plugins/mod_muc_poltergeist.lua
+++ b/resources/prosody-plugins/mod_muc_poltergeist.lua
@@ -4,6 +4,13 @@ local jid = require "util.jid";
local neturl = require "net.url";
local parse = neturl.parseQuery;
local poltergeist = module:require "poltergeist";
+
+local have_async = pcall(require, "util.async");
+if not have_async then
+ module:log("error", "requires a version of Prosody with util.async");
+ return;
+end
+
local wrap_async_run = module:require "util".wrap_async_run;
-- Options
diff --git a/resources/prosody-plugins/mod_muc_size.lua b/resources/prosody-plugins/mod_muc_size.lua
index fe1b345801..abe7269bc8 100644
--- a/resources/prosody-plugins/mod_muc_size.lua
+++ b/resources/prosody-plugins/mod_muc_size.lua
@@ -7,6 +7,13 @@ local it = require "util.iterators";
local json = require "util.json";
local iterators = require "util.iterators";
local array = require"util.array";
+
+local have_async = pcall(require, "util.async");
+if not have_async then
+ module:log("error", "requires a version of Prosody with util.async");
+ return;
+end
+
local wrap_async_run = module:require "util".wrap_async_run;
local tostring = tostring;
diff --git a/resources/prosody-plugins/mod_speakerstats_component.lua b/resources/prosody-plugins/mod_speakerstats_component.lua
index 4cfae6132d..f325008021 100644
--- a/resources/prosody-plugins/mod_speakerstats_component.lua
+++ b/resources/prosody-plugins/mod_speakerstats_component.lua
@@ -6,6 +6,13 @@ local st = require "util.stanza";
local socket = require "socket";
local json = require "util.json";
+-- we use async to detect Prosody 0.10 and earlier
+local have_async = pcall(require, "util.async");
+if not have_async then
+ module:log("warn", "speaker stats will not work with Prosody version 0.10 or less.");
+ return;
+end
+
local muc_component_host = module:get_option_string("muc_component");
if muc_component_host == nil then
log("error", "No muc_component specified. No muc to operate on!");
@@ -204,4 +211,4 @@ if prosody.hosts[muc_component_host] == nil then
prosody.events.add_handler("host-activated", process_host);
else
process_host(muc_component_host);
-end
\ No newline at end of file
+end
diff --git a/resources/prosody-plugins/util.lib.lua b/resources/prosody-plugins/util.lib.lua
index 34d39a348d..70e00a45ac 100644
--- a/resources/prosody-plugins/util.lib.lua
+++ b/resources/prosody-plugins/util.lib.lua
@@ -1,6 +1,5 @@
local jid = require "util.jid";
-local runner, waiter = require "util.async".runner, require "util.async".waiter;
-
+local have_async, async = pcall(require, "util.async");
local muc_domain_prefix
= module:get_option_string("muc_mapper_domain_prefix", "conference");
@@ -62,6 +61,13 @@ end
function wrap_async_run(event,handler)
+ local have_async = pcall(require, "util.async");
+ if not have_async then
+ module:log("error", "requires a version of Prosody with util.async");
+ return nil;
+ end
+
+ local runner = async.runner;
-- Grab a local response so that we can send the http response when
-- the handler is done.
local response = event.response;