changeset 589:57ac609444c4

mod_smacks: Only advertise stream features when a stream is authenticated, and doesn't already have smacks enabled
author Matthew Wild <mwild1@gmail.com>
date Wed, 01 Feb 2012 23:27:23 +0000
parents 8042558336b6
children 40b707d7a809
files mod_smacks/mod_smacks.lua
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua	Mon Jan 30 04:20:24 2012 +0000
+++ b/mod_smacks/mod_smacks.lua	Wed Feb 01 23:27:23 2012 +0000
@@ -21,13 +21,16 @@
 
 module:hook("stream-features",
 		function (event)
-			event.features:tag("sm", sm_attr):tag("optional"):up():up();
+			local origin = event.origin;
+			if not(origin.smacks) and origin.type == "c2s" then
+				event.features:tag("sm", sm_attr):tag("optional"):up():up();
+			end
 		end);
 
 module:hook("s2s-stream-features",
 		function (event)
 			local origin = event.origin;
-			if s2s_smacks and (origin.type == "s2sin" or origin.type == "s2sout") then
+			if s2s_smacks and not(origin.smacks) and (origin.type == "s2sin" or origin.type == "s2sout") then
 				event.features:tag("sm", sm_attr):tag("optional"):up():up();
 			end
 		end);