Changeset

6534:b89406fa076c

Merge 0.10 -> trunk
author Waqas Hussain <waqas20@gmail.com>
date Tue, 16 Dec 2014 18:33:54 -0500
parents 6527:074a41ee0409 (current diff) 6533:5da544e97bea (diff)
children 6535:0f940a7ba489
files plugins/mod_admin_telnet.lua plugins/mod_storage_sql2.lua
diffstat 7 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/net/http/server.lua	Sat Nov 22 11:53:14 2014 +0100
+++ b/net/http/server.lua	Tue Dec 16 18:33:54 2014 -0500
@@ -218,7 +218,7 @@
 
 	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
--- a/plugins/mod_admin_telnet.lua	Sat Nov 22 11:53:14 2014 +0100
+++ b/plugins/mod_admin_telnet.lua	Tue Dec 16 18:33:54 2014 -0500
@@ -974,6 +974,7 @@
 	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);
--- a/plugins/mod_blocklist.lua	Sat Nov 22 11:53:14 2014 +0100
+++ b/plugins/mod_blocklist.lua	Tue Dec 16 18:33:54 2014 -0500
@@ -13,7 +13,7 @@
 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();
--- a/plugins/mod_bosh.lua	Sat Nov 22 11:53:14 2014 +0100
+++ b/plugins/mod_bosh.lua	Tue Dec 16 18:33:54 2014 -0500
@@ -22,6 +22,7 @@
 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 @@
 	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 @@
 		};
 		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 @@
 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 @@
 			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
 
--- a/plugins/mod_http.lua	Sat Nov 22 11:53:14 2014 +0100
+++ b/plugins/mod_http.lua	Tue Dec 16 18:33:54 2014 -0500
@@ -84,6 +84,7 @@
 		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)");
--- a/plugins/mod_storage_sql2.lua	Sat Nov 22 11:53:14 2014 +0100
+++ b/plugins/mod_storage_sql2.lua	Tue Dec 16 18:33:54 2014 -0500
@@ -113,8 +113,6 @@
 	--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();
--- a/util/sql.lua	Sat Nov 22 11:53:14 2014 +0100
+++ b/util/sql.lua	Tue Dec 16 18:33:54 2014 -0500
@@ -156,6 +156,7 @@
 	dbh:autocommit(false); -- don't commit automatically
 	self.conn = dbh;
 	self.prepared = {};
+	self:set_encoding();
 	return true;
 end
 function engine:execute(sql, ...)