Software /
code /
prosody
Comparison
core/stanza_router.lua @ 10639:08e3063eb1ac
stanza_router: Add once-per-routed-stanza event, pre-stanza
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 05 Feb 2020 17:40:50 +0000 |
parent | 10529:854586ac7c96 |
child | 10645:067ada779ea5 |
comparison
equal
deleted
inserted
replaced
10638:92918212ee83 | 10639:08e3063eb1ac |
---|---|
170 to_type = '/bare'; | 170 to_type = '/bare'; |
171 to_self = true; | 171 to_self = true; |
172 end | 172 end |
173 end | 173 end |
174 | 174 |
175 local event_data = {origin=origin, stanza=stanza}; | 175 local event_data = {origin=origin, stanza=stanza, to_self=to_self}; |
176 | |
177 local result = hosts[origin.host].events.fire_event("pre-stanza", event_data); | |
178 if result ~= nil then | |
179 log("debug", "Stanza rejected by pre-stanza handler: %s", event_data.reason or "unknown reason"); | |
180 return; | |
181 end | |
182 | |
176 if preevents then -- c2s connection | 183 if preevents then -- c2s connection |
177 if hosts[origin.host].events.fire_event('pre-'..stanza.name..to_type, event_data) then return; end -- do preprocessing | 184 if hosts[origin.host].events.fire_event('pre-'..stanza.name..to_type, event_data) then return; end -- do preprocessing |
178 end | 185 end |
179 local h = hosts[to_bare] or hosts[host or origin.host]; | 186 local h = hosts[to_bare] or hosts[host or origin.host]; |
180 if h then | 187 if h then |