Changeset

2331:4842ce0c3be4

Merge with trunk
author Matthew Wild <mwild1@gmail.com>
date Mon, 07 Dec 2009 18:32:50 +0000
parents 2330:e80790636cbe (diff) 2327:5839f303addf (current diff)
children 2332:7772dde4010b
files
diffstat 3 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/prosody	Sat Dec 05 10:26:43 2009 -0800
+++ b/prosody	Mon Dec 07 18:32:50 2009 +0000
@@ -303,7 +303,7 @@
 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
 		
--- a/prosodyctl	Sat Dec 05 10:26:43 2009 -0800
+++ b/prosodyctl	Mon Dec 07 18:32:50 2009 +0000
@@ -462,14 +462,18 @@
 	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
--- a/util/datamanager.lua	Sat Dec 05 10:26:43 2009 -0800
+++ b/util/datamanager.lua	Mon Dec 07 18:32:50 2009 +0000
@@ -88,7 +88,7 @@
 
 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