Changeset

6291:7a604381d6fc

mod_presence: Move presence/initial event to correct place so it actually fires
author Kim Alvefur <zash@zash.se>
date Thu, 03 Jul 2014 11:54:50 +0200
parents 6289:a29cc79295e6
children 6292:751618071e89
files plugins/mod_presence.lua
diffstat 1 files changed, 1 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_presence.lua	Mon Jun 30 13:11:01 2014 +0200
+++ b/plugins/mod_presence.lua	Thu Jul 03 11:54:50 2014 +0200
@@ -90,6 +90,7 @@
 		end
 	end
 	if stanza.attr.type == nil and not origin.presence then -- initial presence
+		module:fire_event("presence/initial", { origin = origin, stanza = stanza } );
 		origin.presence = stanza; -- FIXME repeated later
 		local probe = st.presence({from = origin.full_jid, type = "probe"});
 		for jid, item in pairs(roster) do -- probe all contacts we are subscribed to
@@ -137,9 +138,6 @@
 			origin.directed = nil;
 		end
 	else
-		if not origin.presence then
-			module:fire_event("presence/initial", { origin = origin, stanza = stanza } );
-		end
 		origin.presence = stanza;
 		stanza:tag("delay", { xmlns = "urn:xmpp:delay", from = host, stamp = datetime.datetime() }):up();
 		if origin.priority ~= priority then