summaryrefslogtreecommitdiff
path: root/src/plugins/trigger/trigger-completion.c
diff options
context:
space:
mode:
authorSimmo Saan <simmo.saan@gmail.com>2015-08-22 12:22:51 +0300
committerSimmo Saan <simmo.saan@gmail.com>2015-08-22 12:22:51 +0300
commit1d3a75333eb1b22fef74b8e0e32cdc9a85e97b00 (patch)
treee15a597694749aa633cd1eb1642bcfd9f4280cf4 /src/plugins/trigger/trigger-completion.c
parent0513800cb6eac66360320c4fba63354482f293b7 (diff)
downloadweechat-1d3a75333eb1b22fef74b8e0e32cdc9a85e97b00.zip
trigger: add support for one-time triggers (closes #399)
Diffstat (limited to 'src/plugins/trigger/trigger-completion.c')
-rw-r--r--src/plugins/trigger/trigger-completion.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/plugins/trigger/trigger-completion.c b/src/plugins/trigger/trigger-completion.c
index 1fede9bfc..63abd9a17 100644
--- a/src/plugins/trigger/trigger-completion.c
+++ b/src/plugins/trigger/trigger-completion.c
@@ -412,6 +412,32 @@ trigger_completion_hook_rc_cb (void *data, const char *completion_item,
}
/*
+ * Adds default once actions to completion list.
+ */
+
+int
+trigger_completion_once_cb (void *data, const char *completion_item,
+ struct t_gui_buffer *buffer,
+ struct t_gui_completion *completion)
+{
+ int i;
+
+ /* make C compiler happy */
+ (void) data;
+ (void) completion_item;
+ (void) buffer;
+
+ for (i = 0; i < TRIGGER_NUM_ONCE_ACTIONS; i++)
+ {
+ weechat_hook_completion_list_add (completion,
+ trigger_once_action_string[i], 0, WEECHAT_LIST_POS_END);
+ }
+
+ return WEECHAT_RC_OK;
+}
+
+
+/*
* Hooks completions.
*/
@@ -451,4 +477,7 @@ trigger_completion_init ()
weechat_hook_completion ("trigger_hook_rc",
N_("default return codes for hook callback"),
&trigger_completion_hook_rc_cb, NULL);
+ weechat_hook_completion ("trigger_once",
+ N_("trigger once actions"),
+ &trigger_completion_once_cb, NULL);
}