diff -r bd9f24178d67 -r 5bcdb71ef2f2 examples/attention.lua --- a/examples/attention.lua Mon Apr 12 00:41:23 2010 +0300 +++ b/examples/attention.lua Wed Apr 14 11:21:02 2010 +0300 @@ -48,8 +48,7 @@ attention_handler_registered = true end end -main.hook ( 'hook-post-connect', attention_pc_handler ) -main.hook ( 'hook-pre-disconnect', +local attention_pd_handler = function ( args ) if attention_handler_registered then local connection = main.connection () @@ -58,7 +57,9 @@ end attention_handler_registered = false end - end ) + end +main.hook ( 'hook-post-connect', attention_pc_handler ) +main.hook ( 'hook-pre-disconnect', attention_pd_handler ) -- register handler, if we are already connected main.hook ( 'hook-lua-start', @@ -69,6 +70,7 @@ main.hook ('hook-lua-quit', function ( args ) main.del_feature ( 'urn:xmpp:attention:0' ) + attention_pd_handler () end ) -- vim: se ts=4 sw=4: --