Software /
code /
prosody-modules
Comparison
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 |
comparison
equal
deleted
inserted
replaced
588:8042558336b6 | 589:57ac609444c4 |
---|---|
19 | 19 |
20 local session_registry = {}; | 20 local session_registry = {}; |
21 | 21 |
22 module:hook("stream-features", | 22 module:hook("stream-features", |
23 function (event) | 23 function (event) |
24 event.features:tag("sm", sm_attr):tag("optional"):up():up(); | 24 local origin = event.origin; |
25 if not(origin.smacks) and origin.type == "c2s" then | |
26 event.features:tag("sm", sm_attr):tag("optional"):up():up(); | |
27 end | |
25 end); | 28 end); |
26 | 29 |
27 module:hook("s2s-stream-features", | 30 module:hook("s2s-stream-features", |
28 function (event) | 31 function (event) |
29 local origin = event.origin; | 32 local origin = event.origin; |
30 if s2s_smacks and (origin.type == "s2sin" or origin.type == "s2sout") then | 33 if s2s_smacks and not(origin.smacks) and (origin.type == "s2sin" or origin.type == "s2sout") then |
31 event.features:tag("sm", sm_attr):tag("optional"):up():up(); | 34 event.features:tag("sm", sm_attr):tag("optional"):up():up(); |
32 end | 35 end |
33 end); | 36 end); |
34 | 37 |
35 module:hook_stanza("http://etherx.jabber.org/streams", "features", | 38 module:hook_stanza("http://etherx.jabber.org/streams", "features", |