29 function ( args ) |
29 function ( args ) |
30 args = parse_args ( args ) |
30 args = parse_args ( args ) |
31 local who |
31 local who |
32 if args.t then |
32 if args.t then |
33 who = args.t |
33 who = args.t |
34 args.t = nil |
|
35 else |
34 else |
36 who = main.current_buddy () |
35 who = main.current_buddy () |
37 end |
36 end |
38 local stat = args[1] |
37 local stat = args[1] |
39 args[1] = nil |
38 local mess = args[2] |
40 delayed_jobs[who] = { } |
39 delayed_jobs[who] = { } |
41 delayed_jobs[who][stat] = 'say_to -q ' .. who .. ' ' .. rebuild_args_string ( args ) |
40 delayed_jobs[who][stat] = 'say_to -q ' .. who .. ' ' .. mess |
42 end ) |
41 end ) |
43 |
42 |
44 main.command ( 'job', |
43 main.command ( 'job', |
45 function ( args ) |
44 function ( args ) |
46 local action, jid, stat = args:match ( "(%w+)%s+(%w+)%s+(%w)" ) |
45 args = parse_args ( args ) |
|
46 local action, jid, stat = args[1], args[2], args[3] |
47 if action == 'del' then |
47 if action == 'del' then |
48 delayed_jobs[jid][stat] = nil |
48 delayed_jobs[jid][stat] = nil |
49 else |
49 else |
50 print ( 'List of jobs:' ) |
50 local text = '' |
51 for jid, jobs in pairs ( delayed_jobs ) do |
51 for jid, jobs in pairs ( delayed_jobs ) do |
52 for status, job in pairs ( jobs ) do |
52 for status, job in pairs ( jobs ) do |
53 print ( ' - ' .. jid .. ' -> ' .. status .. ': ' .. job ) |
53 text = text .. '\n - ' .. jid .. ' -> ' .. status .. ': ' .. job |
54 end |
54 end |
|
55 end |
|
56 if text ~= '' then |
|
57 print ( 'List of jobs:' .. text ) |
|
58 else |
|
59 print ( 'No jobs' ) |
55 end |
60 end |
56 end |
61 end |
57 end, { "del" } ) |
62 end, { "del" } ) |
58 |
63 |
59 commands_help['delay'] = "[-t target_jid] status_letter message\n\nDelays sending a message to target jid (or current buddy) until it switches to specified status." |
64 commands_help['delay'] = "[-t target_jid] status_letter message\n\nDelays sending a message to target jid (or current buddy) until it switches to specified status." |