# HG changeset patch # User Myhailo Danylenko # Date 1247745386 -10800 # Node ID b3ebfb8eb7982a73c30c2fd7fd24c8cc0d45f133 # Parent d049c92d080945a911d9a483cb2be426b8186136 De-hardcode room priv bindings, take first diff -r d049c92d0809 -r b3ebfb8eb798 CMakeLists.txt --- a/CMakeLists.txt Thu May 21 00:13:26 2009 +0300 +++ b/CMakeLists.txt Thu Jul 16 14:56:26 2009 +0300 @@ -44,7 +44,7 @@ set(CPACK_SOURCE_GENERATOR TBZ2) set(CPACK_GENERATOR DEB) # FIXME: Detect architecture. How? Though, it anyway produces nonconformant deb names... -set(CPACK_SYSTEM_NAME i386) +#set(CPACK_SYSTEM_NAME i386) # XXX: Set package name directly to get rid of -Sources? set(CPACK_SOURCE_IGNORE_FILES "/\\\\..*;\\\\.swp;~$;/build/;\\\\.tar\\\\.;\\\\.deb;\\\\.so") include(CPack) diff -r d049c92d0809 -r b3ebfb8eb798 examples/room_priv.lua --- a/examples/room_priv.lua Thu May 21 00:13:26 2009 +0300 +++ b/examples/room_priv.lua Thu Jul 16 14:56:26 2009 +0300 @@ -1,6 +1,7 @@ -- ROOM NICK COMPLETION +-- global room_cid = main.command ( 'priv', function ( args ) main.run ( 'room privmsg ' .. args ) @@ -8,9 +9,10 @@ commands_help['priv'] = "nick message\n\nSends private message to room participant. Nick completion available! ;)" -registered_nicks = {} +local registered_nicks = {} -function register_nicks () +-- global, used in binding +function room_priv_register_nicks () for k, nick in pairs ( registered_nicks ) do main.del_completion ( room_cid, nick ) end @@ -29,15 +31,21 @@ end end -room_priv_pgup_action = main.binding ( '338' ) -room_priv_pgdn_action = main.binding ( '339' ) -main.binding ( '338', ('lua main.run ( %q ); register_nicks ()'):format ( room_priv_pgup_action ) ) -main.binding ( '339', ('lua main.run ( %q ); register_nicks ()'):format ( room_priv_pgdn_action ) ) +-- XXX +local room_priv_pattern = "roster%s+(up|down)" +local room_priv_restore = {} +for key, binding in pairs ( main.binding () ) do + if binding:match ( room_priv_pattern ) then + room_priv_restore[key] = binding + main.binding ( key, ('lua main.run ( %q ); room_priv_register_nicks ()'):format ( binding ) + end +end hooks_d['hook-quit'].room_priv = function ( args ) - main.binding ( '338', room_priv_pgup_action ) - main.binding ( '339', room_priv_pgdn_action ) + for key, binding in pairs ( room_priv_restore ) do + main.binding ( key, binding ) + end end -- vim: se ts=4: --