Use new commands in scripts
authorMyhailo Danylenko <isbear@ukrpost.net>
Tue, 03 Mar 2009 23:39:53 +0200
changeset 16 d6d32995832b
parent 15 b224cbc7b8be
child 17 3a12759a22b1
Use new commands in scripts
examples/beep.lua
examples/mcabberrc.lua
--- a/examples/beep.lua	Tue Mar 03 23:20:29 2009 +0200
+++ b/examples/beep.lua	Tue Mar 03 23:39:53 2009 +0200
@@ -2,8 +2,7 @@
 
 beep_enable = false
 
--- FIXME: add generic cid generation routine
-boolean_cid = main.command ( 'beep',
+main.command ( 'beep',
 	function ( args )
 		local enable = yesno ( args )
 		if enable ~= nil then
@@ -16,7 +15,7 @@
 			hooks_d['hook-message-in'].beep = nil
 			print ( "Beep on message is disabled" )
 		end
-	end, { 'enable', 'disable', 'yes', 'no', 'true', 'false', 'on', 'off' } )
+	end, boolean_cid )
 
 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."
 
--- a/examples/mcabberrc.lua	Tue Mar 03 23:20:29 2009 +0200
+++ b/examples/mcabberrc.lua	Tue Mar 03 23:39:53 2009 +0200
@@ -128,6 +128,8 @@
 	return false
 end
 
+boolean_cid = main.add_category { 'enable', 'disable', 'yes', 'no', 'true', 'false', 'on', 'off' }
+
 function yesno ( value )
 	if value == 'enable' or value == 'yes' or value == 'true' or value == 'on' or value == true then
 		return true