aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2014-12-16 18:33:54 -0500
committerWaqas Hussain <waqas20@gmail.com>2014-12-16 18:33:54 -0500
commit6db8f941f1437a02b380710df0e22e2a5e76568d (patch)
treedcafd2057d83c1a967fe5381adba1478d7e22001
parentac568342e55017173a1751565ba4ab18f7f0e11e (diff)
parent7aa032e7652834c2feac726ed1276c941e1dfb3f (diff)
downloadprosody-6db8f941f1437a02b380710df0e22e2a5e76568d.tar.gz
prosody-6db8f941f1437a02b380710df0e22e2a5e76568d.zip
Merge 0.10 -> trunk
-rw-r--r--net/http/server.lua2
-rw-r--r--plugins/mod_admin_telnet.lua1
-rw-r--r--plugins/mod_blocklist.lua2
-rw-r--r--plugins/mod_bosh.lua16
-rw-r--r--plugins/mod_http.lua1
-rw-r--r--plugins/mod_storage_sql2.lua2
-rw-r--r--util/sql.lua1
7 files changed, 18 insertions, 7 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index be870c51..581630d0 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -218,7 +218,7 @@ function handle_request(conn, request, finish_cb)
local event = request.method.." "..host..request.path:match("[^?]*");
local payload = { request = request, response = response };
- --log("debug", "Firing event: %s", event);
+ log("debug", event);
local result = events.fire_event(event, payload);
if result ~= nil then
if result ~= true then
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index 9185ac1b..ee8a43dc 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -974,6 +974,7 @@ function def_env.muc:list(host)
if not host_session or not host_session.modules.muc then
return nil, "Please supply the address of a local MUC component";
end
+ local print = self.session.print;
local c = 0;
for room in host_session.modules.muc.each_room() do
print(room.jid);
diff --git a/plugins/mod_blocklist.lua b/plugins/mod_blocklist.lua
index 70bfb5fc..81bdd2c6 100644
--- a/plugins/mod_blocklist.lua
+++ b/plugins/mod_blocklist.lua
@@ -13,7 +13,7 @@ local user_exists = require"core.usermanager".user_exists;
local is_contact_subscribed = require"core.rostermanager".is_contact_subscribed;
local st = require"util.stanza";
local st_error_reply = st.error_reply;
-local jid_prep, jid_split = import("jid", "prep", "split");
+local jid_prep, jid_split = import("util.jid", "prep", "split");
local host = module.host;
local storage = module:open_store();
diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua
index ca67db73..9e8354fe 100644
--- a/plugins/mod_bosh.lua
+++ b/plugins/mod_bosh.lua
@@ -22,6 +22,7 @@ local initialize_filters = require "util.filters".initialize;
local math_min = math.min;
local xpcall, tostring, type = xpcall, tostring, type;
local traceback = debug.traceback;
+local runner = require"util.async".runner;
local xmlns_streams = "http://etherx.jabber.org/streams";
local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams";
@@ -228,6 +229,8 @@ local function bosh_close_stream(session, reason)
sm_destroy_session(session);
end
+local runner_callbacks = { };
+
-- Handle the <body> tag in the request payload.
function stream_callbacks.streamopened(context, attr)
local request, response = context.request, context.response;
@@ -260,6 +263,10 @@ function stream_callbacks.streamopened(context, attr)
};
sessions[sid] = session;
+ session.thread = runner(function (stanza)
+ session:dispatch_stanza(stanza);
+ end, runner_callbacks, session);
+
local filter = initialize_filters(session);
session.log("debug", "BOSH session created for request from %s", session.ip);
@@ -355,6 +362,11 @@ function stream_callbacks.streamopened(context, attr)
end
local function handleerr(err) log("error", "Traceback[bosh]: %s", traceback(tostring(err), 2)); end
+
+function runner_callbacks:error(err)
+ return handleerr(err);
+end
+
function stream_callbacks.handlestanza(context, stanza)
if context.ignore then return; end
log("debug", "BOSH stanza received: %s\n", stanza:top_tag());
@@ -364,9 +376,7 @@ function stream_callbacks.handlestanza(context, stanza)
stanza.attr.xmlns = nil;
end
stanza = session.filter("stanzas/in", stanza);
- if stanza then
- return xpcall(function () return core_process_stanza(session, stanza) end, handleerr);
- end
+ session.thread:run(stanza);
end
end
diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua
index 8bda1cac..76ee151b 100644
--- a/plugins/mod_http.lua
+++ b/plugins/mod_http.lua
@@ -84,6 +84,7 @@ function module.add_host(module)
local app_name = event.item.name;
local default_app_path = event.item.default_path or "/"..app_name;
local app_path = get_base_path(module, app_name, default_app_path);
+ module:log("debug", "Serving '%s' at %s", app_name, module:http_url(app_name, app_path));
if not app_name then
-- TODO: Link to docs
module:log("error", "HTTP app has no 'name', add one or use module:provides('http', app)");
diff --git a/plugins/mod_storage_sql2.lua b/plugins/mod_storage_sql2.lua
index e5357416..a637c9dc 100644
--- a/plugins/mod_storage_sql2.lua
+++ b/plugins/mod_storage_sql2.lua
@@ -113,8 +113,6 @@ do -- process options to get a db connection
--local dburi = db2uri(params);
engine = mod_sql:create_engine(params);
- engine:set_encoding();
-
if module:get_option("sql_manage_tables", true) then
-- Automatically create table, ignore failure (table probably already exists)
create_table();
diff --git a/util/sql.lua b/util/sql.lua
index 5a1dda5d..453597da 100644
--- a/util/sql.lua
+++ b/util/sql.lua
@@ -156,6 +156,7 @@ function engine:connect()
dbh:autocommit(false); -- don't commit automatically
self.conn = dbh;
self.prepared = {};
+ self:set_encoding();
return true;
end
function engine:execute(sql, ...)