# HG changeset patch # User Myhailo Danylenko # Date 1236116393 -7200 # Node ID d6d32995832b9c1f59d2a6806f25f8d2649641be # Parent b224cbc7b8be1aae61d97b6df65adb009b58a13d Use new commands in scripts diff -r b224cbc7b8be -r d6d32995832b examples/beep.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." diff -r b224cbc7b8be -r d6d32995832b examples/mcabberrc.lua --- 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