Software /
code /
prosody-modules
Diff
mod_smacks/mod_smacks.lua @ 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 |
parent | 588:8042558336b6 |
child | 590:40b707d7a809 |
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);