plugins.smacks: Start counting when sending <enable/>

Sun, 10 Feb 2013 03:41:45 +0100

author
Kim Alvefur <zash@zash.se>
date
Sun, 10 Feb 2013 03:41:45 +0100
changeset 326
f657ed8f464e
parent 325
843fabce2fc7
child 327
963d156a4b36

plugins.smacks: Start counting when sending <enable/>

plugins/smacks.lua file | annotate | diff | comparison | revisions
--- a/plugins/smacks.lua	Sun Feb 10 03:29:04 2013 +0100
+++ b/plugins/smacks.lua	Sun Feb 10 03:41:45 2013 +0100
@@ -68,11 +68,6 @@
 				stream:warn("Received bad ack for "..new_ack.." when last ack was "..last_ack);
 			end
 		elseif stanza.name == "enabled" then
-			stream.smacks = true;
-
-			-- Catch stanzas
-			stream:hook("stanza", incoming_stanza);
-			stream:hook("outgoing", outgoing_stanza);
 
 			if stanza.attr.id then
 				stream.resumption_token = stanza.attr.id;
@@ -105,6 +100,11 @@
 			--stream:unhook("bind-success", on_bind_success);
 			stream:debug("smacks: sending enable");
 			stream:send(verse.stanza("enable", { xmlns = xmlns_sm, resume = "true" }));
+			stream.smacks = true;
+
+			-- Catch stanzas
+			stream:hook("stanza", incoming_stanza);
+			stream:hook("outgoing", outgoing_stanza);
 		end
 	end
 

mercurial