Software /
code /
prosody
Comparison
core/stanza_router.lua @ 1256:98f0e9eadf3b
stanza_router: Fire global event if host doesn't have events, fixes #103
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 31 May 2009 21:35:21 +0100 |
parent | 1254:c199be608546 |
child | 1258:01b69efffb1c |
child | 1262:0d94c57555d9 |
comparison
equal
deleted
inserted
replaced
1255:a25b12c105bb | 1256:98f0e9eadf3b |
---|---|
125 event = "stanza/"..stanza.name; | 125 event = "stanza/"..stanza.name; |
126 end | 126 end |
127 else | 127 else |
128 event = "stanza/"..stanza.attr.xmlns..":"..stanza.name; | 128 event = "stanza/"..stanza.attr.xmlns..":"..stanza.name; |
129 end | 129 end |
130 if h.events.fire_event(event, {origin = origin, stanza = stanza}) then return; end | 130 if (h.events or prosody.events).fire_event(event, {origin = origin, stanza = stanza}) then return; end |
131 end | 131 end |
132 modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza); | 132 modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza); |
133 end | 133 end |
134 end | 134 end |
135 | 135 |
153 end | 153 end |
154 end | 154 end |
155 | 155 |
156 local event_data = {origin=origin, stanza=stanza}; | 156 local event_data = {origin=origin, stanza=stanza}; |
157 if origin.full_jid then -- c2s connection | 157 if origin.full_jid then -- c2s connection |
158 if hosts[origin.host].events.fire_event('pre-'..stanza.name..to_type, event_data) then return; end -- do preprocessing | 158 if (hosts[origin.host].events or prosody.events).fire_event('pre-'..stanza.name..to_type, event_data) then return; end -- do preprocessing |
159 end | 159 end |
160 local h = hosts[to_bare] or hosts[host or origin.host]; | 160 local h = hosts[to_bare] or hosts[host or origin.host]; |
161 if h then | 161 if h then |
162 if h.type == "component" then | 162 if h.type == "component" then |
163 component_handle_stanza(origin, stanza); | 163 component_handle_stanza(origin, stanza); |
164 return; | 164 return; |
165 else | 165 else |
166 if h.events.fire_event(stanza.name..to_type, event_data) then return; end -- do processing | 166 if (h.events or prosody.events).fire_event(stanza.name..to_type, event_data) then return; end -- do processing |
167 end | 167 end |
168 else -- non-local recipient | 168 else -- non-local recipient |
169 core_route_stanza(origin, stanza); | 169 core_route_stanza(origin, stanza); |
170 return; | 170 return; |
171 end | 171 end |