Changeset

6811:82350a06df6e

Merge 0.10->trunk
author Matthew Wild <mwild1@gmail.com>
date Wed, 02 Sep 2015 18:55:35 +0100
parents 6801:5032d4817a30 (current diff) 6810:533fd843d91f (diff)
children 6820:40d50c239564
files core/storagemanager.lua
diffstat 7 files changed, 27 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Mon Aug 24 13:16:49 2015 +1000
+++ b/Makefile	Wed Sep 02 18:55:35 2015 +0100
@@ -41,8 +41,8 @@
 	umask 0022 && cp -r plugins/* $(MODULES)
 	install -m644 certs/* $(CONFIG)/certs
 	install -m644 man/prosodyctl.man $(MAN)/man1/prosodyctl.1
-	test -e $(CONFIG)/prosody.cfg.lua || install -m644 prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua
-	test -e prosody.version && install -m644 prosody.version $(SOURCE)/prosody.version || true
+	test -f $(CONFIG)/prosody.cfg.lua || install -m644 prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua
+	test -f prosody.version && install -m644 prosody.version $(SOURCE)/prosody.version || true
 	$(MAKE) install -C util-src
 
 clean:
@@ -66,7 +66,7 @@
 	sed 's|certs/|$(INSTALLEDCONFIG)/certs/|' $^ > $@
 
 prosody.version: $(wildcard prosody.release .hg/dirstate)
-	test -e .hg/dirstate && \
+	test -d .hg/dirstate && \
 		hexdump -n6 -e'6/1 "%02x"' .hg/dirstate > $@ || true
 	test -f prosody.release && \
 		cp prosody.release $@ || true
--- a/configure	Mon Aug 24 13:16:49 2015 +1000
+++ b/configure	Wed Sep 02 18:55:35 2015 +0100
@@ -227,7 +227,7 @@
    found="no"
    while [ "$item" ]
    do
-      if [ -e "$item/$1" ]
+      if [ -f "$item/$1" ]
       then
          found="yes"
          break
@@ -250,7 +250,7 @@
       LUA_SUFFIX="$suffix"
       if [ "$LUA_DIR_SET" = "yes" ]
       then
-         if [ -e "$LUA_DIR/bin/lua$suffix" ]
+         if [ -f "$LUA_DIR/bin/lua$suffix" ]
          then
             find_lua="$LUA_DIR"
          fi
@@ -265,7 +265,7 @@
    done
 fi
 
-if ! [ "$LUA_DIR_SET" = "yes" ]
+if [ "$LUA_DIR_SET" != "yes" ]
 then
    echo -n "Looking for Lua... "
    if [ ! "$find_lua" ]
@@ -284,12 +284,12 @@
    fi
 fi
 
-if ! [ "$LUA_INCDIR_SET" = "yes" ]
+if [ "$LUA_INCDIR_SET" != "yes" ]
 then
    LUA_INCDIR="$LUA_DIR/include"
 fi
 
-if ! [ "$LUA_LIBDIR_SET" = "yes" ]
+if [ "$LUA_LIBDIR_SET" != "yes" ]
 then
    LUA_LIBDIR="$LUA_DIR/lib"
 fi
@@ -311,7 +311,7 @@
 
 echo -n "Checking Lua includes... "
 lua_h="$LUA_INCDIR/lua.h"
-if [ -e "$lua_h" ]
+if [ -f "$lua_h" ]
 then
    echo "lua.h found in $lua_h"
 else
--- a/core/storagemanager.lua	Mon Aug 24 13:16:49 2015 +1000
+++ b/core/storagemanager.lua	Wed Sep 02 18:55:35 2015 +0100
@@ -134,9 +134,14 @@
 	if type(storage) == "table" then
 		-- multiple storage backends in use that we need to purge
 		local purged = {};
-		for store, driver in pairs(storage) do
-			if not purged[driver] then
-				purged[driver] = get_driver(host, store):purge(user);
+		for store, driver_name in pairs(storage) do
+			if not purged[driver_name] then
+				local driver = get_driver(host, store);
+				if driver.purge then
+					purged[driver_name] = driver:purge(user);
+				else
+					log("warn", "Storage driver %s does not support removing all user data, you may need to delete it manually", driver_name);
+				end
 			end
 		end
 	end
@@ -172,6 +177,7 @@
 	load_driver = load_driver;
 	get_driver = get_driver;
 	open = open;
+	purge = purge;
 
 	olddm = olddm;
 };
--- a/plugins/mod_carbons.lua	Mon Aug 24 13:16:49 2015 +1000
+++ b/plugins/mod_carbons.lua	Wed Sep 02 18:55:35 2015 +0100
@@ -7,7 +7,7 @@
 local jid_bare = require "util.jid".bare;
 local xmlns_carbons = "urn:xmpp:carbons:2";
 local xmlns_forward = "urn:xmpp:forward:0";
-local full_sessions, bare_sessions = full_sessions, bare_sessions;
+local full_sessions, bare_sessions = prosody.full_sessions, prosody.bare_sessions;
 
 local function toggle_carbons(event)
 	local origin, stanza = event.origin, event.stanza;
@@ -21,14 +21,12 @@
 
 local function message_handler(event, c2s)
 	local origin, stanza = event.origin, event.stanza;
-	local orig_type = stanza.attr.type;
+	local orig_type = stanza.attr.type or "normal";
 	local orig_from = stanza.attr.from;
 	local orig_to = stanza.attr.to;
 	
-	if not (orig_type == nil
-			or orig_type == "normal"
-			or orig_type == "chat") then
-		return -- No carbons for messages of type error or headline
+	if not(orig_type == "chat" or orig_type == "normal" and stanza:get_child("body")) then
+		return -- Only chat type messages
 	end
 
 	-- Stanza sent by a local client
--- a/prosody	Mon Aug 24 13:16:49 2015 +1000
+++ b/prosody	Wed Sep 02 18:55:35 2015 +0100
@@ -121,6 +121,7 @@
 
 function load_libraries()
 	-- Load socket framework
+	socket = require "socket";
 	server = require "net.server"
 end	
 
--- a/util/hex.lua	Mon Aug 24 13:16:49 2015 +1000
+++ b/util/hex.lua	Wed Sep 02 18:55:35 2015 +0100
@@ -1,6 +1,7 @@
 local s_char = string.char;
 local s_format = string.format;
 local s_gsub = string.gsub;
+local s_lower = string.lower;
 
 local char_to_hex = {};
 local hex_to_char = {};
@@ -19,7 +20,7 @@
 end
 
 local function from(s)
-	return (s_gsub(s, "..", hex_to_char));
+	return (s_gsub(s_lower(s), "%X*(%x%x)%X*", hex_to_char));
 end
 
 return { to = to, from = from }
--- a/util/sql.lua	Mon Aug 24 13:16:49 2015 +1000
+++ b/util/sql.lua	Wed Sep 02 18:55:35 2015 +0100
@@ -180,6 +180,7 @@
 	--assert(not self.__transaction, "Recursive transactions not allowed");
 	local args, n_args = {...}, select("#", ...);
 	local function f() return func(unpack(args, 1, n_args)); end
+	log("debug", "SQL transaction begin [%s]", tostring(func));
 	self.__transaction = true;
 	local success, a, b, c = xpcall(f, debug_traceback);
 	self.__transaction = nil;
@@ -328,4 +329,5 @@
 	Table = Table;
 	Index = Index;
 	create_engine = create_engine;
+	db2uri = db2uri;
 };