diff options
-rw-r--r-- | Makefile | 6 | ||||
-rwxr-xr-x | configure | 12 | ||||
-rw-r--r-- | core/storagemanager.lua | 12 | ||||
-rw-r--r-- | plugins/mod_carbons.lua | 10 | ||||
-rwxr-xr-x | prosody | 1 | ||||
-rw-r--r-- | util/hex.lua | 3 | ||||
-rw-r--r-- | util/sql.lua | 2 |
7 files changed, 27 insertions, 19 deletions
@@ -41,8 +41,8 @@ install: prosody.install prosodyctl.install prosody.cfg.lua.install util/encodin 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 @@ prosody.cfg.lua.install: prosody.cfg.lua.dist 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 @@ -227,7 +227,7 @@ find_program() { found="no" while [ "$item" ] do - if [ -e "$item/$1" ] + if [ -f "$item/$1" ] then found="yes" break @@ -250,7 +250,7 @@ then 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 @@ then 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 @@ then 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 @@ fi 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 diff --git a/core/storagemanager.lua b/core/storagemanager.lua index 45a1e21c..046f496a 100644 --- a/core/storagemanager.lua +++ b/core/storagemanager.lua @@ -134,9 +134,14 @@ local function purge(user, host) 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 @@ return { load_driver = load_driver; get_driver = get_driver; open = open; + purge = purge; olddm = olddm; }; diff --git a/plugins/mod_carbons.lua b/plugins/mod_carbons.lua index 51242809..9b94d58d 100644 --- a/plugins/mod_carbons.lua +++ b/plugins/mod_carbons.lua @@ -7,7 +7,7 @@ local st = require "util.stanza"; 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 @@ module:hook("iq-set/self/"..xmlns_carbons..":enable", toggle_carbons); 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 @@ -121,6 +121,7 @@ end function load_libraries() -- Load socket framework + socket = require "socket"; server = require "net.server" end diff --git a/util/hex.lua b/util/hex.lua index e41f4863..4cc28d33 100644 --- a/util/hex.lua +++ b/util/hex.lua @@ -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 @@ local function to(s) 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 } diff --git a/util/sql.lua b/util/sql.lua index 70e103df..2d5e1774 100644 --- a/util/sql.lua +++ b/util/sql.lua @@ -180,6 +180,7 @@ function engine:_transaction(func, ...) --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 @@ return { Table = Table; Index = Index; create_engine = create_engine; + db2uri = db2uri; }; |