examples/beep.lua
changeset 16 d6d32995832b
parent 8 fc9060b9b7cc
child 31 54957980a83a
equal deleted inserted replaced
15:b224cbc7b8be 16:d6d32995832b
     1 -- BEEPING ON ALL MESSAGES
     1 -- BEEPING ON ALL MESSAGES
     2 
     2 
     3 beep_enable = false
     3 beep_enable = false
     4 
     4 
     5 -- FIXME: add generic cid generation routine
     5 main.command ( 'beep',
     6 boolean_cid = main.command ( 'beep',
       
     7 	function ( args )
     6 	function ( args )
     8 		local enable = yesno ( args )
     7 		local enable = yesno ( args )
     9 		if enable ~= nil then
     8 		if enable ~= nil then
    10 			beep_enable = enable
     9 			beep_enable = enable
    11 		end
    10 		end
    14 			print ( "Beep on message is enabled" )
    13 			print ( "Beep on message is enabled" )
    15 		else
    14 		else
    16 			hooks_d['hook-message-in'].beep = nil
    15 			hooks_d['hook-message-in'].beep = nil
    17 			print ( "Beep on message is disabled" )
    16 			print ( "Beep on message is disabled" )
    18 		end
    17 		end
    19 	end, { 'enable', 'disable', 'yes', 'no', 'true', 'false', 'on', 'off' } )
    18 	end, boolean_cid )
    20 
    19 
    21 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."
    20 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."
    22 
    21 
    23 -- vim: se ts=4: --
    22 -- vim: se ts=4: --