Changeset

4139:eef75a0c85e3

mod_presence: Bounce errors for invalid presence types (thanks nolan/Astro)
author Matthew Wild <mwild1@gmail.com>
date Thu, 10 Feb 2011 21:09:20 +0000
parents 4138:62f5e6b11571
children 4140:e463e1df1bda
files plugins/mod_presence.lua
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_presence.lua	Tue Feb 01 02:33:50 2011 +0000
+++ b/plugins/mod_presence.lua	Thu Feb 10 21:09:20 2011 +0000
@@ -203,6 +203,8 @@
 			rostermanager.roster_push(node, host, to_bare);
 		end
 		core_post_stanza(origin, stanza);
+	else
+		origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid presence type"));
 	end
 	stanza.attr.from, stanza.attr.to = st_from, st_to;
 	return true;
@@ -253,7 +255,9 @@
 			sessionmanager.send_to_interested_resources(node, host, stanza);
 			rostermanager.roster_push(node, host, from_bare);
 		end
-	end -- discard any other type
+	else
+		origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid presence type"));
+	end
 	stanza.attr.from, stanza.attr.to = st_from, st_to;
 	return true;
 end
@@ -307,6 +311,8 @@
 		end -- no resources not online, discard
 	elseif not t or t == "unavailable" then
 		handle_normal_presence(origin, stanza);
+	else
+		origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid presence type"));
 	end
 	return true;
 end);