summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2014-03-01 17:25:48 +0100
committerSebastien Helleu <flashcode@flashtux.org>2014-03-01 17:25:48 +0100
commit44b8447ff073e983bcf91e70559b474c55744e2a (patch)
treefc23450c78b998a64ca36aee2f13169eb9072027 /src
parent050d2023d65cc071a65db58a578f7dfef08d3bd4 (diff)
downloadweechat-44b8447ff073e983bcf91e70559b474c55744e2a.zip
trigger: make optional the alignment on second and max calls (in hook timer)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/trigger/trigger-command.c3
-rw-r--r--src/plugins/trigger/trigger.c6
2 files changed, 4 insertions, 5 deletions
diff --git a/src/plugins/trigger/trigger-command.c b/src/plugins/trigger/trigger-command.c
index 315757f9d..4a6e5e1a8 100644
--- a/src/plugins/trigger/trigger-command.c
+++ b/src/plugins/trigger/trigger-command.c
@@ -915,8 +915,7 @@ trigger_command_init ()
" command: command (required), description, arguments, "
"description of arguments, completion\n"
" command_run: command (required)\n"
- " timer: interval (required), align on second (required), "
- "max calls (required)\n"
+ " timer: interval (required), align on second, max calls\n"
" config: name of option (required)\n"
" focus: name(s) of area (required)\n"
" conditions: evaluated conditions for the trigger\n"
diff --git a/src/plugins/trigger/trigger.c b/src/plugins/trigger/trigger.c
index 4a580469a..d74c2dda4 100644
--- a/src/plugins/trigger/trigger.c
+++ b/src/plugins/trigger/trigger.c
@@ -365,14 +365,14 @@ trigger_hook (struct t_trigger *trigger)
}
break;
case TRIGGER_HOOK_TIMER:
- if (argv && (argc >= 3))
+ if (argv && (argc >= 1))
{
error1 = NULL;
error2 = NULL;
error3 = NULL;
interval = strtol (argv[0], &error1, 10);
- align_second = strtol (argv[1], &error2, 10);
- max_calls = strtol (argv[2], &error3, 10);
+ align_second = strtol ((argc >= 2) ? argv[1] : "0", &error2, 10);
+ max_calls = strtol ((argc >= 3) ? argv[2] : "0", &error3, 10);
if (error1 && !error1[0]
&& error2 && !error2[0]
&& error3 && !error3[0]