diff -r 5bf3b13edb80 -r dbb3362c1ff3 plugins/smacks.lua --- a/plugins/smacks.lua Sun Feb 10 02:53:03 2013 +0100 +++ b/plugins/smacks.lua Sun Feb 10 02:54:01 2013 +0100 @@ -44,6 +44,12 @@ return true; end end + + -- Graceful shutdown + local function on_close() + stream.resumption_token = nil; + stream:unhook("disconnected", on_disconnect); + end local function handle_sm_command(stanza) if stanza.name == "r" then -- Request for acks for stanzas we received @@ -67,9 +73,10 @@ -- Catch stanzas stream:hook("stanza", incoming_stanza); stream:hook("outgoing", outgoing_stanza); - + if stanza.attr.id then stream.resumption_token = stanza.attr.id; + stream:hook("closed", on_close, 100); stream:hook("disconnected", on_disconnect, 100); end elseif stanza.name == "resumed" then