Changeset

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
parents 10891:8d47858805c9
children 10893:a256044c1d12
files util/adminstream.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/util/adminstream.lua	Wed Jun 03 22:21:17 2020 +0100
+++ b/util/adminstream.lua	Wed Jun 03 22:26:48 2020 +0100
@@ -271,7 +271,9 @@
 
 		client.thread = runner(function (stanza)
 			if st.is_stanza(stanza) then
-				client.events.fire_event("received", stanza);
+				if not client.events.fire_event("received", stanza) and not stanza.attr.xmlns then
+					client.events.fire_event("received/"..stanza.name, stanza);
+				end
 			elseif stanza.stream == "opened" then
 				stream_callbacks._streamopened(client, stanza.attr);
 				client.events.fire_event("connected");