--- a/examples/jobs.lua Sun Mar 15 15:03:51 2009 +0200
+++ b/examples/jobs.lua Sun Mar 15 20:45:24 2009 +0200
@@ -31,28 +31,33 @@
local who
if args.t then
who = args.t
- args.t = nil
else
who = main.current_buddy ()
end
local stat = args[1]
- args[1] = nil
+ local mess = args[2]
delayed_jobs[who] = { }
- delayed_jobs[who][stat] = 'say_to -q ' .. who .. ' ' .. rebuild_args_string ( args )
+ delayed_jobs[who][stat] = 'say_to -q ' .. who .. ' ' .. mess
end )
main.command ( 'job',
function ( args )
- local action, jid, stat = args:match ( "(%w+)%s+(%w+)%s+(%w)" )
+ args = parse_args ( args )
+ local action, jid, stat = args[1], args[2], args[3]
if action == 'del' then
delayed_jobs[jid][stat] = nil
else
- print ( 'List of jobs:' )
+ local text = ''
for jid, jobs in pairs ( delayed_jobs ) do
for status, job in pairs ( jobs ) do
- print ( ' - ' .. jid .. ' -> ' .. status .. ': ' .. job )
+ text = text .. '\n - ' .. jid .. ' -> ' .. status .. ': ' .. job
end
end
+ if text ~= '' then
+ print ( 'List of jobs:' .. text )
+ else
+ print ( 'No jobs' )
+ end
end
end, { "del" } )