aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xprosody2
-rwxr-xr-xprosodyctl8
-rw-r--r--util/datamanager.lua2
3 files changed, 8 insertions, 4 deletions
diff --git a/prosody b/prosody
index e4d0c719..6df7428b 100755
--- a/prosody
+++ b/prosody
@@ -303,7 +303,7 @@ end
function loop()
-- Error handler for errors that make it this far
local function catch_uncaught_error(err)
- if type(err) == "string" and err:match("%d*: interrupted!$") then
+ if type(err) == "string" and err:match("interrupted!$") then
return "quitting";
end
diff --git a/prosodyctl b/prosodyctl
index 8f79046f..575948a1 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -462,14 +462,18 @@ function commands.unregister(arg)
return 1;
end
+local http_errors = {
+ [404] = "Plugin not found, did you type the address correctly?"
+ };
+
function commands.addplugin(arg)
local url = arg[1];
if url:match("^http://") then
local http = require "socket.http";
show_message("Fetching...");
local code, err = http.request(url);
- if not code then
- show_message("Failed: "..err);
+ if not code or not tostring(err):match("^[23]") then
+ show_message("Failed: "..(http_errors[err] or ("HTTP error "..err)));
return 1;
end
if url:match("%.lua$") then
diff --git a/util/datamanager.lua b/util/datamanager.lua
index bfd69ebf..30cd082b 100644
--- a/util/datamanager.lua
+++ b/util/datamanager.lua
@@ -88,7 +88,7 @@ end
function getpath(username, host, datastore, ext, create)
ext = ext or "dat";
- host = host and encode(host);
+ host = (host and encode(host)) or "_global";
username = username and encode(username);
if username then
if create then mkdir(mkdir(mkdir(data_path).."/"..host).."/"..datastore); end