Diff

plugins/mod_presence.lua @ 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
parent 6281:8dc01fa767e0
child 6302:76699a0ae4c4
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