Software /
code /
prosody-modules
Comparison
mod_sift/mod_sift.lua @ 141:b42a88eba9ba
mod_sift: Don't disallow stanzas to bare JIDs when sifting is not in force for any resources.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sat, 06 Mar 2010 22:30:51 +0500 |
parent | 140:9a632cf13f51 |
child | 142:f37de7e2ad14 |
comparison
equal
deleted
inserted
replaced
140:9a632cf13f51 | 141:b42a88eba9ba |
---|---|
137 for _, childtag in ipairs(stanza.tags) do | 137 for _, childtag in ipairs(stanza.tags) do |
138 if siftdata.message[(childtag.attr.xmlns or "jabber:client").."|"..childtag.name] then | 138 if siftdata.message[(childtag.attr.xmlns or "jabber:client").."|"..childtag.name] then |
139 allowed = true; | 139 allowed = true; |
140 end | 140 end |
141 end | 141 end |
142 else | |
143 allowed = true; | |
142 end | 144 end |
143 end | 145 end |
144 if not allowed then | 146 if user and not allowed then |
145 -- element not allowed; sending back generic error | 147 -- element not allowed; sending back generic error |
146 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); | 148 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
147 -- FIXME maybe send to offline storage | 149 -- FIXME maybe send to offline storage |
148 return true; | 150 return true; |
149 end | 151 end |
179 for _, childtag in ipairs(stanza.tags) do | 181 for _, childtag in ipairs(stanza.tags) do |
180 if siftdata.presence[(childtag.attr.xmlns or "jabber:client").."|"..childtag.name] then | 182 if siftdata.presence[(childtag.attr.xmlns or "jabber:client").."|"..childtag.name] then |
181 allowed = true; | 183 allowed = true; |
182 end | 184 end |
183 end | 185 end |
186 else | |
187 allowed = true; | |
184 end | 188 end |
185 end | 189 end |
186 if not allowed then | 190 if user and not allowed then |
187 -- element not allowed; sending back generic error | 191 -- element not allowed; sending back generic error |
188 --origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); | 192 --origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
189 return true; | 193 return true; |
190 end | 194 end |
191 end, 50); | 195 end, 50); |