examples/beep.lua
author Myhailo Danylenko <isbear@ukrpost.net>
Wed, 25 Feb 2009 22:58:34 +0200
changeset 8 fc9060b9b7cc
child 16 d6d32995832b
permissions -rw-r--r--
Completion * commands completion * common hooks lua interface * complete separation of features into modules

-- BEEPING ON ALL MESSAGES

beep_enable = false

-- FIXME: add generic cid generation routine
boolean_cid = main.command ( 'beep',
	function ( args )
		local enable = yesno ( args )
		if enable ~= nil then
			beep_enable = enable
		end
		if beep_enable then
			hooks_d['hook-message-in'].beep = main.beep
			print ( "Beep on message is enabled" )
		else
			hooks_d['hook-message-in'].beep = nil
			print ( "Beep on message is disabled" )
		end
	end, { 'enable', 'disable', 'yes', 'no', 'true', 'false', 'on', 'off' } )

commands_help['beep'] = "[enable|disable|on|off|yes|no|true|false]\n\nEnables or disables beeping on all messages.\nIf state is omitted, prints current state."

-- vim: se ts=4: --