Comparison

util/adminstream.lua @ 10892:b9ff7178787c

util.adminstream: Fire event based on stanza name too for convenience
author Matthew Wild <mwild1@gmail.com>
date Wed, 03 Jun 2020 22:26:48 +0100
parent 10876:c01c39a2c7a2
child 10900:9e6d979dd603
comparison
equal deleted inserted replaced
10891:8d47858805c9 10892:b9ff7178787c
269 client.stream = stream; 269 client.stream = stream;
270 client.notopen = true; 270 client.notopen = true;
271 271
272 client.thread = runner(function (stanza) 272 client.thread = runner(function (stanza)
273 if st.is_stanza(stanza) then 273 if st.is_stanza(stanza) then
274 client.events.fire_event("received", stanza); 274 if not client.events.fire_event("received", stanza) and not stanza.attr.xmlns then
275 client.events.fire_event("received/"..stanza.name, stanza);
276 end
275 elseif stanza.stream == "opened" then 277 elseif stanza.stream == "opened" then
276 stream_callbacks._streamopened(client, stanza.attr); 278 stream_callbacks._streamopened(client, stanza.attr);
277 client.events.fire_event("connected"); 279 client.events.fire_event("connected");
278 elseif stanza.stream == "closed" then 280 elseif stanza.stream == "closed" then
279 client.events.fire_event("disconnected"); 281 client.events.fire_event("disconnected");