Changeset

1865:db8b256f51ff

mod_admin_web,mod_carbons,mod_csi_compat,mod_mam_muc,mod_tcpproxy: Explicitly return true
author Kim Alvefur <zash@zash.se>
date Mon, 21 Sep 2015 20:03:08 +0200
parents 1864:991a5f74f848
children 1866:58d96960ba8b
files mod_admin_web/admin_web/mod_admin_web.lua mod_carbons/mod_carbons.lua mod_csi_compat/mod_csi_compat.lua mod_mam_muc/mod_mam_muc.lua mod_tcpproxy/mod_tcpproxy.lua
diffstat 5 files changed, 30 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/mod_admin_web/admin_web/mod_admin_web.lua	Sat Sep 19 16:51:16 2015 +0200
+++ b/mod_admin_web/admin_web/mod_admin_web.lua	Mon Sep 21 20:03:08 2015 +0200
@@ -271,7 +271,8 @@
 			local node = action.attr.node;
 			local ok, ret = service[module.host]:get_items(node, stanza.attr.from);
 			if not ok then
-				return origin.send(st.error_reply(stanza, "cancel", ret));
+				origin.send(st.error_reply(stanza, "cancel", ret));
+				return true;
 			end
 
 			local data = st.stanza("items", { node = node });
@@ -298,7 +299,8 @@
 		else
 			reply = st.error_reply(stanza, "feature-not-implemented");
 		end
-		return origin.send(reply);
+		origin.send(reply);
+		return true;
 	end);
 
 	-- Add/remove c2s sessions
--- a/mod_carbons/mod_carbons.lua	Sat Sep 19 16:51:16 2015 +0200
+++ b/mod_carbons/mod_carbons.lua	Mon Sep 21 20:03:08 2015 +0200
@@ -16,7 +16,8 @@
 	local state = stanza.tags[1].attr.mode or stanza.tags[1].name;
 	module:log("debug", "%s %sd carbons", origin.full_jid, state);
 	origin.want_carbons = state == "enable" and stanza.tags[1].attr.xmlns;
-	return origin.send(st.reply(stanza));
+	origin.send(st.reply(stanza));
+	return true;
 end
 module:hook("iq-set/self/"..xmlns_carbons..":disable", toggle_carbons);
 module:hook("iq-set/self/"..xmlns_carbons..":enable", toggle_carbons);
--- a/mod_csi_compat/mod_csi_compat.lua	Sat Sep 19 16:51:16 2015 +0200
+++ b/mod_csi_compat/mod_csi_compat.lua	Mon Sep 21 20:03:08 2015 +0200
@@ -14,5 +14,6 @@
 		module:fire_event("csi-client-active", event);
 	end
 	-- <flush/> is implemented as a noop, any IQ stanza would flush the queue anyways.
-	return origin.send(st.reply(stanza));
+	origin.send(st.reply(stanza));
+	return true;
 end, 10);
--- a/mod_mam_muc/mod_mam_muc.lua	Sat Sep 19 16:51:16 2015 +0200
+++ b/mod_mam_muc/mod_mam_muc.lua	Mon Sep 21 20:03:08 2015 +0200
@@ -153,7 +153,8 @@
 
 	local room_obj = get_room_from_jid(room);
 	if not room_obj then
-		return origin.send(st.error_reply(stanza, "cancel", "item-not-found"))
+		origin.send(st.error_reply(stanza, "cancel", "item-not-found"))
+		return true;
 	end
 	local from = jid_bare(orig_from);
 
@@ -161,7 +162,8 @@
 	local from_affiliation = room_obj:get_affiliation(from);
 	if from_affiliation == "outcast" -- banned
 		or room_obj:get_members_only() and not from_affiliation then -- members-only, not a member
-		return origin.send(st.error_reply(stanza, "auth", "forbidden"))
+		origin.send(st.error_reply(stanza, "auth", "forbidden"))
+		return true;
 	end
 
 	local qid = query.attr.queryid;
@@ -207,7 +209,8 @@
 	});
 
 	if not data then
-		return origin.send(st.error_reply(stanza, "cancel", "internal-server-error"));
+		origin.send(st.error_reply(stanza, "cancel", "internal-server-error"));
+		return true;
 	end
 	local total = err;
 
--- a/mod_tcpproxy/mod_tcpproxy.lua	Sat Sep 19 16:51:16 2015 +0200
+++ b/mod_tcpproxy/mod_tcpproxy.lua	Mon Sep 21 20:03:08 2015 +0200
@@ -46,21 +46,26 @@
 		local to_host, to_port = ibb_tag.attr[host_attr], ibb_tag.attr[port_attr];
 		local jid, sid = stanza.attr.from, ibb_tag.attr.sid;
 		if not (to_host and to_port) then
-			return origin.send(st.error_reply(stanza, "modify", "bad-request", "No host/port specified"));
+			origin.send(st.error_reply(stanza, "modify", "bad-request", "No host/port specified"));
+			return true;
 		elseif not sid or sid == "" then
-			return origin.send(st.error_reply(stanza, "modify", "bad-request", "No sid specified"));
+			origin.send(st.error_reply(stanza, "modify", "bad-request", "No sid specified"));
+			return true;
 		elseif ibb_tag.attr.stanza ~= "message" then
-			return origin.send(st.error_reply(stanza, "modify", "bad-request", "Only 'message' stanza transport is supported"));
+			origin.send(st.error_reply(stanza, "modify", "bad-request", "Only 'message' stanza transport is supported"));
+			return true;
 		end
 		local conn, err = socket.tcp();
 		if not conn then
-			return origin.send(st.error_reply(stanza, "wait", "resource-constraint", err));
+			origin.send(st.error_reply(stanza, "wait", "resource-constraint", err));
+			return true;
 		end
 		conn:settimeout(0);
 
 		local success, err = conn:connect(to_host, to_port);
 		if not success and err ~= "timeout" then
-			return origin.send(st.error_reply(stanza, "wait", "remote-server-not-found", err));
+			origin.send(st.error_reply(stanza, "wait", "remote-server-not-found", err));
+			return true;
 		end
 
 		local listener,seq = {}, 0;
@@ -88,18 +93,21 @@
 			if data then
 				conn:write(data);
 			else
-				return origin.send(
+				origin.send(
 					st.error_reply(stanza, "modify", "bad-request", "Invalid data (base64?)")
 				);
+				return true;
 			end
 		else
-			return origin.send(st.error_reply(stanza, "cancel", "item-not-found"));
+			origin.send(st.error_reply(stanza, "cancel", "item-not-found"));
+			return true;
 		end
 	elseif ibb_tag.name == "close" then
 		if close_session(stanza.attr.from, ibb_tag.attr.sid) then
 			origin.send(st.reply(stanza));
 		else
-			return origin.send(st.error_reply(stanza, "cancel", "item-not-found"));
+			origin.send(st.error_reply(stanza, "cancel", "item-not-found"));
+			return true;
 		end
 	end
 end